External Email - Use Caution        

Hi,

I'm trying to create a freesurfer (v7.3.3) package definition for guix. I have 
some problems during
freesurfers configure step though. I'm using the following definitions to build 
freesurfer (this may
not help much if you don't know guix, but you may still see what might be wrong 
in the attached
build log).


```
(use-modules
 (gnu packages algebra)
 (gnu packages check)
 (gnu packages commencement)
 (gnu packages compression)
 (gnu packages fontutils)
 (gnu packages geo)
 (gnu packages gl)
 (gnu packages image)
 (gnu packages image-processing)
 (gnu packages llvm)
 (gnu packages maths)
 (gnu packages pdf)
 (gnu packages perl)
 (gnu packages python)
 (gnu packages qt)
 (gnu packages serialization)
 (gnu packages shells)
 (gnu packages sqlite)
 (gnu packages tcl)
 (gnu packages vim)
 (gnu packages xiph)
 (gnu packages xml)
 (gnu packages xorg)
 (guix build-system cmake)
 (guix download)
 (guix gexp)
 (guix git-download)
 ((guix licenses) #:prefix license:)
 (guix packages))

(define-public itk
  (package
    (name "itk")
    (version "5.3.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url 
"https://secure-web.cisco.com/1KgpkMc1pvHUPomaJMVqKQnZBVMErQsj49d1dySfD5xTF-4FwrJqic4QH24BS9A6FBEYTsie5s6QjHF0t3oUiyHbksw5PN1DApfmLPKVbSP_xhn7z9By42NVRA216Pm__lnJXQKlCZ7sMPCVl31xoayVBrdUkbqszGSz63mPjuIwpNDDrjGDsPzv1RMC0f-0_V5B14dce0LmASzaVZAW5U7EgZz6r_HrtKURXUiGIaD79wJIM8Xu0dkyqZHduy_zW9Ro9Kt5gX0bekAR35_MfXAiXqGp5QQaKWMb4LZqjQ_keQaYVK343qyRjCO2TfCNAnmAs84qSPvXhUC9Z4gvVPA/https%3A%2F%2Fgithub.com%2FInsightSoftwareConsortium%2FITK";)
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1bx98lzafj83fxylm0qnxkn05rdlrvfc672f0n843hgis2wk0gfh"))))
    (build-system cmake-build-system)
    (arguments
     `(#:configure-flags (list "-DBUILD_EXAMPLES=OFF"
                               "-DITK_FORBID_DOWNLOADS=ON"
                               "-DITK_USE_KWSTYLE=OFF" ; requires git during 
build
                               "-DITK_USE_SYSTEM_LIBRARIES=ON"
                               "-DITK_USE_CLANG_FORMAT=OFF"
                               (string-append "-DGTEST_ROOT="
                                              (assoc-ref %build-inputs
                                                         "googletest")))
       #:phases
       ,#~(modify-phases %standard-phases
         (add-before 'configure 'unpack-test-data
           (lambda _
             (invoke "tar" "xzf" #$(this-package-native-input "test-data")
                     "--strip-components=1"))))))
    (native-inputs
     `(("cppcheck" ,cppcheck)
       ("eigen" ,eigen)
       ("googletest" ,(package-source googletest))
       ("perl" ,perl)
       ("python" ,python)
       ("test-data"
        ,(origin
           (method url-fetch)
           (uri (string-append
                 
"https://secure-web.cisco.com/14JbcCit8VdllWuNGvNogUu6Rm4HBxrjFJ5eN_gcCfjbdtn1TR7ZH-n2wrcmPq7CZxgCRHwwEdWumZnIwOL1kmEL1_iKt6zFd0WJe9UtzAmwdYnCcmuOkUfEm9JIZyA6_w-fwA9GeHGN7oD7hDOv1voukf2O4a7OJg-j5GIGJjPp1FM2Hdd9jXZOwwvnhOE51e9iVxZHcmjltg4IuTTx9Zj8mdJRZjxJJhfZdfF04qv1o0wowDjPRDGBwzbf6RBo176tQvxWz-a2ZULLo569ay62shBk8ED4ds_isWIOi_ZgLTf8iSvlFJx5FPxBt7Ly_i6JCwGB-cjo1hFRnN1V60w/https%3A%2F%2Fgithub.com%2FInsightSoftwareConsortium%2FITK%2Freleases%2Fdownload%2Fv";
                 version "/InsightData-" version ".tar.gz"))
           (sha256
            (base32 "1iyr037x7yqkdhd3w427pp6ba947l79acplq4cx9jicrbfgbxy2k"))))))
    (inputs (list expat
                  hdf5
                  libjpeg-turbo
                  libpng
                  libtiff
                  zlib))
    (outputs (list "out" "debug"))
    (synopsis
     "Spatially-oriented architecture for processing, segmentation, and
registration of scientific images")
    (description
     "The Insight Toolkit (ITK) is an open-source, cross-platform toolkit for
N-dimensional scientific image processing, segmentation, and registration.
Segmentation is the process of identifying and classifying data found in a
digitally sampled representation.  Typically the sampled representation is an
image acquired from such medical instrumentation as CT or MRI scanners.
Registration is the task of aligning or developing correspondences between data.
For example, in the medical environment, a CT scan may be aligned with a MRI
scan in order to combine the information contained in both.")
    (home-page 
"https://secure-web.cisco.com/1e3XSo-gh-p-0Y5bOrS4AAQKhvfMxcv9IpC5tdPa-bv-CJc9uWXFvT5klLm99Bhapat7Fb4Am3pOZPJWF0yVNRziCFY7O8dPieoOuQe0OlZF4ARvFE4cGghABR9MHUcSElZhvMGEi0PuM-pCsPrgyeybhb61x8wKLUU0tZM59O-niNZzjXeOP8_BY0lGtleq1_2TTQXYQ9XapTQNQnMkcq0dbETzLrYVMhQ64kRdA3iYh2TY-r6NsqrTfxTp3Rm27naRXAvFq9tzoed1r-yex8_c9xkUSV8s1ocNeclvMNnlRuFzf4KxfyxEz1rPlpd-Xg6Su7YMKscNbtNCf2Y9pfg/https%3A%2F%2Fitk.org";)
    (license license:asl2.0)))

(define-public freesurfer
  (package
    (name "freesurfer")
    (version "7.3.3")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url 
"https://secure-web.cisco.com/1wexvnLD388FTeoOYQDV62Yu0pE_NZYF0g3QWqMApqiUTsn231GfHllUclG4IFtS4wMTL58eDPMTfcd16Vft_k0Y1SAd2Qi-hjo21_OZxolydk0rlE_vgDqjxMbTiY1OmKc2gKsH6hckCJhCN-faYWYWmsWpUY0Wok6CHWEwm1MAuHH1gPsKOGawZp5NcZ427najqR-VdQcd3nDS1VBRoE9GRrmk_p_6Kn9WeSWRPJA6E8k6-1Wx-iYkkd6TxJmzMggMqfwXfuTeRlLeB4S99fIz0ZYUyJDVUOvMACmIHWdbhYiN6OMCJtLHDoIWvZutSbBCg_RTSagO3bcnE9c8h-w/https%3A%2F%2Fgithub.com%2Ffreesurfer%2Ffreesurfer%2F";)
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1vn9vs6q451qp8ak62fc21zv91gm2f0f5wiijh4xj4zys3fyvi93"))
              (modules '((guix build utils)))
              (snippet '(begin
                          (substitute* "CMakeLists.txt"
                            (("ARMADILLO")
                             "Armadillo")
                            (("OPENGL")
                             "OpenGL"))
                          (substitute* "cmake/FindOpenCV.cmake"
                            (("opencv2 PATH_SUFFIXES include")
                             "opencv2 opencv4/opencv2 PATH_SUFFIXES 
include"))))))
    (build-system cmake-build-system)
    (arguments
     `(#:configure-flags
       (list "-DMARTINOS_BUILD=OFF"
             "-DBUILD_GUIS=OFF")))
    (native-inputs
     `(("gfortran-toolchain" ,gfortran-toolchain)
       ("gl2ps" ,gl2ps)
       ("googletest" ,(package-source googletest))
       ("perl" ,perl)
       ("python" ,python)
       ("tcl" ,tcl)
       ("tcsh" ,tcsh)
       ("xxd" ,xxd)))
    (inputs (list armadillo
                  openblas
                  double-conversion
                  eigen
                  expat
                  freetype
                  hdf5
                  glew
                  itk
                  jsoncpp
                  lapack
                  libharu
                  libjpeg-turbo
                  libpng
                  libtheora
                  libtiff
                  libx11
                  libxt
                  libxml2
                  libxmu
                  lz4
                  mesa
                  netcdf
                  opencv
                  petsc
                  proj
                  qtbase-5
                  qtx11extras
                  sqlite
                  vtk
                  zlib))
    (outputs (list "out" "debug"))
    (synopsis "Software suite for processing human brain MRI")
    (description
     "FreeSurfer is a software package for the analysis and visualization of
neuroimaging data from cross-sectional and longitudinal studies.  It is
developed by the Laboratory for Computational Neuroimaging at the Martinos
Center for Biomedical Imaging.

FreeSurfer provides full processing streams for structural and functional MRI
and includes tools for linear and nonlinear registration, cortical and
subcortical segmentation, cortical surface reconstruction, statistical analysis
of group morphometry, diffusion MRI, PET analysis, and much more.  It is also
the structural MRI analysis software of choice for the Human Connectome
Project.")
    (home-page 
"https://secure-web.cisco.com/1PZCRDcDOn3O1uoFNsBeYHfpLQY2DOO20fJU6mAm8xv-5H1JMAtg-9f3EpaywU_8arU5HmixF2gY3p_mP2HqeBU4YlFUBZ-GnR1yoQTKl7bdPqTL9B1Q8t5ZL7aevfRvtKrS8OQe5XLxeJENL2HCwiVNCIx9SKifQZu-VWFGSkAy9FYNV-_zu-CJ61gLOqBSJ0XEeWLcBsEg8Wy-egqBKi2q6Na-Kv4sl-a_pUFQHcnXdNZ9Kg8dOgZ4s2EFR1n_0xkIHV6ckguBFLwInc7RPGg9pX5ngN_aHxqaGyAsyavJEjKm4B0njm8fl5FpQe7YZHC_vhpmuVrQNaQjlA8Qahg/https%3A%2F%2Fsurfer.nmr.mgh.harvard.edu";)
    ;; it's an open source license but afaict it isn't free as in freedom.
    (license #f)))

```

The output of `guix describe`:
```
Generation 168  Feb 01 2023 13:00:36    (current)
  guix 14323ed
    repository URL: 
https://secure-web.cisco.com/15q8zTqQfZSwuvTajUs5f9N2aYltiq9edRi1PUyW8JzLdAG213MOvlRnxZDWqq-8C6Kb5Btiw1T0P4bMSjAuJ6oveHMQTyRjkx8KmCGAWnK23ApSa3gKeisw3cbU4Nz7PsZp2ymyTvl7VoJnb-mCHgpuIJ3AJyFdh73-YiV8_F7EL3OvRM27LxXiMTwtpkr52kKdtcr6x8omkOTEEzlmzSYkyfCqGUTpSMAh_7ew_IussqZNMokuw6uCqhT8W46Ia2WVUz5G9Vy7EGn_N_tC3_rKT_iOwqR6ER9UHxLtk2GFTQJE6Sa6UufIDvXm1524xgq_UIDqzC076oZdBmN3tKQ/https%3A%2F%2Fgit.savannah.gnu.org%2Fgit%2Fguix.git
    branch: master
    commit: 14323edcc37d9efaae2491cf5f57ea0621412d7e
  nonguix c694cf9
    repository URL: 
https://secure-web.cisco.com/1XwNEBscgHWCPMrio9mZuc4l17saADnyXjvBec6Pavy9o8TnuWqn0j7ITxgBFWNSddGhaYYVzxZiO3CykwdngBi4QrOUmX7U6qzQXnZaLGgWN0MATczXMmePtAts03i_nURxTpIdQbhBWPnb802ytD7LOEH5UBGbPGmgHRm_5Dm9bgEfyAbGOPepEohQy5xfVd3to2d7AZRcbvgL6ZJsTYoHLaZ-8XvTyuRA1KVRQUK5dy9l0KMvF-PwHsv186xnJEPv13ofH7ixyR7rsLSJCxt6lleeA1l_9Nqt9tm1TRYWVYVwj2ZEhwKnJRgGCDmRJTmVCCqdWxcdwHOk3ZIIKrQ/https%3A%2F%2Fgitlab.com%2Fnonguix%2Fnonguix
    branch: master
    commit: c694cf9211db3cc8673f0e73708d53b75d26518b
```

Now to my questions/remarks:
  - As i can see in the wiki i am actually supposed to set `FS_PACKAGES_DIR` 
but as far as i
    understand this setting it doesn't make sense in guix. What is the exact 
purpose of this 
    variable? Every dependency of freesurfer that is specified in the 
`native-inputs` (which is 
    for dependencies only used at build time) and `inputs` fields is available 
during the build
    (and _only_ what is specified there). The configure output in the log also 
clearly shows that
    all dependencies are actually found (besides ANN that isn't packaged and i 
haven't
    packaged it myself until now; i should probably do that...)
  
  - cmake searches for `FindARMADILLO.cmake` but the file is called 
`FindArmadillo.cmake`
    which results in CMake erroring out because it can't find 
`FindARMADILLO.cmake`. 
    The find_package for Armadillo is commented out on dev though.
  
  - The actual error i hit currently are quite a bunch of these for different 
files, cmake reported
    earlier that it could find all X11 deps though. Googling for it seems to 
suggest that this
    could be due to transitive dependencies interfering with each other (vtk 
also imports libx11;
    but this is just a guess)
```
CMake Error at cmake/functions.cmake:234 (add_executable):
  Target "lineprof_test" links to target "X11::X11" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  lineprof/CMakeLists.txt:31 (add_test_executable)
```

   - even though i have lapack and openblas and the gfortran toolchain inside 
the build
     environment, i get:
```
CMake Error: The following variables are used in this project, but they are set 
to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake 
files:
BLAS_LIBRARIES
    linked by target "lineprof_test" in directory 
/tmp/guix-build-freesurfer-7.3.3.drv-0/source/lineprof
    linked by target "surf2vol" in directory 
/tmp/guix-build-freesurfer-7.3.3.drv-0/source/fem_elastic
GFORTRAN_LIBRARIES
    linked by target "lineprof_test" in directory 
/tmp/guix-build-freesurfer-7.3.3.drv-0/source/lineprof
    linked by target "surf2vol" in directory 
/tmp/guix-build-freesurfer-7.3.3.drv-0/source/fem_elastic
LAPACK_LIBRARIES
    linked by target "lineprof_test" in directory 
/tmp/guix-build-freesurfer-7.3.3.drv-0/source/lineprof
    linked by target "surf2vol" in directory 
/tmp/guix-build-freesurfer-7.3.3.drv-0/source/fem_elastic
```
    How am i supposed to let the build system know these variables? As the 
files are there i would
    have expected cmake to pick those up itself


thanks in advance for any help :-)
Malte

Attachment: ymdp15kmccal02aaaqq0ck9qp6s9dc-freesurfer-7.3.3.drv.gz
Description: application/gzip

_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is 
addressed.  If you believe this e-mail was sent to you in error and the e-mail 
contains patient information, please contact the Mass General Brigham 
Compliance HelpLine at https://www.massgeneralbrigham.org/complianceline 
<https://www.massgeneralbrigham.org/complianceline> .
Please note that this e-mail is not secure (encrypted).  If you do not wish to 
continue communication over unencrypted e-mail, please notify the sender of 
this message immediately.  Continuing to send or respond to e-mail after 
receiving this message means you understand and accept this risk and wish to 
continue to communicate over unencrypted e-mail. 

Reply via email to