Libboost system linker errors when cross compiling on x86

I am trying to create a 32 bit application on Ubuntu 11.04 x64. I'm having build problems due to linker errors with libboost. The build operator has -lboost_system in it, but when I try to build, I get a bunch of them:

CommunicationModule.cpp :(. Text + 0x68c1): undefined link to boost::system::generic_category()

CommunicationModule.cpp :(. Text + 0x68d7): undefined link to boost::system::system_category()

Everything I found on google says that I need to connect to the boost_system library. One place I found says to try directly linking it, but when I do locate boost_system , the result is empty. When I try to do sudo apt-get install libboost-system-dev , it tells me that it is already installed. I am here somehow perplexed. The library is installed, but it was not found by searching?

Can someone tell me what I need to do for the correct link to boost :: system? I am new to Linux and compiler complexity, so any help here would be appreciated.

Update:

Here is the result of dpkg -L libboost-system1.42-dev :

 /. /usr /usr/share /usr/share/doc /usr/share/doc/libboost-system1.42-dev /usr/share/doc/libboost-system1.42-dev/copyright /usr/share/doc/libboost-system1.42-dev/NEWS.Debian.gz /usr/share/doc/libboost-system1.42-dev/README.Debian.gz /usr/lib /usr/lib/libboost_system.a /usr/lib/libboost_system-mt.so /usr/lib/libboost_system-mt.a /usr/lib/libboost_system.so 

Is there a flag that I can use to refer to one of them directly? I tried using -L /usr/lib/libboost_system.so and -L /usr/lib/libboost_system-mt.so and none of them fixed the problem. Same thing with adding /usr/lib/libboost_system.a and /usr/lib/libboost_system-mt.a to the build statement.

Here is the compilation line:

 g++ -m32 -Wl,-O1 -o UTNaoTool [.o files] -L/usr/lib32 -lqglviewer-qt4 -lqwt-qt4 -lboost_system -lboost_thread -lQtXml -lQtOpenGL -lQtGui -lQtNetwork -lQtCore -lGLU -lpthread 

Update 2:

I downloaded boost 1.49 and built everything for 32-bit, and that seemed to help. A lot of errors have disappeared, but now I still have:

CommunicationModule.cpp :(. Text + 0x68c1): undefined promotion link :: System :: get_generic_category ()

Please note that the function is different. So, all my errors concern undefined references to get_system_category() and get_generic_category() . I tried to add the -lboost_filesystem command to the build command, but this did not fix it, and I made sure that it refers to the 32-bit library that I built when I built libboost_system .

+4
source share
2 answers

Looking at my own installation, it seems that libboost-system-dev is not installing libraries. Using dpkg to tell me that bz libboost-system-dev been installed, I get:

 $ dpkg -L libboost-system-dev /. /usr /usr/share /usr/share/doc /usr/share/doc/libboost-system-dev /usr/share/doc/libboost-system-dev/copyright /usr/share/doc/libboost-system-dev/changelog.gz 

Shaking, I think you need to install libboost-system1.48.1 (or some other version).

 sudo apt-get install libboost-system1.XX.Y 

You can also search libraries with the find , for example, search under /usr for all files starting with libboost_system :

 find /usr -name "libboost_system*" 

Change Since you are cross-compiling from a 64-bit OS to a 32-bit OS, you need 32-bit versions of the boost libraries. I would have the desire to create a small 32-bit virtual machine for this, instead of cross-compiling all the dependencies.

+1
source

I had the same problem with boost_serialization, here is what I found out after a couple of googling.

first you need to compile this library separately: so after loading the acceleration library, extract it and run sudo./bootstrap.sh ' , then sudo./b2 --with-system

after this step you should find the result when doing find boost_system

to do it manually, I did: both should work

g ++ boostexample.cpp -o run / PATH / libboost _serialization.a

g ++ boostexample.cpp -o run -L / PATH / -lboost_serialization

Ok, this works a little, and I'm still looking at how to link the library properly

Hope this helps :)

0
source

Source: https://habr.com/ru/post/1411501/


All Articles