在我的solaris 64位机器上,我通过链接3个目标文件drivermain.o(2),testcol.o(3)和teststmt.o(3)来创建可执行文件“drivertest”(1)。我在命令中使用了-m64选项来创建64位可执行文件。当我尝试运行可执行文件时,我收到错误“非法指令(核心转储)”。当我尝试使用dbx命令查看核心时,它说“dbx:File`drivertest'不是ELF可执行文件”。我的可执行文件是64位,为什么dbx不能与64位应用程序一起工作?
当我在可执行文件上运行ldd命令时,它会为几个依赖项(4)提供“找不到文件”错误,所有这些都在/ export / home / builds / pc9x_root / 960 / build / powrmart /中pmbuild / bin / SunOS.64.r(5)并且此目录包含在使用setenv命令导出的LD_LIBRARY_PATH中。 为什么会这样呢?
(1)
CC -G -m64 -o drivertest SunOS.64.r/drivermain.o SunOS.64.r/testcol.o SunOS.64.r/teststmt.o \
-L/export/home/builds/pc9x_root/960/build/powrmart/pmbuild/bin/SunOS.64.r -L/databases/oracle10.2.0_64BIT/lib -L/export/home/builds/pc9x_root/960/repo/third-party-libs/ACE/ace -L/export/home/builds/pc9x_root/960/build/powrmart/pmbuild/bin/SunOS.64.r \
-lpmcuti -lpmasrt -lpmser -lpmi18n -lpmdec -lpmodl -lclntsh -lpmicudata -lpmicui18n -lpmicuio -lpmicuuc -lpmsdkcmn
(2)
CC +w +w2 -mt -features=extensions -erroff=doubunder -m64 -O -KPIC -m64 -D_REENTRANT -DRW_MULTI_THREAD -DRW_NO_STL -DRW_BCB_NEW_IOSTREAMS -DPM_64BIT -DFD_SETSIZE=65536 -DUNIX -DSunOS -DINFA_PREFIX -I. -I/export/home/builds/pc9x_root/960/build/powrmart/server/dwriter -I/export/home/builds/pc9x_root/960/build/powrmart/server/dwriter/wrtfile -I/export/home/builds/pc9x_root/960/build/powrmart/server/include -I/export/home/builds/pc9x_root/960/build/powrmart/server/include/cef -I/export/home/builds/pc9x_root/960/build/powrmart/server/dmapper/trans -I/export/home/builds/pc9x_root/960/build/powrmart/server/dmapper/scrub -I/export/home/builds/pc9x_root/960/build/powrmart/server/dreader -I/export/home/builds/pc9x_root/960/build/powrmart/server/cmnutils -I/export/home/builds/pc9x_root/960/build/powrmart/common/cmnmisc -I/export/home/builds/pc9x_root/960/repo/third-party-libs/mitkerberos/include -I/export/home/builds/pc9x_root/960/repo/third-party-libs/CURL/include -I/export/home/builds/pc9x_root/960/repo/third-party-libs/OPENSSL/include -I/export/home/builds/pc9x_root/960/repo/third-party-libs/PMTL_PC -I/export/home/builds/pc9x_root/960/repo/third-party-libs/STLPORT_INCLUDE/stlport -I/export/home/builds/pc9x_root/960/repo/third-party-libs/ICU/include -I/export/home/builds/pc9x_root/960/repo/third-party-libs/ICU/source/common \
-c /home/devops/drivertest/drivermain.cpp -o SunOS.64.r/drivermain.o
(3)
CC +w +w2 -mt -features=extensions -erroff=doubunder -m64 -O -KPIC -m64 -D_REENTRANT -DRW_MULTI_THREAD -DRW_NO_STL -DRW_BCB_NEW_IOSTREAMS -DPM_64BIT -DFD_SETSIZE=65536 -DUNIX -DSunOS -DINFA_PREFIX -I. -I/export/home/builds/pc9x_root/960/build/powrmart/server/dwriter -I/export/home/builds/pc9x_root/960/build/powrmart/server/dwriter/wrtfile -I/export/home/builds/pc9x_root/960/build/powrmart/server/include -I/export/home/builds/pc9x_root/960/build/powrmart/server/include/cef -I/export/home/builds/pc9x_root/960/build/powrmart/server/dmapper/trans -I/export/home/builds/pc9x_root/960/build/powrmart/server/dmapper/scrub -I/export/home/builds/pc9x_root/960/build/powrmart/server/dreader -I/export/home/builds/pc9x_root/960/build/powrmart/server/cmnutils -I/export/home/builds/pc9x_root/960/build/powrmart/common/cmnmisc -I/export/home/builds/pc9x_root/960/repo/third-party-libs/mitkerberos/include -I/export/home/builds/pc9x_root/960/repo/third-party-libs/CURL/include -I/export/home/builds/pc9x_root/960/repo/third-party-libs/OPENSSL/include -I/export/home/builds/pc9x_root/960/repo/third-party-libs/PMTL_PC -I/export/home/builds/pc9x_root/960/repo/third-party-libs/STLPORT_INCLUDE/stlport -I/export/home/builds/pc9x_root/960/repo/third-party-libs/ICU/include -I/export/home/builds/pc9x_root/960/repo/third-party-libs/ICU/source/common \
-c /home/devops/drivertest/testcol.cpp -o SunOS.64.r/testcol.o
(4)
CC +w +w2 -mt -features=extensions -erroff=doubunder -m64 -O -KPIC -m64 -D_REENTRANT -DRW_MULTI_THREAD -DRW_NO_STL -DRW_BCB_NEW_IOSTREAMS -DPM_64BIT -DFD_SETSIZE=65536 -DUNIX -DSunOS -DINFA_PREFIX -I. -I/export/home/builds/pc9x_root/960/build/powrmart/server/dwriter -I/export/home/builds/pc9x_root/960/build/powrmart/server/dwriter/wrtfile -I/export/home/builds/pc9x_root/960/build/powrmart/server/include -I/export/home/builds/pc9x_root/960/build/powrmart/server/include/cef -I/export/home/builds/pc9x_root/960/build/powrmart/server/dmapper/trans -I/export/home/builds/pc9x_root/960/build/powrmart/server/dmapper/scrub -I/export/home/builds/pc9x_root/960/build/powrmart/server/dreader -I/export/home/builds/pc9x_root/960/build/powrmart/server/cmnutils -I/export/home/builds/pc9x_root/960/build/powrmart/common/cmnmisc -I/export/home/builds/pc9x_root/960/repo/third-party-libs/mitkerberos/include -I/export/home/builds/pc9x_root/960/repo/third-party-libs/CURL/include -I/export/home/builds/pc9x_root/960/repo/third-party-libs/OPENSSL/include -I/export/home/builds/pc9x_root/960/repo/third-party-libs/PMTL_PC -I/export/home/builds/pc9x_root/960/repo/third-party-libs/STLPORT_INCLUDE/stlport -I/export/home/builds/pc9x_root/960/repo/third-party-libs/ICU/include -I/export/home/builds/pc9x_root/960/repo/third-party-libs/ICU/source/common \
-c /home/devops/drivertest/teststmt.cpp -o SunOS.64.r/teststmt.o
(5)
psrux902b1% ldd drivertest
libpmcuti.so => (file not found)
libpmasrt.so => (file not found)
libpmser.so => (file not found)
libpmi18n.so => (file not found)
libpmdec.so => (file not found)
libpmodl.so => (file not found)
libclntsh.so.10.1 => /databases/oracle10.2.0_64BIT/lib/libclntsh.so.10.1
libpmicudata.so.32 => /export/home/builds/pc9x_root/960/repo/third-party-libs/ICU/lib/libpmicudata.so.32
libpmicui18n.so.32 => /export/home/builds/pc9x_root/960/repo/third-party-libs/ICU/lib/libpmicui18n.so.32
libpmicuio.so.32 => /export/home/builds/pc9x_root/960/repo/third-party-libs/ICU/lib/libpmicuio.so.32
libpmicuuc.so.32 => /export/home/builds/pc9x_root/960/repo/third-party-libs/ICU/lib/libpmicuuc.so.32
libpmsdkcmn.so => (file not found)
libnnz10.so => /databases/oracle10.2.0_64BIT/lib/libnnz10.so
libkstat.so.1 => /lib/64/libkstat.so.1
libnsl.so.1 => /lib/64/libnsl.so.1
libsocket.so.1 => /lib/64/libsocket.so.1
libgen.so.1 => /lib/64/libgen.so.1
libdl.so.1 => /lib/64/libdl.so.1
libsched.so.1 => /usr/lib/64/libsched.so.1
libaio.so.1 => /lib/64/libaio.so.1
librt.so.1 => /lib/64/librt.so.1
libm.so.2 => /lib/64/libm.so.2
libc.so.1 => /lib/64/libc.so.1
libpthread.so.1 => /lib/sparcv9/libpthread.so.1
libmp.so.2 => /lib/64/libmp.so.2
libmd.so.1 => /lib/64/libmd.so.1
libscf.so.1 => /lib/64/libscf.so.1
libdoor.so.1 => /lib/64/libdoor.so.1
libuutil.so.1 => /lib/64/libuutil.so.1
/platform/SUNW,T5240/lib/sparcv9/libc_psr.so.1
/platform/SUNW,T5240/lib/sparcv9/libmd_psr.so.1
(6)
psrux902b1% ls /export/home/builds/pc9x_root/960/build/powrmart/pmbuild/bin/SunOS.64.r/libpmasrt.so
/export/home/builds/pc9x_root/960/build/powrmart/pmbuild/bin/SunOS.64.r/libpmasrt.so
psrux902b1% ls /export/home/builds/pc9x_root/960/build/powrmart/pmbuild/bin/SunOS.64.r/libpmser.so
/export/home/builds/pc9x_root/960/build/powrmart/pmbuild/bin/SunOS.64.r/libpmser.so
psrux902b1% ls /export/home/builds/pc9x_root/960/build/powrmart/pmbuild/bin/SunOS.64.r/libpmi18n.so
/export/home/builds/pc9x_root/960/build/powrmart/pmbuild/bin/SunOS.64.r/libpmi18n.so
psrux902b1% ls /export/home/builds/pc9x_root/960/build/powrmart/pmbuild/bin/SunOS.64.r/libpmdec.so
/export/home/builds/pc9x_root/960/build/powrmart/pmbuild/bin/SunOS.64.r/libpmdec.so
psrux902b1% ls /export/home/builds/pc9x_root/960/build/powrmart/pmbuild/bin/SunOS.64.r/libpmodl.so
/export/home/builds/pc9x_root/960/build/powrmart/pmbuild/bin/SunOS.64.r/libpmodl.so
答案 0 :(得分:0)
您可以使用file(1)
来检查哪个类型的ELF二进制文件是哪个对象/可执行文件。如果你试图混合使用32b和64b ELF对象,它就不会起作用(例如,如果libpmcuti.so是32b对象而你的可执行文件是64b)。还要确保实际导出LD_LIBRARY_PATH。由于您使用-m64,默认情况下您的工具链似乎是32b:dbx也可能是32b,并且无法使用64b可执行文件?