open-source-parsers / jsoncpp

A C++ library for interacting with JSON.
Other
8.09k stars 2.63k forks source link

1.9.0: does not build #970

Closed kloczek closed 5 years ago

kloczek commented 5 years ago
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.n1j8PX
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ cd jsoncpp-1.9.0
+ export 'CFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto'
+ CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto'
+ export 'CXXFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto'
+ CXXFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto'
+ export 'FFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules -flto'
+ FFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules -flto'
+ export 'FCFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules -flto'
+ FCFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules -flto'
+ export 'LDFLAGS=-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto -fuse-linker-plugin'
+ LDFLAGS='-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto -fuse-linker-plugin'
+ export AR=gcc-ar RANLIB=gcc-ranlib NM=gcc-nm
+ AR=gcc-ar
+ RANLIB=gcc-ranlib
+ NM=gcc-nm
+ export CC=gcc CXX=g++
+ CC=gcc
+ CXX=g++
+ /usr/bin/cmake -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_AR=/usr/bin/gcc-ar -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_NM=/usr/bin/gcc-nm -DCMAKE_RANLIB=/usr/bin/gcc-ranlib -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DLIB_SUFFIX=64 -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DSYSCONF_INSTALL_DIR:PATH=/etc . -DBUILD_STATIC_LIBS=OFF -DJSONCPP_WITH_WARNING_AS_ERROR=OFF -DJSONCPP_WITH_PKGCONFIG_SUPPORT=ON -DJSONCPP_WITH_CMAKE_PACKAGE=ON -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF -DPYTHON_EXECUTABLE=/usr/bin/python3
-- The CXX compiler identification is GNU 9.1.1
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- JsonCpp Version: 1.9.0
-- Looking for C++ include clocale
-- Looking for C++ include clocale - found
-- Looking for localeconv
-- Looking for localeconv - found
-- Looking for C++ include sys/types.h
-- Looking for C++ include sys/types.h - found
-- Looking for C++ include stdint.h
-- Looking for C++ include stdint.h - found
-- Looking for C++ include stddef.h
-- Looking for C++ include stddef.h - found
-- Check size of lconv
-- Check size of lconv - done
-- Performing Test HAVE_DECIMAL_POINT
-- Performing Test HAVE_DECIMAL_POINT - Success
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.7.4", minimum required is "2.6") 
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_STATIC_LIBS
    CMAKE_C_FLAGS_RELEASE
    CMAKE_Fortran_FLAGS_RELEASE
    INCLUDE_INSTALL_DIR
    LIB_INSTALL_DIR
    LIB_SUFFIX
    SHARE_INSTALL_PREFIX
    SYSCONF_INSTALL_DIR

-- Build files have been written to: /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0
+ /usr/bin/make -O -j48 V=1 VERBOSE=1
/usr/bin/cmake -S/home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0 -B/home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0 --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/CMakeFiles /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/CMakeFiles/progress.marks
/usr/bin/make -f CMakeFiles/Makefile2 all
/usr/bin/make -f src/lib_json/CMakeFiles/jsoncpp_lib.dir/build.make src/lib_json/CMakeFiles/jsoncpp_lib.dir/depend
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0'
cd /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0 && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0 /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0 /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/CMakeFiles/jsoncpp_lib.dir/DependInfo.cmake --color=
Dependee "/home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/CMakeFiles/jsoncpp_lib.dir/DependInfo.cmake" is newer than depender "/home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/CMakeFiles/jsoncpp_lib.dir/depend.internal".
Dependee "/home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/CMakeFiles/jsoncpp_lib.dir/depend.internal".
Scanning dependencies of target jsoncpp_lib
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0'
/usr/bin/make -f src/lib_json/CMakeFiles/jsoncpp_lib.dir/build.make src/lib_json/CMakeFiles/jsoncpp_lib.dir/build
In file included from /usr/include/c++/9/x86_64-redhat-linux/bits/c++config.h:2594,
                 from /usr/include/c++/9/cstddef:49,
                 from /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/../../include/json/config.h:8,
                 from /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/json_tool.h:10,
                 from /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/json_writer.cpp:7:
/usr/include/c++/9/x86_64-redhat-linux/bits/os_defines.h:44:19: error: missing binary operator before token "("
   44 | #if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE)
      |                   ^
In file included from /usr/lib/gcc/x86_64-redhat-linux/9/include/stdint.h:9,
                 from /usr/include/c++/9/cstdint:41,
                 from /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/../../include/json/config.h:9,
                 from /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/json_tool.h:10,
                 from /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/json_writer.cpp:7:
/usr/include/stdint.h:276:17: error: missing binary operator before token "("
  276 | #if __GLIBC_USE (IEC_60559_BFP_EXT)
      |                 ^
In file included from /usr/include/wchar.h:30,
                 from /usr/include/c++/9/cwchar:44,
                 from /usr/include/c++/9/bits/postypes.h:40,
                 from /usr/include/c++/9/iosfwd:40,
                 from /usr/include/c++/9/ios:38,
                 from /usr/include/c++/9/istream:38,
                 from /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/../../include/json/config.h:10,
                 from /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/json_tool.h:10,
                 from /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/json_writer.cpp:7:
/usr/include/bits/floatn.h:30:22: error: missing binary operator before token "("
   30 |      ? __GNUC_PREREQ (4, 3)      \
      |                      ^
In file included from /usr/include/bits/floatn.h:119,
                 from /usr/include/wchar.h:30,
                 from /usr/include/c++/9/cwchar:44,
                 from /usr/include/c++/9/bits/postypes.h:40,
                 from /usr/include/c++/9/iosfwd:40,
                 from /usr/include/c++/9/ios:38,
                 from /usr/include/c++/9/istream:38,
                 from /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/../../include/json/config.h:10,
                 from /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/json_tool.h:10,
                 from /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0/src/lib_json/json_writer.cpp:7:
/usr/include/bits/floatn-common.h:69:19: error: missing binary operator before token "("
   69 | #if __GNUC_PREREQ (7, 0) && !defined __cplusplus
      |                   ^
/usr/include/bits/floatn-common.h:90:22: error: missing binary operator before token "("
   90 | #  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
      |                      ^
/usr/include/bits/floatn-common.h:98:22: error: missing binary operator before token "("
   98 | #  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
      |                      ^
/usr/include/bits/floatn-common.h:110:22: error: missing binary operator before token "("
  110 | #  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
      |                      ^
/usr/include/bits/floatn-common.h:118:22: error: missing binary operator before token "("
  118 | #  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
      |                      ^
/usr/include/bits/floatn-common.h:148:22: error: missing binary operator before token "("
  148 | #  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
      |                      ^
/usr/include/bits/floatn-common.h:156:22: error: missing binary operator before token "("
  156 | #  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
baylesj commented 5 years ago

Thanks for opening this issue. Looks like an issue with CMake, this tag builds fine with our preferred build system (Meson).

I'll try to resolve this.

baylesj commented 5 years ago

CMake build on my system works fine:

-> % cmake -S . -B build-cmake 
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- JsonCpp Version: 1.9.0
-- Looking for C++ include clocale
-- Looking for C++ include clocale - found
-- Looking for localeconv
-- Looking for localeconv - found
-- Looking for C++ include sys/types.h
-- Looking for C++ include sys/types.h - found
-- Looking for C++ include stdint.h
-- Looking for C++ include stdint.h - found
-- Looking for C++ include stddef.h
-- Looking for C++ include stddef.h - found
-- Check size of lconv
-- Check size of lconv - done
-- Performing Test HAVE_DECIMAL_POINT
-- Performing Test HAVE_DECIMAL_POINT - Success
-- Found PythonInterp: /usr/local/bin/python2 (found suitable version "2.7.15", minimum required is "2.6") 
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/src/jsoncpp/build-cmake

-> % make
Scanning dependencies of target jsoncpp_lib
[ 10%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib.dir/json_reader.cpp.o
[ 20%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib.dir/json_value.cpp.o
[ 30%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib.dir/json_writer.cpp.o
[ 40%] Linking CXX static library libjsoncpp.a
[ 40%] Built target jsoncpp_lib
Scanning dependencies of target jsontestrunner_exe
[ 50%] Building CXX object src/jsontestrunner/CMakeFiles/jsontestrunner_exe.dir/main.cpp.o
[ 60%] Linking CXX executable jsontestrunner_exe
[ 60%] Built target jsontestrunner_exe
Scanning dependencies of target jsoncpp_test
[ 70%] Building CXX object src/test_lib_json/CMakeFiles/jsoncpp_test.dir/jsontest.cpp.o
[ 80%] Building CXX object src/test_lib_json/CMakeFiles/jsoncpp_test.dir/fuzz.cpp.o
[ 90%] Building CXX object src/test_lib_json/CMakeFiles/jsoncpp_test.dir/main.cpp.o
[100%] Linking CXX executable jsoncpp_test
Testing ValueTest/checkNormalizeFloatingPointStr: OK
Testing ValueTest/memberCount: OK
Testing ValueTest/objects: OK
Testing ValueTest/arrays: OK
Testing ValueTest/arrayIssue252: OK
Testing ValueTest/null: OK
Testing ValueTest/strings: OK
Testing ValueTest/bools: OK
Testing ValueTest/integers: OK
Testing ValueTest/nonIntegers: OK
Testing ValueTest/compareNull: OK
Testing ValueTest/compareInt: OK
Testing ValueTest/compareUInt: OK
Testing ValueTest/compareDouble: OK
Testing ValueTest/compareString: OK
Testing ValueTest/compareBoolean: OK
Testing ValueTest/compareArray: OK
Testing ValueTest/compareObject: OK
Testing ValueTest/compareType: OK
Testing ValueTest/CopyObject: OK
Testing ValueTest/offsetAccessors: OK
Testing ValueTest/typeChecksThrowExceptions: OK
Testing ValueTest/StaticString: OK
Testing ValueTest/WideString: OK
Testing ValueTest/CommentBefore: OK
Testing ValueTest/zeroes: OK
Testing ValueTest/zeroesInKeys: OK
Testing ValueTest/specialFloats: OK
Testing ValueTest/precision: OK
Testing WriterTest/dropNullPlaceholders: OK
Testing StreamWriterTest/dropNullPlaceholders: OK
Testing StreamWriterTest/writeZeroes: OK
Testing ReaderTest/parseWithNoErrors: OK
Testing ReaderTest/parseWithNoErrorsTestingOffsets: OK
Testing ReaderTest/parseWithOneError: OK
Testing ReaderTest/parseChineseWithOneError: OK
Testing ReaderTest/parseWithDetailError: OK
Testing CharReaderTest/parseWithNoErrors: OK
Testing CharReaderTest/parseWithNoErrorsTestingOffsets: OK
Testing CharReaderTest/parseWithOneError: OK
Testing CharReaderTest/parseChineseWithOneError: OK
Testing CharReaderTest/parseWithDetailError: OK
Testing CharReaderTest/parseWithStackLimit: OK
Testing CharReaderStrictModeTest/dupKeys: OK
Testing CharReaderFailIfExtraTest/issue164: OK
Testing CharReaderFailIfExtraTest/issue107: OK
Testing CharReaderFailIfExtraTest/commentAfterObject: OK
Testing CharReaderFailIfExtraTest/commentAfterArray: OK
Testing CharReaderFailIfExtraTest/commentAfterBool: OK
Testing CharReaderAllowDropNullTest/issue178: OK
Testing CharReaderAllowSingleQuotesTest/issue182: OK
Testing CharReaderAllowZeroesTest/issue176: OK
Testing CharReaderAllowSpecialFloatsTest/issue209: OK
Testing BuilderTest/settings: OK
Testing IteratorTest/distance: OK
Testing IteratorTest/names: OK
Testing IteratorTest/indexes: OK
Testing IteratorTest/const: OK
Testing RValueTest/moveConstruction: OK
Testing FuzzTest/fuzzDoesntCrash: OK
All 60 tests passed
[100%] Built target jsoncpp_test
baylesj commented 5 years ago

__GLIBC_PREREQ isn't used inside of our repository, it's part of C++11 features like iostream. It looks like you are using a modern compiler, so I'm not sure what the issue here is...

kloczek commented 5 years ago

Just FTR:

$ rpm -q gcc-c++ glibc
gcc-c++-9.1.1-2.fc31.x86_64
glibc-2.29.9000-30.fc31.x86_64

And yes looks like build using meson works.

baylesj commented 5 years ago

Hmmm. This seems like it could affect a lot of users, but I wasn't able to repro it on my linux or mac machines with gcc + CMake.

Our official policy has been only supporting the meson build, and having users submit fixes for the CMake build. If you can root cause and submit a fix, I would be happy to review it promptly.

kloczek commented 5 years ago

I've already switched to meson so problem has been sorted out .. somehow :P Feel free to close this issue ticket. Thx.

DarkKnightVN commented 5 years ago

Thanks for opening this issue. Looks like an issue with CMake, this tag builds fine with our preferred build system (Meson).

I'll try to resolve this.

Could you try to build shared lib, not static lib? On my system, static -> fine but building shared lib was failed.

kloczek commented 5 years ago

Hmm if meson is workin I'll try it and if it will be OK I'll no longer care about cmake :)

teddybouch commented 5 years ago

I'm having this issue building with cmake as well. I've not used Meson before, but I can give it a try. Just wanted to contribute to the thread to note that it's affecting others.

techwoes commented 5 years ago

File name collision between ..../include/json/features.h and (maybe?) /usr/include/features.h causes this I believe. I renamed json/features.h to features2.h and updated references to it. I'll leave up to the developers for the real solution, but those changes allow it to build with cmake. It will take someone more knowledgeable than me with CMAKE to fix it though. This is on Ubuntu 18.04.

dota17 commented 5 years ago

-- Build files have been written to: /home/tkloczko/rpmbuild/BUILD/jsoncpp-1.9.0

Hi @kloczek,From your log, I'm sure you are building this project in the top source code, that's the problem, you should make a new directory in the source code, then make your project-build in it.

kloczek commented 5 years ago
$ rpm -qf  /usr/include/features.h
glibc-headers-2.30-1.fc31.x86_64

Yep looks like /usr/include/features.h is now part of the new glibc. I would suggest to rename that file to jsoncpp-features.h or features-jsoncpp.h instead features2.h.

baylesj commented 5 years ago

Can one of y'all try building with my latest patch?

https://github.com/open-source-parsers/jsoncpp/pull/1024

baylesj commented 5 years ago

Fixed #1024