External Email - Use Caution Hi, I'm Kazuhiro. I also met trouble for compilation of freesurfer stable6 repository under my Ubuntu 18.04 LTS machine.
Even the binary package of freesurfer6.0(freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0.tar.gz) can work under Ubuntu 18.04, option of '-use-gpu' required cuda runtime library of ver 5.0(libcudart.so.5.0). I have tried to link cuda runtime library of Ubuntu 18.04 (ver9.1) to ver5.0 filename. (ln -s libcudart.so.9.0 libcudart.so.5.0 ) It cannot work well. In my case, after eight steps below, it was successfully compiled and run normally with CUDA-GPU. (1) use library of centos7-packages. It was installed to /usr/pubsw/packages (2) vxl library build regard as instruction of develop_reposiory/packages/vxl. libvxl have not yet included in Ubuntu 18.04 packages. vxl library were installed to /usr/pubsw/vxl. (3) use library of tcltktixblt from binary package of freesurfer6.0 distribution (lib/tcltktixblt) tcltktixblt packages copy to /usr/pubsw/tcltktixblt (4) Cuda development packages were installed to /usr/local/cuda Download cuda_cluster_pkgs_8.0.61_ubuntu1604.tar.gz from NVIDA web site after extraction of above archive sudo dpkg -i cuda-cluster-runtime-8-0_8.0.61-1_amd64.deb sudo dpkg -i cuda-cluster-devel-8-0_8.0.61-1_amd64.deb My GPU card is fermi architecture of TESLA C2070 Therefore the final support packages is CUDA ver 8.0 (5) two files were changed in stable 6 repository for non-GUI build configure.in expat/xmlparse.c and additional ten files were changed for GUI build regarding as compile error GEMS/Makefile.am glut/glut_cmap.c glut/glut_util.c lineprof/LineProf.cpp lineprof/LineProf.h lineprof/Makefile.am lineprof/Preprocessor.cpp lineprof/Tracer.cpp lineprof/Traceh.h freeview/main.cpp (6) configure with ./configure --prefix=/usr/local/freesurfer --with-vxl-dir=/usr/pubsw/vxl \ --with-tcl-dir=/usr/pubsw/tcltktixblt --disable-Werror\ --with-vtk-dir=/usr/pubsw/packages/vtk/5.6 --with-mni-dir=/usr/pubsw/packages/mni/current \ --with-petsc-dir=/usr/pubsw/packages/petsc/2.3.3 --with-cuda=/usr/local/cuda --enable-fermi-gpu \ --with-itk-4.13=/usr/pubsw/packages/itk/4.13.0 --with-kwwidgets-dir=/usr/pubsw/packages/KWWidgets/CVS (7) make -j 8 (8) make install difference source code as follows configure.in, add blas and lapack library path and ITK4.13 configurlation -------------------------------------------------------------------------- --- configure.in_dist 2018-11-01 14:55:56.087117356 +0900 +++ configure.in 2018-10-05 17:31:04.451989866 +0900 @@ -397,6 +397,10 @@ fi if test -e /usr/lib64/libblas.a ; then LIB_BLAS="/usr/lib64/libblas.a" fi +if test -e /usr/lib/x86_64-linux-gnu/libblas.a ; then + LIB_BLAS="/usr/lib/x86_64-linux-gnu/libblas.a" +fi + if test "$host" = "powerpc64-suse-linux"; then if test -e /usr/lib/libblas.a ; then LIB_BLAS="/usr/lib/libblas.a" @@ -413,6 +417,8 @@ elif test -e /usr/lib64/liblapack.a ; th LIB_LAPACK="/usr/lib64/liblapack.a" elif test -e /usr/lib/lapack/liblapack.a ; then LIB_LAPACK="/usr/lib/lapack/liblapack.a" +elif test -e /usr/lib/x86_64-linux-gnu/liblapack.a ; then + LIB_LAPACK="/usr/lib/x86_64-linux-gnu/liblapack.a" fi if test "$host" = "powerpc64-suse-linux"; then if test -e /usr/lib/liblapack.a ; then @@ -557,7 +563,7 @@ case "${target}" in OS=Linux OS_CPPFLAGS="$DEADCODE_STRIP" OS_LDFLAGS="$DEADCODE_STRIP" - LDFLAGS="-L/usr/lib64 -L/usr/X11R6/lib64 $LDFLAGS" + LDFLAGS="-L/usr/lib/x86_64-linux-gnu $LDFLAGS" DYNAMIC_LIB_EXT=".so" SHARED_CFLAGS="-fPIC" SHARED_LDFLAGS="-shared" @@ -1219,8 +1225,8 @@ if test "x$x_includes" = "xNONE"; then x_includes= fi if test "x$x_includes" = "x"; then - if test -d "/usr/X11R6/include" ; then - x_includes=/usr/X11R6/include + if test -d "/usr/include/X11" ; then + x_includes=/usr/include/X11 fi fi AC_MSG_NOTICE([x_includes set to $x_includes \ @@ -2772,6 +2778,19 @@ AC_ARG_WITH(itk-4.5.1, ]) # end NJS HACK +# knam: --with-itk-4.13 is a temporary hack to allow building against ITK v4.13 +AC_ARG_WITH(itk-4.13, + [ --with-itk-4.13=DIR set paths to use ITK v4.13.], + [ ac_itk_includes="$withval"/include/ITK-4.13 + ac_itk_libraries="$withval"/lib + ITK_DIR="$withval" + itk_apps="yes" + itk_413="yes" + AC_SUBST(ITK_DIR) + ]) +# end NJS HACK + + AC_ARG_WITH(itk-include, [ --with-itk-include=DIR root of ITK include directory.], [ itk_i="$withval" @@ -2863,6 +2882,21 @@ if test "$itk_apps" = "yes"; then $ac_itk_libraries/libitkopenjpeg-4.5.a \ $ac_itk_libraries/libITKDICOMParser-4.5.a" fi + if test "x$itk_413" = "xyes"; then + LIBS_ITK="\ + $ac_itk_libraries/libITKIONRRD-4.13.a \ + $ac_itk_libraries/libITKIOImageBase-4.13.a \ + $ac_itk_libraries/libITKCommon-4.13.a \ + $ac_itk_libraries/libITKMetaIO-4.13.a \ + $ac_itk_libraries/libITKniftiio-4.13.a \ + $ac_itk_libraries/libITKNrrdIO-4.13.a \ + $ac_itk_libraries/libitkpng-4.13.a \ + $ac_itk_libraries/libitksys-4.13.a \ + $ac_itk_libraries/libitktiff-4.13.a \ + $ac_itk_libraries/libitkv3p_netlib-4.13.a \ + $ac_itk_libraries/libitkzlib-4.13.a \ + $ac_itk_libraries/libITKTransform-4.13.a" +fi # ITK v3.16.0 needs libuuid for function `gdcm::Util::GenerateUUID' if test -e /usr/lib/libuuid.a ; then @@ -2885,6 +2919,10 @@ fi AM_CONDITIONAL(ENABLE_ITK_APPS, test "$itk_apps" = "yes") AM_CONDITIONAL(HAVE_ITK_LIBS, test "$itk_apps" = "yes") +AM_CONDITIONAL(HAVE_ITK45, test "$itk_45" = "yes") +AM_CONDITIONAL(HAVE_ITK45, test "$itk_413" = "yes") +AM_CONDITIONAL(HAVE_ITK413, test "$itk_413" = "yes") + AC_SUBST(ITK_CFLAGS) AC_SUBST(ITK_LIBS) ------------------------------------------------------------------------- expat/xmlparse.c, correspond to memmove error -------------------------------------------------------------------------- --- xmlparse.c_dist 2018-11-01 14:54:25.554818570 +0900 +++ xmlparse.c 2018-10-04 10:31:10.246153077 +0900 @@ -79,14 +79,14 @@ typedef char ICHAR; /* Round up n to be a multiple of sz, where sz is a power of 2. */ #define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) -/* Handle the case where memmove() doesn't exist. */ -#ifndef HAVE_MEMMOVE -#ifdef HAVE_BCOPY -#define memmove(d,s,l) bcopy((s),(d),(l)) -#else -#error memmove does not exist on this platform, nor is a substitute available -#endif /* HAVE_BCOPY */ -#endif /* HAVE_MEMMOVE */ +/*Handle the case where memmove() doesn't exist. */ +//#ifndef HAVE_MEMMOVE +//#ifdef HAVE_BCOPY +//#define memmove(d,s,l) bcopy((s),(d),(l)) +//#else +//#error memmove does not exist on this platform, nor is a substitute available +//#endif /* HAVE_BCOPY */ +//#endif /* HAVE_MEMMOVE */ #include "internal.h" #include "xmltok.h" ------------------------------------------------------------------------- GEMS/Makefile.am was override by GEMS/Makefile.kvlN4ITK.am -------------------------------------------------------------------------- ------------------------------------------------------------------------- glut/glut_cmap.c, correspond to XmuLookupStandardColormap error -------------------------------------------------------------------------- --- glut_cmap.c_dist 2018-11-01 14:58:58.199666598 +0900 +++ glut_cmap.c 2018-10-05 10:06:39.501707105 +0900 @@ -238,6 +238,7 @@ __glutSetupColormap(XVisualInfo * vi, GL XFree(standardCmaps); } } +#define SOLARIS_2_4_BUG #ifndef SOLARIS_2_4_BUG /* Solaris 2.4 and 2.5 have a bug in their XmuLookupStandardColormap implementations. Please ------------------------------------------------------------------------- glut/glut_util.c, correspond to gluErrorString error -------------------------------------------------------------------------- --- glut_util.c_dist 2018-11-01 14:59:08.407695685 +0900 +++ glut_util.c 2018-10-05 10:04:38.821442922 +0900 @@ -48,7 +48,8 @@ glutReportErrors(void) GLenum error; while ((error = glGetError()) != GL_NO_ERROR) - __glutWarning("GL error: %s", gluErrorString(error)); + // __glutWarning("GL error: %s", gluErrorString(error)); + __glutWarning("GL error: %s gluErrorString(error)"); } /* ENDCENTRY */ ------------------------------------------------------------------------- files in lineprof directory were copied from developed repositry ------------------------------------------------------------------------- lineprof/LineProf.cpp lineprof/LineProf.h lineprof/Makefile.am lineprof/Preprocessor.cpp lineprof/Tracer.cpp lineprof/Traceh.h ------------------------------------------------------------------------- freeview/main.cpp was changed for files in lineprof directory -------------------------------------------------------------------------- --- main.cpp_dist 2018-11-01 14:57:56.591487516 +0900 +++ main.cpp 2018-10-05 10:43:10.374280172 +0900 @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) qInstallMsgHandler(myMessageOutput); #endif - LineProf::InitializePetsc(); + LineProf::InitializePetsc(true); CmdLineEntry cmdLineDesc[] = { > >Hi there, > > >Thank you for directing me to the CMake fswiki. I was able to install the >third party packages and execute the command `cmake . -DFS_PACKAGES_DIR="path >/to/pkgs"`. > > >However, when I run `make -j4` (after adjusting a few bash files in various >libraries to find (#include) other libraries) I am met with numerous >similarly-worded link error lines under the step "Linking Fortran executable >t4imgs_4dfp" with the general schema: > > >/usr/bin/ld: path/to/fortran-related/filename: relocation R_X86_64_32 against >`some.variable.or.file.name` can not be used when making a PIE object; >recompile with -fPIC > > >where path/to/fortran-related/filename is either CMakeFiles/t4imgs_4dfp.dir/ >some-file.c.o or /usr/lib/gcc/x86_64-linux-gnu/4.8/libgfortran.a(some- >function.o) > > >I tried finding a solution online and found the suggestion to add a global - >fPIC flag via export CXXFLAGS="$CXXFLAGS -fPIC" ( https://stackoverflow.com/ >questions/13812185/how-to-recompile-with-fpic ). I tried this by starting >completely over with a new clone of the freesurfer repo and calling cmake . - >DFS_PACKAGES_DIR="path/to/pkgs" and the make still failed at the same point. > > >Other suggestions (e.g., to add --enable-shared at ./configure(in that same >thread linked above)) suggest adding arguments when configuring, but since >this is all part of the make process I'm not sure whether that's possible. > > >Any advice? I did not find any similar issues in the archive. > >Thank you very much, >Christian McDaniel -------------------------------------------------------------- Kazuhiro Nakamura, Ph.D. Research Institute for Brain and Blood Vessels-Akita 6-10 Senshukubota machi, Akita 010-0874 JAPAN phone +81-18-833-0115 ext 769, fax +81-18-833-2104 E-mail: k...@akita-noken.jp _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer