problem installing webviewer plugin

I am trying to install webviewer plugin in orthanc and when compiling in the last make step it shows me this error: /OrthancDicomWeb-1.8/Build/boost/boost_1_69_0/thread/pthread/thread_data.hpp:60:5:error missing binary operatorbefore token “(” 60|#if PTHREAD_STACK_MIN > 0

What is your OS, and what is your compiler? If you expect help from other people, please provide full context:
https://book.orthanc-server.com/users/support.html#discussing-a-minimal-working-example

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

Dear Ron,

Many thanks for this investigation!

I’ll have a look into this when time (not before several weeks). Note that solving this issue is non-trivial, as Boost broke support for LSB (Linux Standard Base) compilers after their 1.69.0 release: An upgrade to recent versions of Boost (such as the current 1.79.0) will lead to severe backward compatibility issues.

A possible option might be to support two different versions of Boost, the latest and the “legacy” for LSB compiler. This is something that was already done for the ICU and JsonCpp third-party libraries.

Regards,
Sébastien-

Dear Ron,

I have just noticed that I have forgotten to update this thread.

The following changeset upgraded Boost to 1.80.0 inside Orthanc:
https://hg.orthanc-server.com/orthanc/rev/6156a970a2e1

Furthermore, the following changeset introduced the “USE_LEGACY_BOOST” option to CMake, as described in my previous post:
https://hg.orthanc-server.com/orthanc/rev/cfbf45e76468

Both changesets were already shipped in Orthanc-1.11.2.

Regards,
Sébastien-