0

Apologies if this has already been answered; I am having trouble finding an existing post (either on SE or linux forums) which solves the issue.

I need to install the package(s) that enables the -lSM and -lICE linker options for compiling some C/C++ code that uses plotting libraries (see here for an example: C Compiling and Linking).

Here's a snippet of the error messages I'm getting:

/usr/bin/ld: cannot find -lSM
/usr/bin/ld: cannot find -lICE
collect2: error: ld returned 1 exit status

I am quite certain that the issue is the package simply not being installed. What is the name of the package? I am running on CentOS7/Redhat.

1

You are looking for libSM.so and libICE.so, provided by the libSM-devel and libICE-devel packages.

Basically, if you are linking with -l<something>, look in /usr/lib64/lib<something>.so. An even faster result is to skip the step of finding the package name and run:

 yum install  /usr/lib64/lib<something>.so
4
  • Thanks! Is there some methodology to finding what package a particular option is contained in? For some, I can now see that it's relatively straightforward (e.g., "l" -> "library" so lSM -> libSM), but for others I don't see a pattern (e.g., libXm is in motif). Should I just use the "whatprovides" option to figure them out? – asdf Jul 14 '20 at 19:29
  • As I said in the answer, you can skip the ‘yum what provided ...’ and just directly use ‘yum install /path/to/library’. And the -l in the link command is to link against a library, so it’s not ‘lSM’ but ‘-l’ + ‘SM’. – jsbillings Jul 15 '20 at 0:54
  • Thanks for the clarification; I didn't realize that the '-l' prefix was to link against a library. But in that case, I don't see how I could figure out what package something lives in. For example, how would I know that "libXm" is in "motif" rather than "libX11"? – asdf Jul 15 '20 at 23:07
  • ‘yum provides /path/to/file’ will tell you. There’s no better place than to look in the RPM db. – jsbillings Jul 16 '20 at 0:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.