Thursday, May 2, 2024
9
rated 0 times [  9] [ 0]  / answers: 1 / hits: 31061  / 3 Years ago, sun, october 31, 2021, 1:59:10

Trying to compile and use OpenFST on Ubuntu 13.10 leads to link errors like "undefined references to dlopen". How does one fix this? Searching online suggests including -ldl in the gcc command line, but that is not sufficient.


More From » dynamic-linking

 Answers
0

Compile as follows:



./configure LDFLAGS=-Wl,--no-as-needed
make
sudo make install


To compile your a.cpp which uses the library, do



g++ -I /usr/local/include a.cpp /usr/local/lib/libfst.so -Wl,--no-as-needed -ldl


It is important the -ldl appears after -Wl,--no-as-needed.



Running your program works as you'd expect from the README provided by OpenFST, you just need to have /usr/local/lib in your LD_LIBRARY_PATH. For example,



LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib" ./a.out

[#25710] Monday, November 1, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rofity

Total Points: 182
Total Questions: 98
Total Answers: 115

Location: Albania
Member since Sat, Jan 7, 2023
1 Year ago
;