ld:致命:文件 bcPACplacebo.o:错误的 ELF 类:ELFCLASS32
以下是我运行项目的环境,其中包含 C 和 CPP 代码。
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
当前面临以下错误,
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
在此之前我遇到了一个错误与下面提到的类似,
ld: fatal: file bcPACplacebo.o: wrong ELF class: ELFCLASS32
所以我在 makefile 中做了如下更改,
在MakeDefaults.Solaris64(主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
在具有很少 c 文件(即 bcPACplacebo.c)的安全模块下,我在 makefile 中进行了以下更改
bcPACplacebo.o:bcPACplacebo.c
<前><代码> cc $(C_FLAGS) -D_HPUX -DCHECK_PASSWORD bcPACplacebo.c -c -o bcPACplacebo.o
编译后我开始面临当前错误:,我没想到可能有很多对象我可能必须区分 64 和 32。
问题: 我知道这可能是重复的,但我没有从所有线程中找到有效的答案。但我的问题是,
- 如何一次性解决这个错误的 ELF 类错误。
- 由于我是 makefile 脚本的新手,所以我不太清楚如何将对象标记为 32 和 64。或者是否有更好的方法来解决这个问题。 非常感谢任何帮助。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能混合32位&amp;编译时64位对象 - 该程序必须是所有一个或全部的一个或全部 - 在所有命令中使用-m32,或在所有命令中使用-m64。
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.