Problem compiling postgresql plugin

Good evening,

following the instructions given in http://book.orthanc-server.com/plugins/postgresql.html I started compiling the postgres-plugin in https://build.opensuse.org/package/show/home:DocB:Orthanc/orthanc-postgresql

I’ve set orthanc-devel as build dependency, but it insists on downloading stuff during the compilation (compiler-flag -DALLOW_DOWNLOADS=OFF )

Can this somehow be avoided?

Thanks
Axel

Hi, Alex!

What are the exact commands you’re issuing? Are you passing this flag to make or cmake?

HTH
Luiz

Hello Luiz,

Hi Axel,

This is because of the fact that most Orthanc plugins re-use a part of the C++ code of Orthanc, independently of the development headers.

To solve this issue, you have to put the source code distribution “Orthanc-1.5.4.tar.gz” file into a folder called “ThirdPartyDownloads” located next to the “PostgreSQL/CMakeLists.txt” file.

For reference, check out the “override_dh_auto_configure” rule and the “CMAKE_EXTRA_FLAGS” variable that is used when building the Debian package:
https://salsa.debian.org/med-team/orthanc-postgresql/blob/master/debian/rules

HTH,
Sébastien-

Hello Sebastien,

Hello,

Can we somehow use the source-RPM that is build together with the orthanc RPM?

This could indeed work, but I am not sure about this… while invoking CMake of the PostgreSQL plugin, you could try and add the two following command-line options:

  • -DORTHANC_FRAMEWORK_SOURCE=path
  • -DORTHANC_FRAMEWORK_ROOT=/path/to/Orthanc/sources/
    HTH,

Sébastien-

Hello Sebastien,

Hello,

Can we somehow use the source-RPM that is build together with the orthanc RPM?

This could indeed work, but I am not sure about this… while invoking CMake of the PostgreSQL plugin, you could try and add the two following command-line options:

  • -DORTHANC_FRAMEWORK_SOURCE=path
  • -DORTHANC_FRAMEWORK_ROOT=/path/to/Orthanc/sources/

Yes, that was helpful! Anyway, the plugin wants to download some more files, although they are already installed (gtest-devel in that case):

[ 4s] – Found OpenSSL: /usr/lib64/libcrypto.so (found version “1.1.0h”)
[ 5s] – Found ZLIB: /usr/lib64/libz.so (found version “1.2.11”)
[ 5s] Downloading http://orthanc.osimis.io/ThirdPartyDownloads/gtest-1.8.1.tar.gz
[ 5s] CMake Error at /usr/src/orthanc/Resources/CMake/DownloadPackage.cmake:89 (file):
[ 5s] file DOWNLOAD HASH mismatch
[ 5s]
[ 5s] for file: [/home/abuild/rpmbuild/BUILD/OrthancPostgreSQL-3.1/PostgreSQL/ThirdPartyDownloads/gtest-1.8.1.tar.gz]
[ 5s] expected hash: [2e6fbeb6a91310a16efe181886c59596]
[ 5s] actual hash: [d41d8cd98f00b204e9800998ecf8427e]
[ 5s] status: [6;“Couldn’t resolve host name”]
[ 5s]

Is there a way to work around this?
Thanks
Axel

Hi Axel,

I managed to successfully build the PostgreSQL plugins on Leap 15.1, using the following sequence of commands in a Dockerfile:

FROM opensuse/leap:15.1

RUN zypper addrepo https://download.opensuse.org/repositories/home:DocB:Orthanc/openSUSE_Leap_15.1/home:DocB:Orthanc.repo
RUN zypper --gpg-auto-import-keys refresh

RUN zypper -n install orthanc-devel gcc-c++ cmake gtest-devel hg python2-pyOpenSSL patch tar gzip postgresql-devel
RUN zypper -n source-install orthanc

RUN cd && hg clone https://bitbucket.org/sjodogne/orthanc-databases

RUN mkdir ~/orthanc-databases/Build &&
cd ~/orthanc-databases/Build &&
cmake ~/orthanc-databases/PostgreSQL -DORTHANC_FRAMEWORK_SOURCE=path -DORTHANC_FRAMEWORK_ROOT=/usr/src/orthanc/ &&
make -j4

ENTRYPOINT [ “/bin/bash” ]

HTH,
Sébastien-

Hi Sebastien,

Hi Axel,

I managed to successfully build the PostgreSQL plugins on Leap 15.1, using the following sequence of commands in a Dockerfile:

Unfortunately not really - you are doing an online build inside your docker environment, which is fine as such.
But OBS (Open Build Service) does not allow download of packages / sources during build time.
Instead it uses Build-Requirements in terms of existing RPM (or source packages, of course) to guarantee consistency.
So I need to work around these downloads during build time.
As you noticed, the orthanc sources are added to the orthanc-devel package, but the already installed gtest-package is not considered by the CMAKE command.

Cheers
Axel

I’m not sure to understand your problem: In my sequence of commands above, the “CMake” step does not download any additional package, and only uses what is installed by the “zypper” steps above

Yes, thats interesting…
Take a look at https://build.opensuse.org/package/show/home:DocB:Orthanc/orthanc-postgresql
For whatever reason,DownloadPackage.cmake wants to download the gtest package, although it is already installed:
https://build.opensuse.org/package/live_build_log/home:DocB:Orthanc/orthanc-postgresql/openSUSE_Leap_15.1/x86_64

Hi,

The culprit is: “-DUSE_SYSTEM_GOOGLE_TEST=OFF”

This option should be left to its “ON” default. Setting it to “OFF” requests Orthanc to avoid the use of the system library (i.e. the “gtest” package).

Hi Sebastien,

Hi Axel,

This is great news!!

Regarding the “lib64” issue, I think it is related to the following patch that is part of the Fedora package:
https://src.fedoraproject.org/rpms/orthanc/blob/master/f/orthanc-1.5.4-lib64.patch

I’m looking forward to read the testing feedback from the openSUSE community!

Regards,
Sébastien-