BIC-MNI / minc-tools

Basic minc-tools from former minc repository
Other
30 stars 25 forks source link

FL_LIBRARY not found #14

Closed PaulMougel closed 10 years ago

PaulMougel commented 10 years ago

I'm trying to install minc-tools but unfortunately the configuration process fails. The FL_LIBRARY variable is NOTFOUND, even if the configure script says that it found Flex on the system:

-- Found BISON: /usr/bin/bison (found version "2.3") 
-- Found FLEX: /usr/bin/flex (found version "2.5.35") 
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:
FL_LIBRARY (ADVANCED)
    linked by target "minccalc" in directory /Volumes/Mac/Utilisateurs/pmougel/tmp/minc-tools/progs
    linked by target "mincgen" in directory /Volumes/Mac/Utilisateurs/pmougel/tmp/minc-tools/progs

You can find the full log in this gist, including the commands I ran on the terminal.

I'm on a Mac, and FLEX was installed using homebrew, while libminc was installed from source without any issue.

I am not very experienced with CMake, does anyone have debugging clues? (cc-ing @AldoMarzullo who has the same issue on Fedora).

vfonov commented 10 years ago

cmake can't find libfl.a , maybe you need to install separate package in homebrew?

I am using macports , libfl.a is included in flex package there.

By the way, do you know that we have pre-build binary packages for MacOS X here: http://www.bic.mni.mcgill.ca/ServicesSoftware/ServicesSoftwareMincToolKit ?

PaulMougel commented 10 years ago

Unfortunately there isn't any other package in homebrew for FLEX, maybe the main flex package was badly packaged I don't know.

For some reason I didn't find the webpage you mentioned and only thought about compiling from source… Thanks a lot, now everything works :+1: !

I however encountered a small issue with the binary build, here's how I fixed it:


I downloaded and installed the binaries, added the install directory to my PATH:

export PATH=$PATH:/opt/minc/bin

but for some reason the tools didn't find the libminc2 library:

$ nii2mnc test.nii
dyld: Library not loaded: libminc2.3.0.0.dylib
  Referenced from: /opt/minc/bin/nii2mnc
  Reason: image not found

I then tried to re-install libminc2 and changing the installation directory (in the configuration step of ccmake) to /opt/minc:

 CMAKE_INSTALL_PREFIX             /opt/minc                                                                                                                  

… but that didn't change anything.

Following this StackOverflow anwser, I patched the binary to load the correct library:

$ otool -L /opt/minc/bin/nii2mnc
/opt/minc/bin/nii2mnc:
    libminc2.3.0.0.dylib (compatibility version 3.0.0, current version 2.3.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
$ install_name_tool -change libminc2.3.0.0.dylib /opt/minc/lib/libminc2.3.0.0.dylib /opt/minc/bin/nii2mnc
$ otool -L /opt/minc/bin/nii2mnc
/opt/minc/bin/nii2mnc:
    /opt/minc/lib/libminc2.3.0.0.dylib (compatibility version 3.0.0, current version 2.3.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)

And now the software works correctly! (I don't know if what I did is the correct and clean way to fix the issue however…)

amarzullo24 commented 10 years ago

I have the same problem, but I'm using fedora 20: I downloaded the binaries but during the installation I have an error (this is my stacktrace):

[aldo @ localhost Downloads] $ su c "yum install minc.rpm" password: Enabled plugins: langpacks Analysis of minc.rpm: minc-toolkit-1.0.01-1.x86_64 minc.rpm marked for installation Resolution dependencies -> Running transaction check ---> Package minc-toolkit.x86_64 0: 1.0.01-1 set to be installed -> Dependency Resolution completed

dependencies resolved

Package Arch Version Repository Size.

installation: minc-toolkit 1.0.01-1 x86_64 / minc 215 M

Summary of the transaction

Install 1 Package

Total Size: 215 M Installed size: 215 M Is this ok [y / d / N]: y Downloading packages: Running transaction check Running test transaction

Transaction check error:   the file / opt install minc-toolkit-1.0.01-1.x86_64 conflicts with the package file filesystem-3.2-19.fc20.x86_64

summary errors

vfonov commented 10 years ago

Hmm.... never tried on fedora, works fine on CentOS

vfonov commented 10 years ago

for the shared libraries to work properly - "source /opt/minc/minc-toolkit-config.sh"

PaulMougel commented 10 years ago

Indeed! This is way better than monkey patching the binary, seems like I need to learn to RTFM.

We'll have to understand why the CentOS RPM fails on Fedora, I don't know if we can resolve the conflict with the filesystem package without rebuilding a new RPM.

vfonov commented 10 years ago

So, I fixed missing FL_LIBRARY on Fedora, and the issue with conflict of /opt. I pushed changes into the source code, but didn't rebuild packages for CentOS.

I build package for minc-toolkit-1.0 for Fedora 20 64 bit: http://packages.bic.mni.mcgill.ca/minc-toolkit/RPM/minc-toolkit-1.0.03-20140603-Fedora_20-x86_64.rpm it should install without problem. You can also install package for CentOS using rpm --install --force

amarzullo24 commented 10 years ago

It works! Thank you so much!

PaulMougel commented 10 years ago

Awesome, thanks a lot @vfonov for this very quick fix.