While building casync using ninja build I am facing below errors related to /usr/bin/ld: . . .error adding symbols: file in wrong format
I am following casync build guideline from systemd/casync
ninja: Entering directory `build'
[1/23] Linking target casync-http
FAILED: casync-http
cc -o casync-http casync-http.p/src_casync-http.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-rpath,/root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib -Wl,-rpath-link,/root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib -Wl,--start-group src/libshared.a /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libcurl.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libssl.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libcrypto.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/liblzma.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libz.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libzstd.so -lm -Wl,--end-group
/usr/bin/ld: /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libcurl.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
[2/23] Linking target test-cadigest
FAILED: test-cadigest
cc -o test-cadigest test-cadigest.p/test_test-cadigest.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-rpath,/root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib -Wl,-rpath-link,/root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib -Wl,--start-group src/libshared.a -lacl /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/liblzma.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libselinux.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libz.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libzstd.so -lm /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libssl.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libcrypto.so -Wl,--end-group -pthread
/usr/bin/ld: /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/liblzma.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
[3/23] Linking target test-cachunker
FAILED: test-cachunker
cc -o test-cachunker test-cachunker.p/test_test-cachunker.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-rpath,/root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib -Wl,-rpath-link,/root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib -Wl,--start-group src/libshared.a -lacl /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/liblzma.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libselinux.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libz.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libzstd.so -lm /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libssl.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libcrypto.so -Wl,--end-group -pthread
/usr/bin/ld: /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/liblzma.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
[4/23] Linking target test-cachunker-histogram
FAILED: test-cachunker-histogram
cc -o test-cachunker-histogram test-cachunker-histogram.p/test_test-cachunker-histogram.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-rpath,/root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib -Wl,-rpath-link,/root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib -Wl,--start-group src/libshared.a -lacl /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/liblzma.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libselinux.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libz.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libzstd.so -lm /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libssl.so /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/libcrypto.so -Wl,--end-group -pthread
/usr/bin/ld: /root/raspcm4/sources/output/host/bin/../aarch64-buildroot-linux-gnu/sysroot/usr/lib/liblzma.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
[5/23] Linking target test-cachunk
.
.
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
I am using Buildroot as build system and after following similar post in libstdc++.so: error adding symbols: File in wrong format I changed the PATH environment like:
/root/raspcm4/sources/output/host/bin/:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/raspcm4/sources/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/bin
But still I end up getting same errors
Can anyone please let me know how to resolve this issue?
Your help will be much appreciated.
Thanks in advance
P.S: Please let me know if any info is missing here
While compiling my project on Ubuntu 14.04 I got the following error:
/usr/bin/ld: /tmp/ccpU0kVX.o: undefined reference to symbol '_ZN7IceUtil19NullHandleExceptionC1EPKci'
//usr/lib/x86_64-linux-gnu/libIceUtil.so.36: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
While compiling ICE project with a command:
g++ -I. server.cpp -lIce -lpthread
This is propably some problem with linking but I can't figure it out.
With Ice 3.6, you need to link with Ice and IceUtil:
g++ -o server server.cpp -pthread -lIce -lIceUtil
See https://doc.zeroc.com/ice/3.6/ice-release-notes/using-the-linux-binary-distributions#id-.UsingtheLinuxBinaryDistributionsv3.6-C++
We are migrating some very simple C++ programs from AIX Server to Linux. The code is compiling fine on AIX server.
I tried to compile the C++ code in the Linux server. But the command line below failed:
g++ map2key.cpp -o map2key -nodefaultlibs -lstdc++ -lm -lgcc_s -lc -Xlinker -bmaxdata:0x8000000
With the error message:
/bin/ld: invalid BFD target `maxdata:0x80000000'
collect2: error: ld returned 1 exit status
The C++ program should be compiled and executable file should be generated
If you can help, I would very much appreciate it.
This question already has answers here:
Linking OpenSSL libraries to a program
(4 answers)
Closed 5 years ago.
Encountering error while creating a shared library of AES. The following commands are used :
gcc -Wall Test1.c x64/libSESDAPI.a -fPIC -lssl -lcrypto
gcc -shared -o libfile.so a.out -nostartfiles
And I am getting the following errors:
/usr/bin/ld: error in a.out(.eh_frame); no .eh_frame_hdr table will be created.
/usr/bin/ld: libfile.so: No symbol version section for versioned symbol `AES_cbc_encrypt##OPENSSL_1.0.0'
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
I am new to shared libraries so please help.
Edit: I have edited and added the lcrypto and lssl
Edit2: By adding a -c in the first command, the above errors are now resolved. But now accessing the .so file with python gives a new error
OSError: ./libfile.so: undefined symbol: SDSCListDevs
Please tell why this error is coming.
You should be creating your shared library from an object file, not from an executable program.
You also need to link with the SSL libraries.
Commands to use:
# Compile the source file, generate object file
gcc -Wall Test1.c -c -fPIC
# Link object file with libraries to create the shared object
gcc -shared -fPIC -o libfile.so Test1.o x64/libSESDAPI.a -lssl -lcrypto
I tried to compile a pass source code in my MacOSX 10.8. I first had the problem that
iMac-de-Anne:pass_v1.2 elenacapel$ make
g++ src/pass.cpp -O9 -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DSHRIMP_BUGS=OFF -static -D NOSERVER -lpthread -o bin/pass
ld: library not found for -lcrt0.o
collect2: ld returned 1 exit status
make: *** [all] Error 1
But I could install the libraries missing by installing Xcode.
Now I have a different error while trying to compile the source code:
iMac-de-Anne:pass_v1.2 elenacapel$ make
g++ src/pass.cpp -O9 -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DSHRIMP_BUGS=OFF -static -D NOSERVER -lpthread -o bin/pass
error: invalid value '9' in '-O9'
make: *** [all] Error 1
Any helpful tips?