Hi Sébastien,
I believe I’ve seen a similar issue that is related to the version of the boost library that is downloaded for a static build (1_69_0).
I am unable to build OrthancServer on Ubuntu 22.04 with BUILD_STATIC=ON. The error is similar to the one above. I have no problem on Ubuntu 20.04, nor do I have a problem building on 22.04 with BUILD_STATIC=OFF. I’m currently building from the hg head (today 20220628), but I’ve seen this problem for at least a few weeks now.
For instance following the instructions for linux:
$ mkdir OrthancServer-build-static
$ cd OrthancServer-build-static
$ cmake -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=DEBUG ../OrthancServer/
$ make
produces:
[ 0%] Generating AUTOGENERATED/OrthancServerResources.h, AUTOGENERATED/OrthancServerResources.cpp
[ 0%] Generating AUTOGENERATED/OrthancFrameworkResources.h, AUTOGENERATED/OrthancFrameworkResources.cpp
[ 0%] Building CXX object CMakeFiles/CoreLibrary.dir/usr/local/src/orthanc/OrthancFramework/Sources/Cache/MemoryCache.cpp.o
[ 0%] Building CXX object CMakeFiles/CoreLibrary.dir/usr/local/src/orthanc/OrthancFramework/Sources/Cache/MemoryObjectCache.cpp.o
In file included from /usr/include/pthread.h:33,
from /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/11/bits/gthr.h:148,
from /usr/include/c++/11/ext/atomicity.h:35,
from /usr/include/c++/11/bits/basic_string.h:39,
from /usr/include/c++/11/string:55,
from /usr/local/src/orthanc/OrthancFramework/Sources/Cache/../OrthancFramework.h:72,
from /usr/local/src/orthanc/OrthancFramework/Sources/Cache/MemoryObjectCache.h:26,
from /usr/local/src/orthanc/OrthancFramework/Sources/Cache/MemoryObjectCache.cpp:25:
/usr/local/src/orthanc/OrthancServer-build-static/boost_1_69_0/boost/thread/pthread/thread_data.hpp:60:5: error: missing binary operator before token "("
60 | #if PTHREAD_STACK_MIN > 0
| ^~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/CoreLibrary.dir/build.make:116: CMakeFiles/CoreLibrary.dir/usr/local/src/orthanc/OrthancFramework/Sources/Cache/MemoryObjectCache.cpp.o] Error
make[1]: *** [CMakeFiles/Makefile2:104: CMakeFiles/CoreLibrary.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
It looks as if this may be a regression that was fixed in a subsequent release of boost, see eg: (https://github.com/boostorg/thread/pull/297).
I can also confirm that making that one line change in the boost library:
- #if PTHREAD_STACK_MIN > 0
+ #ifdef PTHREAD_STACK_MIN
is sufficient to allow most of the build to complete (in this case), but it eventually fails with the same error building ConnectivityChecks after downloading boost_1_69_0_bcpdigest-1.5.6.tar.gz. I’m afraid I haven’t had a chance yet to try the same patch there.
All the Best,
Ron Hartley-Davies
Medical Physics
University Hospitals Bristol and Weston