Skip to content
This repository has been archived by the owner on Oct 27, 2020. It is now read-only.

Build fails to link. #13

Closed
markrages opened this issue Jun 2, 2020 · 11 comments
Closed

Build fails to link. #13

markrages opened this issue Jun 2, 2020 · 11 comments

Comments

@markrages
Copy link

Following instructions in README, applying workaround from #12 .

[ 94%] Linking CXX executable glscopeclient
../../lib/scopehal/libscopehal.so: undefined reference to `lxi_init()'
../../lib/scopehal/libscopehal.so: undefined reference to `lxi_connect(char*, int, char*, int, lxi_protocol_t)'
../../lib/scopehal/libscopehal.so: undefined reference to `lxi_receive(int, char*, int, int)'
../../lib/scopehal/libscopehal.so: undefined reference to `lxi_send(int, char*, int, int)'
collect2: error: ld returned 1 exit status

These functions don't seem to be defined, only used.

markrages@qountdown:~/src/scopehal-cmake$ grep -r lxi_connect
lib/scopehal/SCPILxiTransport.cpp:	m_device = lxi_connect(m_hostname.c_str(), m_port, "inst0", m_timeout, VXI11);
Binary file build/lib/scopehal/libscopehal.so matches
Binary file build/lib/scopehal/CMakeFiles/scopehal.dir/SCPILxiTransport.cpp.o matches
@azonenberg
Copy link
Owner

Those are liblxi functions so it's related to linking of liblxi.

@markrages
Copy link
Author

markrages@qountdown:~/src/scopehal-cmake/build$ apt search liblxi
Sorting... Done
Full Text Search... Done
liblxi-dev/bionic,now 1.8-1 amd64 [installed]
  LAN eXtensions for Instrumentation (LXI) software interface

liblxi1/bionic,now 1.8-1 amd64 [installed,automatic]
  LAN eXtensions for Instrumentation (LXI) software interface

Sorry, something went wrong.

@markrages
Copy link
Author

markrages@qountdown:~$ nm -gD /usr/lib/x86_64-linux-gnu/liblxi.so | grep lxi_
0000000000001860 T lxi_connect
0000000000001a00 T lxi_disconnect
0000000000001b00 T lxi_discover
0000000000001830 T lxi_init
0000000000001ac0 T lxi_receive
0000000000001a80 T lxi_send

but the linker can't see it?

Sorry, something went wrong.

@azonenberg
Copy link
Owner

azonenberg commented Jun 2, 2020

We've had at least one other user with this same issue, also on 18.04. The LXI code is pretty new (past week or two) and this didn't show up during initial testing on more recent systems. We're still working to identify a root cause and proper fix.

Can you try removing liblxi from the distro package and installing liblxi 1.13 or newer from https://github.com/lxi-tools/liblxi?

@markrages
Copy link
Author

Will try rebooting like Windows 98, as suggested by ngscopeclient/scopehal#115

ldconfig didn't help.

@markrages
Copy link
Author

Replacing the system liblxi with git pull of liblxi works, for reasons I don't understand.

@azonenberg
Copy link
Owner

We've had numerous issues with 18.04's packaged build of liblxi. There's already workarounds in the code (ngscopeclient/scopehal#131).

Glad your problem is solved. Leaving this issue open until we figure out a more final path forward. It's likely we will document liblxi 1.13 as the new minimum required version and add a note to the README saying that the packaged version on Ubuntu 18.04 is known to not work.

@markrages
Copy link
Author

Looks like liblxi v1.8 predates lxi-tools/liblxi@4c71f5c, which is the extern "C" wrapper for the header file.

So version 1.8 and earlier will not link properly with C++.

@markrages
Copy link
Author

For completeness:

I wrapped the #include <lxi.h> in scopehal.h with extern "C" { } and it compiled and linked against the system liblxi.

@azonenberg
Copy link
Owner

Can you make a clean pull of the latest HEAD using the system liblxi and confirm it builds properly?

@markrages
Copy link
Author

Yes, it builds and links without errors with system liblxi.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants