Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linker can't find -liconv or -lintl on FreeBSD #693

Open
PaddyMac opened this issue Nov 2, 2020 · 6 comments
Open

linker can't find -liconv or -lintl on FreeBSD #693

PaddyMac opened this issue Nov 2, 2020 · 6 comments

Comments

@PaddyMac
Copy link

PaddyMac commented Nov 2, 2020

I'm trying to build on FreeBSD 12.2-RELEASE. I did install all the dependencies, and the libraries are located in /usr/local/lib. But for some reason cmake must not be properly handling things because when trying to compile, I get output like this:

patrick@xps400:/usr/home/patrick/work/TSC/tsc/build $ make
[ 1%] Built target podparser
[ 2%] Built target scrdg
[ 2%] Built target scriptdocumentation
[ 6%] Built target mruby
[ 7%] Built target tinyclipboard
[ 8%] Linking CXX executable tsc
ld: error: unable to find library -liconv
ld: error: unable to find library -lintl
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

@xet7
Copy link
Member

xet7 commented Nov 2, 2020

@PaddyMac

So you did install iconv etc? Does FreeBSD find those libraries, or do they need to be added to path?

For example on Ubuntu, when I like to use commands and libraries from Snap package, I do this to get mongodump and it's libraries to path:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
export PATH="$PATH:/snap/wekan/current/bin"

Is there something similar for FreeBSD ?

@Quintus
Copy link
Member

Quintus commented Nov 2, 2020 via email

@PaddyMac
Copy link
Author

PaddyMac commented Nov 2, 2020

I tried "export LD_LIBRARY_PATH=/usr/local/lib" and then running make again. The value was added to the environment, but it had no effect. I also examined the ../TSC/tsc/build/CMakeCache.txt to see what I could find. Frankly it looks like it should work unless maybe these aren't relevant to what is being linked when it fails. I'm attaching CMakeCache.txt in case you find it helpful to examine it.
CMakeCache.txt

@PaddyMac
Copy link
Author

PaddyMac commented Nov 3, 2020

I enabled verbose mode and tried to build again. I see what the problem is, and I believe I know what needs to change to fix it, but I'm not familiar enough with cmake to know how to implement that fix.

The linker command line reveals that almost all of the libraries being linked are referred to by absolute pathnames (e.g. /usr/local/lib/libXext.so). Only four libraries are called with the -l flag: -lz, -lpthread, -liconv, and -lintl. The parameter -L/usr/local/lib is nowhere to be found on the command line. There's no error with -lz or -lpthread because they're in /lib or /usr/lib. -liconv and -lintl fail because they're in /usr/local/lib.

So this should easily be remedied by either 1) adding these libraries to the linker command line by an absolute path just like most of the other libraries, or 2) adding -L/usr/local/lib to the linker command line should work.
tsc_build_failure.txt

@Quintus
Copy link
Member

Quintus commented Nov 3, 2020 via email

@Quintus
Copy link
Member

Quintus commented Jan 14, 2021

This issue is actually low-hanging fruit for newcomers to the code. I'll properly tag it now and let's see what happens. It should be pretty easy to resolve.

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

No branches or pull requests

3 participants