Dear members,
as I am quite new to ITK, I hope someone can help me out with this static runtime crash.
I am trying to statically compile an example from ITK to the statix ITK libraries.
make build dir
mkdir itk-static && cd itk-static
build ITK STATIC
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-march=native -DCMAKE_CXX_FLAGS=-fpermissive -DCMAKE_CXX_STANDARD=11 -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF ../lib/InsightToolkit-5.0.1/
Compile
cmake --build . --parallel -j 8
Now I build a small example from the ITK examples:
mkdir /tmp/ReadAndPrintDICOMTags && cd /tmp/ReadAndPrintDICOMTags
Use the staic itk build in the previous step
cmake -DITK_DIR=/tmp/itk-static -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS="-static" /tmp/ITKExamples/src/IO/GDCM/ReadAndPrintDICOMTags/
The executable runs fine. I give it a path to a dicom series. However, on exit, it gives a segfault.
./ReadAndPrintDICOMTags /tmp/dicom/201
output:
…
0040|2400 =
2050|0020 = IDENTITY
Patient’s Name (0010|0010) is: ex010
Segmentation fault
Tried ‘strace’ - all runs fine, until the last exit, does not return normally (exit 0 = SUCCESS) , but segfaults
…
munmap(0x7fca25fdd000, 167936) = 0
munmap(0x7fca24e3f000, 167936) = 0
munmap(0x7fca262e8000, 167936) = 0
munmap(0x7fca22c27000, 29032448) = 0
munmap(0x7fca28be3000, 135168) = 0
— SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} —
+++ killed by SIGSEGV +++
Segmentation fault
Does anyone see what I should do to make this work?
Thank you in advance,
Vincent