Bug 200969 - devel/cmake: missing library /usr/local/lib/libjsoncpp.so
Summary: devel/cmake: missing library /usr/local/lib/libjsoncpp.so
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-kde (Team)
URL:
Keywords:
Depends on: 201057
Blocks:
  Show dependency treegraph
 
Reported: 2015-06-19 11:52 UTC by pvoigt
Modified: 2015-09-16 14:56 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pvoigt 2015-06-19 11:52:29 UTC
When building latest devel/cmake on 10.1-RELEASE-p13 (amd64)

# portmaster --no-confirm --no-term-title -D -G cmake

there is an error about missing library /usr/local/lib/libjsoncpp.so

...

===>  Installing for cmake-3.2.3
===>  Checking if cmake already installed
===>   Registering installation for cmake-3.2.3 as automatic  
(cmake-3.2.3) /usr/ports/devel/cmake/work/stage//usr/local/bin/ccmake -
required shared library /usr/local/lib/libjsoncpp.so not found
(cmake-3.2.3) /usr/ports/devel/cmake/work/stage//usr/local/bin/cmake -
required shared library /usr/local/lib/libjsoncpp.so not found
(cmake-3.2.3) /usr/ports/devel/cmake/work/stage//usr/local/bin/cpack -
required shared library /usr/local/lib/libjsoncpp.so not found
(cmake-3.2.3) /usr/ports/devel/cmake/work/stage//usr/local/bin/ctest -
required shared library /usr/local/lib/libjsoncpp.so not found
Installing cmake-3.2.3...

===>>> Re-installation of cmake-3.2.3 succeeded  

===>>> The following actions were performed:  
        Re-installation of cmake-modules-3.2.3
        Re-installation of cmake-3.2.3

However:

# ls -l /usr/local/lib/libjsoncpp*
-rw-r--r-- 1 root wheel 535316 Jun 17 20:22 /usr/local/lib/libjsoncpp.a
lrwxr-xr-x 1 root wheel     15 Jun 17
20:22 /usr/local/lib/libjsoncpp.so -> libjsoncpp.so.0 -r--r--r-- 1 root
wheel 348376 Jun 17 20:22 /usr/local/lib/libjsoncpp.so.0

Build finished just fine but during installation registration of shared
libraries failed. This can be verified with pkg:

# pkg check -Bnv cmake                                           
[1/1] Checking cmake-3.2.3: shared
libraries...(cmake-3.2.3) /usr/local/bin/ccmake - required shared
library /usr/local/lib/libjsoncpp.so not found
(cmake-3.2.3) /usr/local/bin/cmake - required shared
library /usr/local/lib/libjsoncpp.so not found
(cmake-3.2.3) /usr/local/bin/cpack - required shared
library /usr/local/lib/libjsoncpp.so not found
(cmake-3.2.3) /usr/local/bin/ctest - required shared
library /usr/local/lib/libjsoncpp.so not found done

Build process obviosuly finishes just fine but installation has problem to register/find the above library. To exclude any portmaster issue I have tested with plain make; make install:

# make install  
===>  Installing for cmake-3.2.3
===>   cmake-3.2.3 depends on file: /usr/local/share/cmake/Modules/CMake.cmake - found
===>   cmake-3.2.3 depends on shared library: libcurl.so - found (/usr/local/lib/libcurl.so)
===>   cmake-3.2.3 depends on shared library: libexpat.so - found (/usr/local/lib/libexpat.so)
===>   cmake-3.2.3 depends on shared library: libjsoncpp.so - found (/usr/local/lib/libjsoncpp.so)
===>  Checking if cmake already installed
===>   Registering installation for cmake-3.2.3
(cmake-3.2.3) /usr/ports/devel/cmake/work/stage//usr/local/bin/ccmake - required shared library /usr/local/lib/libjsoncpp.so not found
(cmake-3.2.3) /usr/ports/devel/cmake/work/stage//usr/local/bin/cmake - required shared library /usr/local/lib/libjsoncpp.so not found
(cmake-3.2.3) /usr/ports/devel/cmake/work/stage//usr/local/bin/cpack - required shared library /usr/local/lib/libjsoncpp.so not found
(cmake-3.2.3) /usr/ports/devel/cmake/work/stage//usr/local/bin/ctest - required shared library /usr/local/lib/libjsoncpp.so not found
Installing cmake-3.2.3...

Issue is diskussed on the list as well:
https://www.mail-archive.com/freebsd-ports@freebsd.org/msg65254.html

Peter
Comment 1 Raphael Kubo da Costa freebsd_committer 2015-06-22 21:20:40 UTC
The problem is in devel/jsoncpp. Its (deprecated) SCons build system does not generate versioned shared libraries, so libjsoncpp.so does not have a proper SONAME ELF header. Consequently, binaries linking against it get confused with what to mention as a dependency in their own ELF headers.
Comment 2 Raphael Kubo da Costa freebsd_committer 2015-06-22 21:45:30 UTC
I've filed bug 201057 to fix devel/jsoncpp.
Comment 3 AsciiWolf 2015-06-25 18:38:24 UTC
Same issue when using pkg2ng.

# pkg2ng
Converting packages from /var/db/pkg
Analysing shared libraries, this will take a while... 
Checking all packages:   2%
(cmake-3.2.3) /usr/local/bin/ccmake - required shared library /usr/local/lib/libjsoncpp.so not found
(cmake-3.2.3) /usr/local/bin/cmake - required shared library /usr/local/lib/libjsoncpp.so not found
(cmake-3.2.3) /usr/local/bin/cpack - required shared library /usr/local/lib/libjsoncpp.so not found
(cmake-3.2.3) /usr/local/bin/ctest - required shared library /usr/local/lib/libjsoncpp.so not found
Checking all packages: 100%
Comment 4 commit-hook freebsd_committer 2015-06-30 21:43:46 UTC
A commit references this bug:

Author: rakuco
Date: Tue Jun 30 21:43:06 UTC 2015
New revision: 391009
URL: https://svnweb.freebsd.org/changeset/ports/391009

Log:
  Properly version libjsoncpp.so.

  Fix the problem described in bug 200969: currently, libjsoncpp.so is not
  properly versioned by SCons; in other words, there's no SONAME in the
  library's ELF header, which confuses the linker when creating binaries that
  link against it.

  Solve it by using InstallVersionedLib(), available since SCons 2.3.0: this
  call is able to properly version the shared library the way we need it.
  Since there is no support for actually installing the files outside the
  build directory, we have to recreate the required symlinks ourselves in the
  Makefile. Another related change is that we now create the libraries with
  the proper names instead of doing that in the Makefile.

  I'm (ab)using the maintainer's approval given to bug 200939, as swills's
  latest patch includes this change as well.

  PR:		200969
  PR:		201057
  Approved by:	johan@stromnet.se (maintainer)

Changes:
  head/devel/jsoncpp/Makefile
  head/devel/jsoncpp/files/patch-SConstruct
  head/devel/jsoncpp/files/patch-src_lib__json_sconscript
  head/devel/jsoncpp/pkg-plist
Comment 5 commit-hook freebsd_committer 2015-06-30 21:49:52 UTC
A commit references this bug:

Author: rakuco
Date: Tue Jun 30 21:49:30 UTC 2015
New revision: 391011
URL: https://svnweb.freebsd.org/changeset/ports/391011

Log:
  Bump PORTREVISION in cmake and cmake-gui after r391009.

  Make sure the generated binaries have the right entry for libjsoncpp.so in
  the ELF headers.

  PR:		200969

Changes:
  head/devel/cmake/Makefile
  head/devel/cmake-gui/Makefile
Comment 6 Raphael Kubo da Costa freebsd_committer 2015-06-30 21:51:01 UTC
Everything should be fine after the two commits above, so closing.
Comment 7 pvoigt 2015-06-30 22:31:37 UTC
I have just checked: jsoncpp-0.6.0.r2_2 fixes the issue.
Comment 8 Chris Collins 2015-08-30 19:20:35 UTC
Isnt fixed, the build still fails on gcc48 from ports.

In file included from /usr/ports/devel/cmake/work/cmake-3.2.3/Source/cmGlobalNinjaGenerator.cxx:14:0:
/usr/ports/devel/cmake/work/cmake-3.2.3/Source/cmGeneratorExpressionEvaluationFile.h:39:64: error: 'mode_t' has not been declared
               std::map<std::string, std::string> &outputFiles, mode_t perm);
                                                                ^
*** [cmGlobalNinjaGenerator.o] Error code 1
1 error
---------------------------------------------
Error when bootstrapping CMake:
Problem while running make
---------------------------------------------
Log of errors: /usr/ports/devel/cmake/work/cmake-3.2.3/Bootstrap.cmk/cmake_bootstrap.log

builds using gcc 4.2.1 which of course is a very old gcc that is removed from FreeBSD 10+.
Comment 9 Raphael Kubo da Costa freebsd_committer 2015-08-30 19:45:17 UTC
The error you have reported is completely unrelated to the jsoncpp issue. I've backported a fix for it in r395637.
Comment 10 Chris Collins 2015-09-12 21:34:08 UTC
is the fix in the ports tree yet? as it still fails.
Comment 11 Chris Collins 2015-09-12 21:40:31 UTC
seems a different issue now, the port has turned into a big mess lately, it used to be fine.  Please let me know if more info is required.

[  2%] Building C object Source/kwsys/CMakeFiles/cmsys_c.dir/MD5.c.o
[  3%] Building C object Source/kwsys/CMakeFiles/cmsys.dir/ProcessUNIX.c.o
In file included from /usr/include/_ctype.h:94:0,
                 from /usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd9.3/4.8.5/include-fixed/wchar.h:76,
                 from /usr/ports/devel/cmake/work/cmake-3.3.1/Source/cmsys/Encoding.h:16,
                 from /usr/ports/devel/cmake/work/cmake-3.3.1/Source/kwsys/EncodingC.c:13:
/usr/include/runetype.h:92:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'const'
 extern _Thread_local const _RuneLocale *_ThreadRuneLocale;
                      ^
/usr/include/runetype.h: In function '__getCurrentRuneLocale':
/usr/include/runetype.h:96:6: error: '_ThreadRuneLocale' undeclared (first use in this function)
  if (_ThreadRuneLocale) 
      ^
/usr/include/runetype.h:96:6: note: each undeclared identifier is reported only once for each function it appears in
*** [Source/kwsys/CMakeFiles/cmsys_c.dir/EncodingC.c.o] Error code 1
[  3%] Building C object Source/kwsys/CMakeFiles/cmsys.dir/Base64.c.o
[  4%] Building C object Source/kwsys/CMakeFiles/cmsys.dir/EncodingC.c.o
In file included from /usr/include/_ctype.h:94:0,
                 from /usr/include/ctype.h:46,
                 from /usr/ports/devel/cmake/work/cmake-3.3.1/Source/kwsys/ProcessUNIX.c:70:
/usr/include/runetype.h:92:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'const'
 extern _Thread_local const _RuneLocale *_ThreadRuneLocale;
                      ^
/usr/include/runetype.h: In function '__getCurrentRuneLocale':
/usr/include/runetype.h:96:6: error: '_ThreadRuneLocale' undeclared (first use in this function)
  if (_ThreadRuneLocale) 
      ^
/usr/include/runetype.h:96:6: note: each undeclared identifier is reported only once for each function it appears in
*** [Source/kwsys/CMakeFiles/cmsys_c.dir/ProcessUNIX.c.o] Error code 1
[  4%] Building C object Source/kwsys/CMakeFiles/cmsys.dir/MD5.c.o
In file included from /usr/include/_ctype.h:94:0,
                 from /usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd9.3/4.8.5/include-fixed/wchar.h:76,
                 from /usr/ports/devel/cmake/work/cmake-3.3.1/Source/cmsys/Encoding.h:16,
                 from /usr/ports/devel/cmake/work/cmake-3.3.1/Source/kwsys/EncodingC.c:13:
/usr/include/runetype.h:92:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'const'
 extern _Thread_local const _RuneLocale *_ThreadRuneLocale;
                      ^
/usr/include/runetype.h: In function '__getCurrentRuneLocale':
/usr/include/runetype.h:96:6: error: '_ThreadRuneLocale' undeclared (first use in this function)
  if (_ThreadRuneLocale) 
      ^
/usr/include/runetype.h:96:6: note: each undeclared identifier is reported only once for each function it appears in
*** [Source/kwsys/CMakeFiles/cmsys.dir/EncodingC.c.o] Error code 1
In file included from /usr/include/_ctype.h:94:0,
                 from /usr/include/ctype.h:46,
                 from /usr/ports/devel/cmake/work/cmake-3.3.1/Source/kwsys/ProcessUNIX.c:70:
/usr/include/runetype.h:92:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'const'
 extern _Thread_local const _RuneLocale *_ThreadRuneLocale;
                      ^
/usr/include/runetype.h: In function '__getCurrentRuneLocale':
/usr/include/runetype.h:96:6: error: '_ThreadRuneLocale' undeclared (first use in this function)
  if (_ThreadRuneLocale) 
      ^
/usr/include/runetype.h:96:6: note: each undeclared identifier is reported only once for each function it appears in
*** [Source/kwsys/CMakeFiles/cmsys.dir/ProcessUNIX.c.o] Error code 1
2 errors
*** [Source/kwsys/CMakeFiles/cmsys_c.dir/all] Error code 2
2 errors
*** [Source/kwsys/CMakeFiles/cmsys.dir/all] Error code 2
2 errors
*** [all] Error code 2
1 error
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** [do-build] Error code 1

Stop in /usr/ports/devel/cmake.
*** [stage] Error code 1

Stop in /usr/ports/devel/cmake.
Comment 12 Raphael Kubo da Costa freebsd_committer 2015-09-12 22:22:47 UTC
(In reply to chrysalis from comment #11)
> seems a different issue now, the port has turned into a big mess lately, it
> used to be fine.  Please let me know if more info is required.

Can you please submit a new PR? It doesn't seem to be related to jsoncpp, and it's about a different CMake version, so it's better to track it separately.
Comment 13 Chris Collins 2015-09-13 01:24:09 UTC
yeah no worries, it does compile on gcc49 tho, I tried 49 as I found a web page with the exact same problem on a different port and that solution was to use 4.9 also.

So it might be easier to maybe just add a warning ti is broken on gcc48.

I will do the new PR later.
Comment 14 Raphael Kubo da Costa freebsd_committer 2015-09-16 14:56:59 UTC
gcc48 issue fixed in https://svnweb.freebsd.org/ports?view=revision&revision=397068