Hi all, I am new to FreeBSD even though I have been working in Unix environments for a long while (mainly Linux). I am struggling to build a library locally, using cmake - the library builds fine on a Linux machine as long as dependencies are satisfied. However in my case CMake gets all the dependencies correctly - namely it finds all libraries it needs - but it fails lo link them: ld: error: unable to find library -lnss3 ld: error: unable to find library -lsmime3 ld: error: unable to find library -lssl3 ld: error: unable to find library -lnssutil3 ld: error: unable to find library -lplds4 ld: error: unable to find library -lplc4 ld: error: unable to find library -lnspr4 ld: error: unable to find library -lopenjp2 ld: error: unable to find library -lnss3 ld: error: unable to find library -lsmime3 ld: error: unable to find library -lssl3 ld: error: unable to find library -lnssutil3 ld: error: unable to find library -lplds4 ld: error: unable to find library -lplc4 ld: error: unable to find library -lnspr4 ld: error: unable to find library -lopenjp2 Not a single one is found - I must be doing a silly mistake somewhere - I am wondering, is there any need from my side to tell CMake I am about to use not GNU Make ? I did not specify anything in my case - I only typed 'cmake ..' Thanks, Pietro
You might need to pass the library path on the environment or specify it somewhere in CMakeLists.txt. Something like: $ LIBDIR=/usr/local/lib cmake You'll have to check the exact syntax though.? I have had similar issues trying to link LZMA in Dovecot on FreeBSD and specifying the library path resolves it. Cheers, -Brian On 4/27/2020 9:07 AM, Pietro Paolini wrote:> Hi all, > > I am new to FreeBSD even though I have been working in Unix > environments for a long while (mainly Linux). I am struggling to build > a library locally, using cmake - the library builds fine on a Linux > machine as long as dependencies are satisfied. However in my case > CMake gets all the dependencies correctly - namely it finds all > libraries it needs - but it fails lo link them: > > ld: error: unable to find library -lnss3 > ld: error: unable to find library -lsmime3 > ld: error: unable to find library -lssl3 > ld: error: unable to find library -lnssutil3 > ld: error: unable to find library -lplds4 > ld: error: unable to find library -lplc4 > ld: error: unable to find library -lnspr4 > ld: error: unable to find library -lopenjp2 > ld: error: unable to find library -lnss3 > ld: error: unable to find library -lsmime3 > ld: error: unable to find library -lssl3 > ld: error: unable to find library -lnssutil3 > ld: error: unable to find library -lplds4 > ld: error: unable to find library -lplc4 > ld: error: unable to find library -lnspr4 > ld: error: unable to find library -lopenjp2 > > Not a single one is found - I must be doing a silly mistake somewhere > - I am wondering, is there any need from my side to tell CMake I am > about to use not GNU Make ? > > I did not specify anything in my case - I only typed 'cmake ..' > > Thanks, > Pietro > _______________________________________________ > freebsd-stable at freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to "freebsd-stable-unsubscribe at freebsd.org"
On 27/04/2020 17:07, Pietro Paolini wrote:> Hi all, > > I am new to FreeBSD even though I have been working in Unix > environments for a long while (mainly Linux). I am struggling to build > a library locally, using cmake - the library builds fine on a Linux > machine as long as dependencies are satisfied. However in my case > CMake gets all the dependencies correctly - namely it finds all > libraries it needs - but it fails lo link them:> Not a single one is found - I must be doing a silly mistake somewhere > - I am wondering, is there any need from my side to tell CMake I am > about to use not GNU Make ? >Have you told CMake you depend on those libraries? They aren't installed by default on FreeBSD. If you have declared them as dependencies then CMake should automatically add the correct include and library paths to the compiler commands lines for you. My guess is that the cmake file is just assuming they are all in /usr/lib and the includes are in /usr/include which would be true on Linux. For external dependencies in cmake you should have: find_package(packagename REQUIRED) for each library (or library package) in the library CMakeLists.txt. If they are not there then you need to fix the cmakelists.txt until all the libraries you depend on have a find_package line (unless multiple libraries are part of the bundle). At this point cmake will sort out the compiler command lines for you. And will still work on linux.> Thanks, > Pietro > _______________________________________________ > freebsd-stable at freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to "freebsd-stable-unsubscribe at freebsd.org" >