Linux static build fails

linux
installation

#1

Hi all, I would like to use tckgen and tcksift2 on the HPC cluster of our university. Therefore, I`m trying to build static executables by running

./configure -static -nogui
./build

This is on the machine where a regular build runs without problems. But the static build fails with:

ERROR: (266/365) [LB] bin/mrpad
ERROR: (263/365) [LB] bin/dirorder
ERROR: (262/365) [LB] bin/transformcompose
ERROR: (265/365) [LB] bin/meshconvert
ERROR: (267/365) [LB] bin/tck2fixel
ERROR: (268/365) [LB] bin/afdconnectivity
ERROR: (264/365) [LB] bin/dirgen
ERROR: (269/365) [LB] bin/mrstats

ERROR: (266/365) [LB] bin/mrpad

g++ tmp/core/exception.o tmp/core/formats/mgz.o tmp/core/stride.o tmp/core/formats/nifti1.o tmp/core/image_io/scratch.o tmp/core/formats/mri.o tmp/core/image_io/pipe.o tmp/core/formats/nifti1_gz.o tmp/core/formats/mgh.o tmp/core/file/dicom/select_cmdline.o tmp/core/math/average_space.o tmp/core/version.o tmp/core/math/stats/glm.o tmp/core/file/mgh.o tmp/core/file/dicom/element.o tmp/core/file/dicom/tree.o tmp/core/file/nifti2_utils.o tmp/core/formats/nifti2_gz.o tmp/core/signal_handler.o tmp/core/app.o tmp/core/math/bessel.o tmp/core/file/tiff.o tmp/core/datatype.o tmp/core/header.o tmp/core/file/dicom/dict.o tmp/core/image_io/mosaic.o tmp/core/adapter/reslice.o tmp/core/file/nifti1_utils.o tmp/core/file/name_parser.o tmp/core/image_io/tiff.o tmp/core/formats/ram.o tmp/core/thread.o tmp/core/formats/dicom.o tmp/core/file/nifti_utils.o tmp/core/bitset.o tmp/core/stats.o tmp/core/formats/xds.o tmp/core/image_io/default.o tmp/core/formats/mrtrix_sparse_legacy.o tmp/core/file/dicom/image.o tmp/core/file/json_utils.o tmp/core/file/mmap.o tmp/core/formats/pipe.o tmp/core/formats/mrtrix_gz.o tmp/core/math/stats/permutation.o tmp/core/image_io/fetch_store.o tmp/core/image_io/base.o tmp/core/formats/mrtrix_utils.o tmp/core/formats/analyse.o tmp/core/algo/histogram.o tmp/cmd/mrpad.o tmp/core/file/dicom/patient.o tmp/core/file/dicom/mapper.o tmp/core/formats/mrtrix.o tmp/core/image_io/sparse.o tmp/core/phase_encoding.o tmp/core/mrtrix.o tmp/core/image_io/ram.o tmp/core/file/dicom/study.o tmp/core/file/key_value.o tmp/core/formats/nifti2.o tmp/core/file/config.o tmp/core/image_io/gz.o tmp/core/progressbar.o tmp/core/math/SH.o tmp/core/file/dicom/quick_scan.o tmp/core/formats/list.o tmp/core/file/ofstream.o tmp/core/formats/tiff.o tmp/core/file/dicom/series.o -static -Wl,-u,pthread_cancel,-u,pthread_cond_broadcast,-u,pthread_cond_destroy,-u,pthread_cond_signal,-u,pthread_cond_wait,-u,pthread_create,-u,pthread_detach,-u,pthread_cond_signal,-u,pthread_equal,-u,pthread_join,-u,pthread_mutex_lock,-u,pthread_mutex_unlock,-u,pthread_once,-u,pthread_setcancelstate -pthread -lz -ltiff -lfftw3 -L./lib -o bin/mrpad

failed with output

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtiff.a(tif_jbig.o): In function `JBIGEncode':
(.text+0x45): undefined reference to `jbg_enc_init'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtiff.a(tif_jbig.o): In function `JBIGEncode':
(.text+0x4d): undefined reference to `jbg_enc_out'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtiff.a(tif_jbig.o): In function `JBIGEncode':
(.text+0x55): undefined reference to `jbg_enc_free'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtiff.a(tif_jbig.o): In function `JBIGDecode':
(.text+0xc7): undefined reference to `jbg_dec_init'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtiff.a(tif_jbig.o): In function `JBIGDecode':
(.text+0xda): undefined reference to `jbg_newlen'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtiff.a(tif_jbig.o): In function `JBIGDecode':
(.text+0xf2): undefined reference to `jbg_dec_in'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtiff.a(tif_jbig.o): In function `JBIGDecode':
(.text+0x103): undefined reference to `jbg_dec_getimage'

Any advice? Thanks a lot!
Marco


#2

Yes, static builds can be very difficult to deal with… In this case, it looks like you’re missing the static version of the JBIG-KIT library, which libTIFF depends on. A simple fix is just to prevent configure from finding your TIFF library, in which case it simply won’t use it (all it does is disable TIFF image support, which is a very rare use case):

TIFF_CFLAGS="bogus" ./configure -static -nogui

Otherwise, have you considered the standalone installation as an option? It avoids all these issues with getting a static build to compile. But I have to admit I’ve encountered setups where neither the static nor standalone installations actually worked on the target system – no idea why…


#3

Alternatively, is a static build strictly necessary? I was able to compile natively on my local HPC system, and documented how I did it.


#4

Thanks a lot. TIFF_CFLAGS="bogus" did the trick!