CyberRadio / gr-cyberradio

MIT License
5 stars 4 forks source link

Build failure in libcyberradio #3

Closed jwmelto closed 3 years ago

jwmelto commented 4 years ago

Building libcyberradio on CentOS 7 (surprisingly, the minimum Boost for this component is 1.47... why the difference between components? see #2 )

Initially CMake failed with JsonCpp not found. So I built and installed it, using default settings. This installs the headers in /usr/local/include/json.

Apparently, the only place JsonCpp is used is in Driver/RadioTransport.cpp, where the header file is included as "jsoncpp/json/json.h" instead of "json/json.h", which is what an installed system would have. Compilation fails.

There are also a surprising number of compile warnings (predominantly -Wreturn-type) in the Driver directory.

crs-bs commented 3 years ago

so it looks like Ubuntu installs it to jsoncpp/json/json.h. I'll see if I could do a conditional pragma to help.

crs-bs commented 3 years ago

fresh Centos 7 Docker image:

[root@a47cb640eace /]# ls /usr/include/jsoncpp/json/
assertions.h  autolink.h  config.h  features.h  forwards.h  json.h  reader.h  value.h  version.h  writer.h
jwmelto commented 3 years ago

fresh Centos 7 Docker image with ...? JsonCPP isn't in the default image. yum install jsoncpp-devel (I think) puts the headers in /usr/include/json/json.h

I'm on the cusp of learning more about the CMake way of finding packages; maybe that's a better approach.

crs-bs commented 3 years ago

I made a docker image from centos:7, installed the EPEL, then installed libjsoncpp and that's where it put the headers.

crs-bs commented 3 years ago

` bsmith@computer-name$ docker run -it centos:7 /bin/bash [root@2bee2add3565 /]# yum -y install epel-release Loaded plugins: fastestmirror, ovl Determining fastest mirrors

Dependencies Resolved

===================================================================================================================================================================================================================================================================================================================================== Package Arch Version Repository Size

Installing: epel-release noarch 7-11 extras 15 k

Transaction Summary

Install 1 Package

Total download size: 15 k Installed size: 24 k Downloading packages: warning: /var/cache/yum/x86_64/7/extras/packages/epel-release-7-11.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Public key for epel-release-7-11.noarch.rpm is not installed epel-release-7-11.noarch.rpm | 15 kB 00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 Importing GPG key 0xF4A80EB5: Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) security@centos.org" Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5 Package : centos-release-7-9.2009.0.el7.centos.x86_64 (@CentOS) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : epel-release-7-11.noarch 1/1 Verifying : epel-release-7-11.noarch 1/1

Installed: epel-release.noarch 0:7-11

Complete! [root@2bee2add3565 /]# yum install -y jsoncpp-devel Loaded plugins: fastestmirror, ovl Loading mirror speeds from cached hostfile epel/x86_64/metalink | 9.1 kB 00:00:00

Dependencies Resolved

===================================================================================================================================================================================================================================================================================================================================== Package Arch Version Repository Size

Installing: jsoncpp-devel x86_64 0.10.5-2.el7 epel 25 k Installing for dependencies: jsoncpp x86_64 0.10.5-2.el7 epel 82 k

Transaction Summary

Install 1 Package (+1 Dependent package)

Total download size: 107 k Installed size: 301 k Downloading packages: warning: /var/cache/yum/x86_64/7/epel/packages/jsoncpp-0.10.5-2.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY Public key for jsoncpp-0.10.5-2.el7.x86_64.rpm is not installed (1/2): jsoncpp-0.10.5-2.el7.x86_64.rpm | 82 kB 00:00:00
(2/2): jsoncpp-devel-0.10.5-2.el7.x86_64.rpm | 25 kB 00:00:00

Total 712 kB/s | 107 kB 00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 Importing GPG key 0x352C64E5: Userid : "Fedora EPEL (7) epel@fedoraproject.org" Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5 Package : epel-release-7-11.noarch (@extras) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : jsoncpp-0.10.5-2.el7.x86_64 1/2 Installing : jsoncpp-devel-0.10.5-2.el7.x86_64 2/2 Verifying : jsoncpp-devel-0.10.5-2.el7.x86_64 1/2 Verifying : jsoncpp-0.10.5-2.el7.x86_64 2/2

Installed: jsoncpp-devel.x86_64 0:0.10.5-2.el7

Dependency Installed: jsoncpp.x86_64 0:0.10.5-2.el7

Complete! [root@2bee2add3565 /]# ls -lha /usr/include/jsoncpp/json/ total 94K drwxr-xr-x 2 root root 12 Jul 22 12:00 . drwxr-xr-x 3 root root 3 Jul 22 12:00 .. -rw-r--r-- 1 root root 2.2K Jul 23 2015 assertions.h -rw-r--r-- 1 root root 662 Jul 23 2015 autolink.h -rw-r--r-- 1 root root 3.8K Jul 23 2015 config.h -rw-r--r-- 1 root root 1.5K Jul 23 2015 features.h -rw-r--r-- 1 root root 758 Jul 23 2015 forwards.h -rw-r--r-- 1 root root 420 Jul 23 2015 json.h -rw-r--r-- 1 root root 12K Jul 23 2015 reader.h -rw-r--r-- 1 root root 26K Jul 23 2015 value.h -rw-r--r-- 1 root root 509 Jul 23 2015 version.h -rw-r--r-- 1 root root 11K Jul 23 2015 writer.h [root@2bee2add3565 /]# `

jwmelto commented 3 years ago

You are absolutely correct, I just reproduced it this morning. Unfortunately, the package in the EPEL is 0.10.5, which is a C++98 version (the numbering scheme is 0.x for pre-C++11 and 1.x for post-C++11). So I've been building from source from the beginning. I just forgot about it before now.

I don't know when they changed from installing in prefix/include/jsoncpp to prefix/include, but it is there now. Possibly a "namespace" thing that was abandoned?

We are building from branch 1.9.4; I expect HEAD is the same way.

jwmelto commented 3 years ago
RUN echo "Installing JsonCPP"                                   \
 && date                                                        \
 && export project=jsoncpp                                      \
 && (cd /tmp                                                    \
     ; git clone                                                \
           --quiet                                              \
           --config advice.detachedHead=false                   \
           --branch 1.9.4                                       \
#           --branch 94cda30dbddc1859f111848fdd05dfb85d3287c7
           https://github.com/open-source-parsers/jsoncpp.git   \
           $project                                             \
     ; cd $project                                              \
     ; git rev-parse HEAD                                       \
    ) && date                                                   \
 && echo "building..."                                          \
 && /usr/bin/scl enable devtoolset-8 -- sh -c '                 \
     cd /tmp/$project ; mkdir build ; cd build                  \
     ; export CXXFLAGS=-std=c++17                               \
     ; ${CMAKE}                                                 \
         ${CMAKE_FLAGS}                                         \
         ${cmake_INSTALL_FLAGS}                                 \
         -DBUILD_SHARED_LIBS=ON                                 \
         -S ..                                                  \
     ; make ${MAKEFLAGS} install                                \
     ; cd /tmp; rm -rf $project                                 \
     ' && date
crs-bs commented 3 years ago

Okay, so can you check /usr/lib/x86-64-linux-gnu/cmake/jsoncpp/jsoncppConfig.cmake....

see if there is a line like (ubuntu example here):

set_target_properties(jsoncpp_lib PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "/usr/include/jsoncpp"
)

looks like we may be able to get away with changing ours to json/json.h since their (jsoncpp's) config file add the include dir.

crs-bs commented 3 years ago

ha! looks like we can.

-I/usr/include/jsoncpp -std=c++11 -O3 - .....

jwmelto commented 3 years ago

FYI,

# rpm -ql jsoncpp-devel
/usr/include/jsoncpp
/usr/include/jsoncpp/json
/usr/include/jsoncpp/json/assertions.h
/usr/include/jsoncpp/json/autolink.h
/usr/include/jsoncpp/json/config.h
/usr/include/jsoncpp/json/features.h
/usr/include/jsoncpp/json/forwards.h
/usr/include/jsoncpp/json/json.h
/usr/include/jsoncpp/json/reader.h
/usr/include/jsoncpp/json/value.h
/usr/include/jsoncpp/json/version.h
/usr/include/jsoncpp/json/writer.h
/usr/lib64/cmake
/usr/lib64/cmake/jsoncpp
/usr/lib64/cmake/jsoncpp/jsoncppConfig-release.cmake
/usr/lib64/cmake/jsoncpp/jsoncppConfig.cmake
/usr/lib64/libjsoncpp.so
/usr/lib64/pkgconfig/jsoncpp.pc
/usr/share/doc/jsoncpp
/usr/share/doc/jsoncpp/NEWS.txt

Unfortunately, the CentOS RPM lacks the Ubuntu prescience:

/usr/lib64/cmake/jsoncpp/jsoncppConfig.cmake:  INTERFACE_INCLUDE_DIRECTORIES "/usr/include"
jwmelto commented 3 years ago

but I won't complain about your fix 😄 0.10 is an archaic version anyway.