Skip to content

Linking liblxi #115

@tomverbeure

Description

@tomverbeure

I trying to create a SCPILxiTransport class, which relies on liblxi for the low level details.

I've updated the scopehal/CMakeLists.txt to add a dependency on liblxi as follows:

--- a/scopehal/CMakeLists.txt
+++ b/scopehal/CMakeLists.txt
@@ -1,6 +1,8 @@
 include_directories(${GTKMM_INCLUDE_DIRS} ${SIGCXX_INCLUDE_DIRS})
 link_directories(${GTKMM_LIBRARY_DIRS} ${SIGCXX_LIBRARY_DIRS})
 
+find_library(LXI_LIB lxi)
+
 set(SCOPEHAL_SOURCES
        base64.cpp
        scopehal.cpp
@@ -10,6 +12,7 @@ set(SCOPEHAL_SOURCES
        SCPITransport.cpp
        SCPISocketTransport.cpp
        VICPSocketTransport.cpp
+       SCPILxiTransport.cpp
        SCPIDevice.cpp
 
        Instrument.cpp
@@ -38,7 +41,7 @@ set(SCOPEHAL_SOURCES
 
 add_library(scopehal SHARED
        ${SCOPEHAL_SOURCES})
-target_link_libraries(scopehal ${SIGCXX_LIBRARIES} ${GTKMM_LIBRARIES} xptools log graphwidget yaml-cpp)
+target_link_libraries(scopehal ${SIGCXX_LIBRARIES} ${GTKMM_LIBRARIES} xptools log graphwidget yaml-cpp ${LXI_LIB})

libscopehal.so itself compiles fine, but when I try to build the applications, it fails because it doesn't link with liblxi:

[ 77%] Linking CXX executable glscopeclient
../../lib/scopehal/libscopehal.so: undefined reference to `lxi_init()'
collect2: error: ld returned 1 exit status
src/glscopeclient/CMakeFiles/glscopeclient.dir/build.make:426: recipe for target 'src/glscopeclient/glscopeclient' failed

This is despite the fact that CMakeFiles/glscopeclient.dir/link.txt has the following on the linking command:

/usr/lib/x86_64-linux-gnu/liblxi.so ../../lib/scopeprotocols/libscopeprotocols.so 

liblxi has been installed with a simply apt install liblxi-dev, and example programs outside of scopehal compile just fine.

I'm very new at cmake obviously. Any pointer on how to unblock this?

Tom

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions