discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] How to link an external libraries to solve Import


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] How to link an external libraries to solve ImportError: undefined symbol problem?
Date: Wed, 21 Dec 2016 17:00:13 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

Hi Jeon,

There's a "B" at the end of your "include_directories", but I guess that's just a copy&paste problem here – otherwise, compilation would've failed.

I think you need to use "${LIBBLUETOOTH_LIBRARIES}" in the target_link_libraries directive in your lib/CMakeLists.txt, not in link_directories in your main CMakeLists.txt.

Best regards,

Marcus


On 21.12.2016 16:48, Jeon wrote:
In my OOT module, I am using `libbluetooth-dev` library by BlueZ. I am using a couple of APIs of it such as `hci_read_clock`. I am using FindBluetooth cmake module (https://github.com/greatscottgadgets/ubertooth/blob/master/host/cmake/modules/FindBLUETOOTH.cmake) and I thought that I correctly linked the library.

find_package(Bluetooth REQUIRED)
if(NOT LIBBLUETOOTH_FOUND)
    message(FATAL_ERROR "bluez (libbluetooth-dev) required")
endif()

include_directories(
    ${CMAKE_SOURCE_DIR}/lib
    ${CMAKE_SOURCE_DIR}/include
    ${CMAKE_BINARY_DIR}/lib
    ${CMAKE_BINARY_DIR}/include
    ${Boost_INCLUDE_DIRS}
    ${CPPUNIT_INCLUDE_DIRS}
    ${GNURADIO_ALL_INCLUDE_DIRS}
    ${LIBBLUETOOTH_INCLUDE_DIR}B
)

link_directories(
    ${Boost_LIBRARY_DIRS}
    ${CPPUNIT_LIBRARY_DIRS}
    ${GNURADIO_RUNTIME_LIBRARY_DIRS}
    ${LIBBLUETOOTH_LIBRARIES}
)

And I successfully built and installed my OOT module. To test it, I made a simple flow graph but it fails to run. After some debugging, It seems that I reached at the dead end.

Debug log:

$ /usr/local/lib/python2.7/dist-packages/my_oot_module
$ python my_oot_module_swig.py
Traceback (most recent call last):
  File "my_oot_module_swig.py", line 28, in <module>
    _my_oot_module_swig = swig_import_helper()
  File "my_oot_module_swig.py", line 24, in swig_import_helper
    _mod = imp.load_module('_my_oot_module_swig', fp, pathname, description)
ImportError: /usr/local/lib/libgnuradio-my_oot_module.so: undefined symbol: hci_read_clock

I wonder that the above error is C++ level error or Python level error. And how can I fix it?

If infromation given in this post is not sufficient, please let me know it.

Regards,
Jeon.


_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


reply via email to

[Prev in Thread] Current Thread [Next in Thread]