Compiling PostgreSQL Plugin on Ubuntu 16.04.1

141 views
Skip to first unread message

max.t...@gmail.com

unread,
Oct 28, 2016, 4:20:20 PM10/28/16
to Orthanc Users
Hi all,

I have been trying to compile the PostgreSQL plugins on Ubuntu 16.04.1 and I am getting an error during the linking phase that has to do with libiconv. Specifically, "Undefined reference to 'libiconv'" generated while linking a boost file. Here is the message:


Linking CXX shared library libOrthancPostgreSQLStorage.so
CMakeFiles/OrthancPostgreSQLStorage.dir/boost_1_59_0/libs/locale/src/encoding/codepage.cpp.o: In function `boost::locale::call_iconv(void*, char**, unsigned long*, char**, unsigned long*)':
codepage.cpp:(.text._ZN5boost6locale10call_iconvEPvPPcPmS3_S4_[_ZN5boost6locale10call_iconvEPvPPcPmS3_S4_]+0x3c): undefined reference to `libiconv'
CMakeFiles/OrthancPostgreSQLStorage.dir/boost_1_59_0/libs/locale/src/encoding/codepage.cpp.o: In function `boost::locale::conv::impl::iconverter_base::open(char const*, char const*, boost::locale::conv::method_type)':
codepage.cpp:(.text._ZN5boost6locale4conv4impl15iconverter_base4openEPKcS5_NS1_11method_typeE[_ZN5boost6locale4conv4impl15iconverter_base4openEPKcS5_NS1_11method_typeE]+0x32): undefined reference to `libiconv_open'
CMakeFiles/OrthancPostgreSQLStorage.dir/boost_1_59_0/libs/locale/src/encoding/codepage.cpp.o: In function `boost::locale::conv::impl::iconverter_base::close()':
codepage.cpp:(.text._ZN5boost6locale4conv4impl15iconverter_base5closeEv[_ZN5boost6locale4conv4impl15iconverter_base5closeEv]+0x26): undefined reference to `libiconv_close'
collect2: error: ld returned 1 exit status
CMakeFiles/OrthancPostgreSQLStorage.dir/build.make:1056: recipe for target 'libOrthancPostgreSQLStorage.so.2.0' failed
make[2]: *** [libOrthancPostgreSQLStorage.so.2.0] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/OrthancPostgreSQLStorage.dir/all' failed
make[1]: *** [CMakeFiles/OrthancPostgreSQLStorage.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

I'm guessing this could be solved by installing the libiconv library and linking to it, however I am running into another set of compiler errors with that installation. So, two questions:
1. Is there a more straightforward way to get a hold of a PostgreSQL plugin that is compatible with Ubuntu 16.04.1?
2. If not, do you have any tips for installing libiconv or otherwise resolving this linker error?

Thanks!

Alain Mazy

unread,
Oct 29, 2016, 4:46:49 AM10/29/16
to max.t...@gmail.com, Orthanc Users
The best way to get Orthanc and its plugins running on any Linux installation: use Docker

If you really need/want/enjoy to compile it by yourself, then, check the Orthanc Docker repository (https://github.com/jodogne/OrthancDocker).  Docker images are built from clean ubuntu 14.04 install.  The build script contains all the instructions to install all prerequisites and build all plugins.  You might need to adapt a few package names for 16.04 but that should not be a big issue.

Other tip when compiling Orthanc and its plugins: use -DSTATIC_BUILD=ON -DALLOW_DOWNLOADS=ON to reduce the dependencies issues.


--

Alain Mazy / CTO 
a...@osimis.io / +32 494 31 67 27

Osimis

OSIMIS S.A. 
Rue bois Saint-Jean 15/1BE-4102 Seraing 
www.osimis.io

Twitter LinkedIn


Sébastien Jodogne

unread,
Oct 29, 2016, 3:24:49 PM10/29/16
to Orthanc Users, max.t...@gmail.com
Hello,

I have created a minimal build of the PostgreSQL plugins from source code on a raw Ubuntu 16.04.1 installation using Docker, and the linking works perfectly.

You will find my experimental Dockerfile attached to this message. Just type "sudo docker build -t orthanc-postgresql ." in the folder where you store the Dockerfile.

As a consequence, this is definitely an Orthanc-related problem here. This error reflects an issue with your Ubuntu box. Run synaptic, update the package database, upgrade all the packages, "autoremove" unneeded packages, and make sure nothing is broken.

That being said, I agree with Alain about Docker (https://github.com/jodogne/OrthancDocker), which is clearly the easiest way to bring the most recent version of Orthanc to any Linux box.

HTH,
Sébastien-
Dockerfile

max.t...@gmail.com

unread,
Nov 10, 2016, 9:16:51 PM11/10/16
to Orthanc Users, max.t...@gmail.com
Perfect, I downloaded a fresh copy of the source and it compiled just fine. Thanks for the help!
Reply all
Reply to author
Forward
0 new messages