cmpiling ITK on CentOs - pcre/swig error

Hello,

I am trying to compile ITK on a CentOs 7 cluster. During the compilation, I get the error -
[ 56%] Completed ‘PCRE’
[ 56%] Built target PCRE

[ 56%] No update step for ‘swig’
[ 56%] No patch step for ‘swig’
[ 56%] Performing configure step for ‘swig’
– Swig configure successfully completed.
[ 56%] Performing build step for ‘swig’
Swig/misc.o: In function Swig_string_regex': misc.c:(.text+0x2223): undefined reference to pcre_free’
misc.c:(.text+0x22b7): undefined reference to pcre_compile' misc.c:(.text+0x22f6): undefined reference to pcre_exec’
misc.c:(.text+0x2334): undefined reference to pcre_free' Swig/misc.o: In function Swig_pcre_version’:
misc.c:(.text+0x2405): undefined reference to pcre_version' Swig/naming.o: In function name_regexmatch_value’:
naming.c:(.text+0x32): undefined reference to pcre_compile' naming.c:(.text+0x77): undefined reference to pcre_exec’
naming.c:(.text+0x83): undefined reference to `pcre_free’
collect2: error: ld returned 1 exit status
make[5]: *** [eswig] Error 1
make[4]: *** [all] Error 2
make[3]: *** [source] Error 2
make[2]: *** [Wrapping/Generators/SwigInterface/swig-prefix/src/swig-stamp/swig-build] Error 2
make[1]: *** [Wrapping/Generators/SwigInterface/CMakeFiles/swig.dir/all] Error 2
make: *** [all] Error 2

Is the swig needed? Can I skip it by choosing some option in the configure step? how do I get over the problem that it does not recognize pcre even after it was compiled during the build process?

Best,
Yaron

Which version of ITK are you trying to compile? pcre_free problem sounds familiar.

InsightToolkit-5.1.1

Yes, I read that people had it on MacOs, and there was a solution, but I am building on Linux CentOs 7.

Yaron

Welcome to the ITK community @Yaron! :sunny:

There should not be any issues with the CentOS 7 build – I built it yesterday :-).

Are any SWIG-related CMake options changed from their default? What are the CMake configuration options changed from the defaults?

Dear Matt,

Thanks for your answer.
I think I found the error. Yesterday, I built InsightToolkit-5.1.2 with the default configuration and it worked.

However, if I tried to activate the building of examples (BUILD_EXAMPLES), the python wrapper (ITK_WRAP_PYTHON), and the Module_SimpleITKFilters it fails with the same error about swig and PCRE.

The reason is that I try to install InsightToolkit on a CentOs Cluster. I do not have an administer privileges so I install it in an alternative path (to be used later on using the module package of clusters computational gridI).

After configuration, I use the command: make DESTDIR=PATH_TO_INSTALL install

As a result, make creates the following folders:

A. PATH_TO_INSTALL/usr

B. PATH_TO_INSTALL/ORIGINAL_PATH_OF_BINARIES_BUILD/Wrapping/Generators/SwigInterface/PCRE/

In the first, it places all the ITK compiles files, and in the second the PCRE.

So, when one of BUILD_EXAMPLES, ITK_WRAP_PYTHON, or module_SimpleITKFilters needs swig (I do not know which one), it does not find it due to the additional ORIGINAL_PATH_OF_BINARIES_BUILD created by cmake.

In conclusion, there is an error in the cmake file regarding the way that it install PCRE in an alternative path.

Yaron

Dear Yaron,

Thanks for the update.

Could you please try disabling Module_SimpleITKFilters then, installing to an alternative path.

If the behavior is the same, please try disabling ITK_WRAP_PYTHON, then installing to an alternative path.

Either of those may be building SWIG / PCRE, but SWIG / PCRE should not be installed into the install tree.

Thanks,
Matt