vfonov / Convert3D

Convert3D from http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Downloads with changes from BIC, updated to ITKv5
GNU General Public License v3.0
4 stars 2 forks source link

fftw link order error on develop-1.9.1{7,8} with cmake 3.17.2 #1

Open gdevenyi opened 4 years ago

gdevenyi commented 4 years ago

Doing a bare cmake ../minc-toolkit-v2 always fails on c3d build with the following (Ubuntu 18.04):

[ 94%] Linking CXX executable c2d
/home/gdevenyi/projects/software/minc-toolkit-v2-build/external/usr/local/lib/libfftw3f_threads.a(threads.c.o): In function `fftwf_threads_register_planner_hooks':
threads.c:(.text+0x6d2): undefined reference to `fftwf_set_planner_hooks'
collect2: error: ld returned 1 exit status
CMakeFiles/c2d.dir/build.make:289: recipe for target 'c2d' failed
make[5]: *** [c2d] Error 1
CMakeFiles/Makefile2:529: recipe for target 'CMakeFiles/c2d.dir/all' failed
make[4]: *** [CMakeFiles/c2d.dir/all] Error 2
Makefile:182: recipe for target 'all' failed
make[3]: *** [all] Error 2
CMakeFiles/C3D.dir/build.make:133: recipe for target 'C3D-prefix/src/C3D-stamp/C3D-build' failed
make[2]: *** [C3D-prefix/src/C3D-stamp/C3D-build] Error 2
CMakeFiles/Makefile2:2039: recipe for target 'CMakeFiles/C3D.dir/all' failed
make[1]: *** [CMakeFiles/C3D.dir/all] Error 2
Makefile:182: recipe for target 'all' failed
make: *** [all] Error 2

Which leads me to: https://github.com/FFTW/fftw3/issues/172

and this snip from the make VERBOSE=1

/home/gdevenyi/projects/software/minc-toolkit-v2-build/external/usr/local/lib/libfftw3.a /home/gdevenyi/projects/software/minc-toolkit-v2-build/external/usr/local/lib/libfftw3_threads.a /home/gdevenyi/projects/software/minc-toolkit-v2-build/external/usr/local/lib/libfftw3f.a /home/gdevenyi/projects/software/minc-toolkit-v2-build/external/usr/local/lib/libfftw3f_threads.a

Which I think is the wrong order?

For some reason the linker config has doubled the fftw entries, and they appear to be in the "wrong" order.

vfonov commented 4 years ago

looks like it

gdevenyi commented 4 years ago

Do you have any suggestions as to where to investigate this further?

vfonov commented 4 years ago

maybe just disable c2d for now?

gdevenyi commented 1 year ago

Has for now been long enough here? I'm cleaning up minc-toolkit-v2 to build with clang-17, which has resolved many hidden bugs, but I can't figure out this one.

vfonov commented 1 year ago

strangely, I never experience this bug on my builds

gdevenyi commented 1 year ago

I'll put together a reproducer in a docker

gdevenyi commented 1 year ago

This dockerfile reproduces the issue

from ubuntu:latest

RUN apt update && apt-get install --no-install-recommends \
 build-essential g++ gfortran bc \
 cmake \
 bison flex \
 libx11-dev x11proto-core-dev \
 libxi6 libxi-dev \
 libxmu6 libxmu-dev libxmu-headers \
 libgl1-mesa-dev libglu1-mesa-dev \
 libjpeg-dev libxcb-xkb-dev git ca-certificates -y

RUN git clone --recursive --branch release-1.9.18.3 https://github.com/BIC-MNI/minc-toolkit-v2.git

RUN mkdir minc-build && cd minc-build && cmake ../minc-toolkit-v2 && make
7619.6 /usr/bin/ld: /minc-build/external/usr/local/lib/libfftw3f_threads.a(threads.c.o): in function `fftwf_threads_register_planner_hooks':
7619.6 threads.c:(.text+0x722): undefined reference to `fftwf_set_planner_hooks'
7619.6 collect2: error: ld returned 1 exit status
7619.6 make[5]: *** [CMakeFiles/c3d.dir/build.make:285: c3d] Error 1
7619.6 make[4]: *** [CMakeFiles/Makefile2:257: CMakeFiles/c3d.dir/all] Error 2
7619.6 make[3]: *** [Makefile:166: all] Error 2
7619.6 make[2]: *** [CMakeFiles/C3D.dir/build.make:86: C3D-prefix/src/C3D-stamp/C3D-build] Error 2
7619.6 make[1]: *** [CMakeFiles/Makefile2:3364: CMakeFiles/C3D.dir/all] Error 2
7619.6 make: *** [Makefile:166: all] Error 2
vfonov commented 1 year ago

Once i am back from vacation...

vfonov commented 1 year ago

ok, fixed in https://github.com/BIC-MNI/minc-toolkit-v2/releases/tag/release-1.9.18.4