DevelopmentalImagingMCRI / MCRIBS

Surface version of the M-CRIB atlases.
12 stars 6 forks source link

Problem with cmake #1

Closed mblesac closed 3 years ago

mblesac commented 4 years ago

Hi,

I'm trying to install this fantastic tool, but I'm having problems when I run the build.sh script.

The error that appears is the following:

[ 13%] Building CXX object Packages/DrawEM/ThirdParty/ANTs/CMakeFiles/N4.dir/N4.cxx.o
[ 13%] Building CXX object Packages/DrawEM/ThirdParty/ANTs/CMakeFiles/N4.dir/antsCommandLineParser.cxx.o
[ 13%] Building CXX object Packages/DrawEM/ThirdParty/ANTs/CMakeFiles/N4.dir/antsCommandLineOption.cxx.o
[ 13%] Built target gifticlib
[ 13%] Linking CXX shared library ../../../lib/libMIRTKCommon.so
/usr/bin/ld: /usr/local/lib/libz.a(gzio.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Modules/Common/src/CMakeFiles/LibCommon.dir/build.make:319: recipe for target 'lib/libMIRTKCommon.so.0.0.0' failed
make[2]: *** [lib/libMIRTKCommon.so.0.0.0] Error 1
CMakeFiles/Makefile2:1781: recipe for target 'Modules/Common/src/CMakeFiles/LibCommon.dir/all' failed
make[1]: *** [Modules/Common/src/CMakeFiles/LibCommon.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 13%] Built target metaio
[ 13%] Built target nifticlib
[ 13%] Linking CXX executable ../../../../lib/tools/N4
[ 13%] Built target N4
Makefile:168: recipe for target 'all' failed
make: *** [all] Error 2
[  0%] Built target LibLBFGS
[  0%] Linking CXX shared library ../../../lib/libMIRTKCommon.so
/usr/bin/ld: /usr/local/lib/libz.a(gzio.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Modules/Common/src/CMakeFiles/LibCommon.dir/build.make:319: recipe for target 'lib/libMIRTKCommon.so.0.0.0' failed
make[2]: *** [lib/libMIRTKCommon.so.0.0.0] Error 1
CMakeFiles/Makefile2:1781: recipe for target 'Modules/Common/src/CMakeFiles/LibCommon.dir/all' failed
make[1]: *** [Modules/Common/src/CMakeFiles/LibCommon.dir/all] Error 2
Makefile:168: recipe for target 'all' failed
make: *** [all] Error 2

I tried also to add the -fPIC flag to the cmake calls in build.sh but the error still persists. Do ou have any suggestions to solve this issue? Thanks in advance.

Manuel

chrisadamsonmcri commented 4 years ago

Your problem is with the system library /usr/local/lib/libz.a; it is unusual for this to be in /usr/local. But yeah this library was compiled without -fPIC, For some reason static files need -fPIC now so yeah you will need to recompile/reinstall that library.

Alirezamnk commented 3 years ago

Hello, When I try to run build.sh script, I will get this error:

======================================================== Cloning into 'ITK'... remote: Enumerating objects: 487673, done. remote: Counting objects: 100% (446/446), done. remote: Compressing objects: 100% (230/230), done. remote: Total 487673 (delta 243), reused 371 (delta 212), pack-reused 487227 Receiving objects: 100% (487673/487673), 163.27 MiB | 28.97 MiB/s, done. Resolving deltas: 100% (386120/386120), done. Note: checking out 'tags/v5.1.0'.

You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

HEAD is now at d3286c9... ENH: Update testing data content links for 5.1.0 /usr/local/MCRIBS/ITK/ITK-build ./build.sh: line 60: cmake3: command not found make: No targets specified and no makefile found. Stop. make: No rule to make target `install'. Stop. Cloning into 'VTK'... remote: Enumerating objects: 606536, done. remote: Counting objects: 100% (204/204), done. remote: Compressing objects: 100% (149/149), done. remote: Total 606536 (delta 77), reused 118 (delta 51), pack-reused 606332 Receiving objects: 100% (606536/606536), 230.92 MiB | 36.59 MiB/s, done. Resolving deltas: 100% (464770/464770), done. Checking out files: 100% (18423/18423), done. Note: checking out 'tags/v8.1.2'.

You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

HEAD is now at c3b3b59... Merge topic 'release-8.1.2' into release patching file VTK/VTK/Filters/General/vtkIntersectionPolyDataFilter.cxx 3.6.8 3 6 ./build.sh: line 105: cmake3: command not found make: No targets specified and no makefile found. Stop. make: No rule to make target install'. Stop. which: no ccache in (/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin) ./build.sh: line 124: cmake3: command not found make: *** No targets specified and no makefile found. Stop. make: *** No rule to make targetinstall'. Stop.

Do you have any suggestions? Thanks!