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.
Related
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++
I am trying to build an executable file for Ubuntu machine for v8.
The following is the command executed :
g++ -g -ggdb -o Engine -lm *.o -Wl,--start-group /home/atdesk-83/v8/out/native/obj.target/{tools/gyp/libv8_{base,libbase,snapshot,libplatform},third_party/icu/libicu{uc,i18n,data}}.a -Wl,--end-group -lrt -pthread
I am receiving the error :
/home/atdesk-83/v8/out/native/obj.target/tools/gyp/libv8_base.a: error
adding symbols: Malformed archive collect2: error: ld returned 1 exit
status
Can anyone help to solve this?
I am using GNU fortran compiler and I am compiling the code using command prompt in MacOS. I am getting an error which says that the
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
I have tried reinstalling the xcode and it did not work
gfortran -o executable try.o
Should be getting an executable file
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'm trying to link some .o files with:
gcc -m32 send.o lib.o -o send
and i get:
/usr/bin/ld: i386:x86-64 architecture of input file `send.o' is incompatible with i386 output
/usr/bin/ld: final link failed: Invalid operation
collect2: ld returned 1 exit status
I have installed
libc6-i386
gcc-multilib
ia32-lib
Where could be the problem?
You're not compiling. You're linking already compiled object files. It appears that send.o was compiled as an x86_64 object (without -m32). You cannot link a 64-bit executable from 32-bit object files.
Make sure all your object files are compiled in 32-bit mode.