[Boost-users] Problems linking shared library with ASIO/System/Serialization/Python

126 views
Skip to first unread message

Federico J. Fernández

unread,
Nov 21, 2011, 7:08:02 AM11/21/11
to boost...@lists.boost.org
Hi All,

I'm trying to build a shared library on Linux, that will become a Python module via Boost.Python. That library also requires functionality from Boost.ASIO and Boost.Serialization. I'm using Boost 1.46.1, and gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4).

I'm getting undefined errors related to Boost.System during the compilation:

g++ -L/usr/local/lib/ -shared python_client.o network_interface.o geometry_model_api.o client.o -o python_client.so -lpython2.7 -lboost_python -lboost_serialization -lboost_thread -lQtCore -lpthread -Wl,-no-undefined
network_interface.o: In function `get_system_category':
/usr/local/include/boost/asio/error.hpp:220: undefined reference to `boost::system::system_category()'
/usr/local/include/boost/asio/error.hpp:220: undefined reference to `boost::system::system_category()'
/usr/local/include/boost/asio/error.hpp:220: undefined reference to `boost::system::system_category()'
/usr/local/include/boost/asio/error.hpp:220: undefined reference to `boost::system::system_category()'
network_interface.o: In function `error_code':
/usr/local/include/boost/system/error_code.hpp:315: undefined reference to `boost::system::system_category()'
network_interface.o:/usr/local/include/boost/asio/error.hpp:220: more undefined references to `boost::system::system_category()' follow
client.o: In function `__static_initialization_and_destruction_0':
/usr/local/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
/usr/local/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
/usr/local/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
client.o: In function `get_system_category':
/usr/local/include/boost/asio/error.hpp:220: undefined reference to `boost::system::system_category()'
client.o: In function `error_code':
/usr/local/include/boost/system/error_code.hpp:315: undefined reference to `boost::system::system_category()'
/usr/local/include/boost/system/error_code.hpp:315: undefined reference to `boost::system::system_category()'
/usr/local/include/boost/system/error_code.hpp:315: undefined reference to `boost::system::system_category()'
client.o:/usr/local/include/boost/system/error_code.hpp:315: more undefined references to `boost::system::system_category()' follow
collect2: ld returned 1 exit status

I tried defining BOOST_SYSTEM_NO_DEPRECATED, some errors disappear, others don't.

Any advice is greatly appreciated. Thanks in advance.

--
federico

Igor R

unread,
Nov 21, 2011, 11:16:16 AM11/21/11
to boost...@lists.boost.org
> I'm trying to build a shared library on Linux, that will become a Python
> module via Boost.Python. That library also requires functionality from
> Boost.ASIO and Boost.Serialization. I'm using Boost 1.46.1, and gcc version
> 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4).
> I'm getting undefined errors related to Boost.System during the compilation:
>
> g++ -L/usr/local/lib/ -shared python_client.o network_interface.o
> geometry_model_api.o client.o -o python_client.so -lpython2.7 -lboost_python
> -lboost_serialization -lboost_thread -lQtCore -lpthread -Wl,-no-undefined
> network_interface.o: In function `get_system_category':


You should link with Boost.System:
-lboost_system
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Federico J. Fernández

unread,
Nov 21, 2011, 1:37:54 PM11/21/11
to boost...@lists.boost.org
You should link with Boost.System:
-lboost_system

Thanks Igor.

I tried before linking to boost_system, but it didn't worked. This time, I tried again, and it works. I probably changed something else in the process.

Thanks for your help!

--
federico
Reply all
Reply to author
Forward
0 new messages