Question

I am trying to build lib_share.so file from exiting MY_LIB.so file. MY_LIB.so file is in my_path.

g++ -shared -o lib_share.so -L/my_path -lMYLIB 

When I run ,it is giving me error as fallows

bin/ld: skipping incompatible /home/folder/lMY_LIB.so 

when searching for -lMY_LIB

/home/../../bin/ld: cannot find -lMY_LIB

P.S.:MY_LIB.so is soft link

When I go to main .so file and I searched the MY_LIB in main .so it is being giving as follows.

objdump -p MY_LIB.so.1.0.1 | grep 
MY_LIB.so.1.0.1:     file format **elf32-big**
  SONAME               MY_LIB.so.1

The file format of library is 32bit and I am using 64 bit machine to compile (g++ -shared -o lib_share.so -L/my_path -lMYLIB)

Can any one help to understand why I am not able compile(g++ -shared -o lib_share.so -L/my_path -lMYLIB) even though MY_LIB is physically present it directory

As per my google search it is because of the library is 32 bit and I am using 64 bit machine to compile the program.

Can anyone give any other possibility of error and how to solve this error.

Was it helpful?

Solution

Try to use the -m32 flag of g++ to compile the whole program in 32bit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top