'ld: fatal: file bcPACplacebo.o: wrong ELF class: ELFCLASS32
Below are my environments that I am running my project which has C and CPP codes.
uname -a:
SunOS nzdrb12z 5.11 11.4.40.107.3 sun4v sparc sun4v non-global-zone
cc -V:
cc: Studio 12.6 Sun C 5.15 SunOS_sparc 2017/05/30
Currently facing following errors,
CURRENT ERROR:
ld: fatal: file /opt/developerstudio12.6/OracleDeveloperStudio12.6-solaris-sparc-bin/developerstudio12.6/lib/compilers/sparcv9/libCCexcept.so.1: wrong ELF class: ELFCLASS64
ld: fatal: file bcPLogon.o: wrong ELF class: ELFCLASS64
ld: fatal: file bcSecurity.o: wrong ELF class: ELFCLASS64
ld: fatal: file bcPAccessCheck.o: wrong ELF class: ELFCLASS64
ld: fatal: file bcPEncryption.o: wrong ELF class: ELFCLASS64
ld: fatal: file bcPAuthentication.o: wrong ELF class: ELFCLASS64
ld: fatal: file bcPSecurityObjects.o: wrong ELF class: ELFCLASS64
ld: fatal: file bcPCEnc.o: wrong ELF class: ELFCLASS6
Earlier to this I was facing an error similar to this as mentioned below,
ld: fatal: file bcPACplacebo.o: wrong ELF class: ELFCLASS32
So I did the changes in makefile as below,
under MakeDefaults.Solaris64 (Main makefile)
CC_MEMORY_MODEL_64=-m64
CC_MEMORY_MODEL_32=-m32
COMPILEFLAGS=-c -DSOLARIS $(CC_MEMORY_MODEL_64) $(COMMONFLAGS) $(ROGUEFLAGS) -D_REENTRANT $(CC_OPTIONAL_FLAGS) -xO3 -xbuiltin=%all -xlibmil -errtags -erroff nonpodvarargw -mt -std=c++14
C_FLAGS=-c -DSOLARIS $(CC_MEMORY_MODEL_32) $(COMMONFLAGS) $(ROGUEFLAGS) -D_REENTRANT $(CC_OPTIONAL_FLAGS) -xO3 -xbuiltin=%all -xlibmil -errtags -erroff nonpodvarargw -mt
under security module which has few c files (namely bcPACplacebo.c) I did the below changes in the makefile
bcPACplacebo.o: bcPACplacebo.c
cc $(C_FLAGS) -D_HPUX -DCHECK_PASSWORD bcPACplacebo.c -c -o bcPACplacebo.o
After compiling I started facing the CURRENT ERROR:, I was not expecting that there could be many objects which I may have to differentiate between 64 and 32.
Questions: I understand this could be the duplicate, but I didn't find working answers from all the threads. But here are my questions,
- How to resolve this wrong ELF class errors once for all.
- As I am novice in makefile scripts, I am not much aware of how to tag the objects as 32 and 64. or is there any better method to resolve this. Any help is greatly appreciated.
Solution 1:[1]
You can't mix 32-bit & 64-bit objects when compiling - the program has to be either all of one or all of the other - either use -m32 in all commands or -m64 in all commands.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | alanc |