ld:致命:文件 bcPACplacebo.o:错误的 ELF 类:ELFCLASS32

发布于 2025-01-20 00:39:35 字数 1925 浏览 18 评论 0原文

以下是我运行项目的环境,其中包含 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 中做了如下更改,

  1. 在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

  2. 在具有很少 c 文件(即 bcPACplacebo.c)的安全模块下,我在 makefile 中进行了以下更改

    bcPACplacebo.o:bcPACplacebo.c

    <前><代码> cc $(C_FLAGS) -D_HPUX -DCHECK_PASSWORD bcPACplacebo.c -c -o bcPACplacebo.o

编译后我开始面临当前错误:,我没想到可能有很多对象我可能必须区分 64 和 32。

问题: 我知道这可能是重复的,但我没有从所有线程中找到有效的答案。但我的问题是,

  1. 如何一次性解决这个错误的 ELF 类错误。
  2. 由于我是 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,

  1. 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

  2. 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,

  1. How to resolve this wrong ELF class errors once for all.
  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千里故人稀 2025-01-27 00:39:35

您不能混合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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文