E
E
Evgeny Ivanovich2019-09-09 08:58:00
linux
Evgeny Ivanovich, 2019-09-09 08:58:00

Installing 32 bit boost libraries in ubuntu?

In general, the task was to connect restsdk to a project in linux to compile a 32-bit library. I compile and this is what comes out

[email protected]:~/workbench/ukau-gmod-module$ ./compile.sh 
/usr/bin/ld: /tmp/cc9Ec8ui.o: in function `_GLOBAL__sub_I_main.cpp':
main.cpp:(.text+0xb0): undefined reference to `boost::system::system_category()'
/usr/bin/ld: /tmp/cc9Ec8ui.o: in function `boost::system::error_category::std_category::equivalent(int, std::error_condition const&) const':
main.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition[_ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition]+0x3b): undefined reference to `boost::system::generic_category()'
/usr/bin/ld: main.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition[_ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition]+0xbc): undefined reference to `boost::system::generic_category()'
/usr/bin/ld: /tmp/cc9Ec8ui.o: in function `boost::system::error_category::std_category::equivalent(std::error_code const&, int) const':
main.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0x3f): undefined reference to `boost::system::generic_category()'
/usr/bin/ld: main.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0xc0): undefined reference to `boost::system::generic_category()'
/usr/bin/ld: main.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0xfc): undefined reference to `boost::system::generic_category()'
/usr/bin/ld: /tmp/cc9Ec8ui.o: in function `std::_Sp_counted_ptr<boost::asio::ssl::detail::openssl_init_base::do_init*, (__gnu_cxx::_Lock_policy)2>::_M_dispose()':
main.cpp:(.text._ZNSt15_Sp_counted_ptrIPN5boost4asio3ssl6detail17openssl_init_base7do_initELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv[_ZNSt15_Sp_counted_ptrIPN5boost4asio3ssl6detail17openssl_init_base7do_initELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv]+0x21): undefined reference to `CONF_modules_unload'
/usr/bin/ld: /tmp/cc9Ec8ui.o: in function `boost::asio::detail::posix_global_impl<boost::asio::system_context>::~posix_global_impl()':
main.cpp:(.text._ZN5boost4asio6detail17posix_global_implINS0_14system_contextEED2Ev[_ZN5boost4asio6detail17posix_global_implINS0_14system_contextEED5Ev]+0x208): undefined reference to `pthread_join'
/usr/bin/ld: main.cpp:(.text._ZN5boost4asio6detail17posix_global_implINS0_14system_contextEED2Ev[_ZN5boost4asio6detail17posix_global_implINS0_14system_contextEED5Ev]+0x21e): undefined reference to `pthread_detach'
/usr/bin/ld: /tmp/cc9Ec8ui.o: in function `boost::asio::ssl::detail::openssl_init_base::instance()':
main.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base8instanceEv[_ZN5boost4asio3ssl6detail17openssl_init_base8instanceEv]+0x103): undefined reference to `CONF_modules_unload'
/usr/bin/ld: /tmp/cc9Ec8ui.o: in function `boost::asio::error::detail::ssl_category::message[abi:cxx11](int) const':
main.cpp:(.text._ZNK5boost4asio5error6detail12ssl_category7messageB5cxx11Ei[_ZNK5boost4asio5error6detail12ssl_category7messageB5cxx11Ei]+0x1b): undefined reference to `ERR_reason_error_string'
collect2: error: ld returned 1 exit status

It turns out that he does not find the library, okay. I connect the library using -lboost_system and the output is
[email protected]:~/workbench/ukau-gmod-module$ ./compile.sh 
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libboost_system.so when searching for -lboost_system
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libboost_system.a when searching for -lboost_system
/usr/bin/ld: cannot find -lboost_system
collect2: error: ld returned 1 exit status

I understand that the libraries are 64 bit. Tell me how to fix the situation?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Radjah, 2019-09-09
@Radjah

Add i386 architecture.
Install the libboost-all-dev:i386 package or only the necessary devs with the architecture.
Most likely you will also need the gcc-multilib package.
Add the -m32
Once flag to the compiler launch options https://www.geeksforgeeks.org/compile-32-bit-progr...
Two https://stackoverflow.com/questions/1272357/how-to...

V
Victor Taran, 2019-09-09
@shambler81

You didn't specify a distribution.
but they said for a long time
https://ko.com.ua/razrabotchiki_linux_otkazyvayuts...
And here are the consequences
https://www.opennet.ru/opennews/art.shtml?num=50935
Perhaps you are the lucky owner;)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question