[Insight-developers] linking error under linux and mac

Richard Beare richard.beare at gmail.com
Mon Jun 28 22:02:11 EDT 2010


Hi,
I'm getting the following error with the latest version of itksnap
from cvs. (Note this is an unmodified version).

Under Linux:

Linking CXX executable InsightSNAP
/usr/bin/cmake -E cmake_link_script
CMakeFiles/InsightSNAP.dir/link.txt --verbose=1
/usr/bin/c++     -ftemplate-depth-50 -Wall -Wno-deprecated -msse2
-Wno-deprecated
CMakeFiles/InsightSNAP.dir/UserInterface/SNAPMain.cxx.o  -o
InsightSNAP -rdynamic -L/usr/local/ITK-3.18/lib/InsightToolkit
-L/usr/local/VTK-5.4.2/lib/vtk-5.4 -lITKAlgorithms -lITKCommon
-lITKBasicFilters
Utilities/FLTK/Fl_Native_File_Chooser/libfltk_native_file_chooser.a
libitksnapui.a libitksnaplogic.a
/usr/local/fltk-1.1.9/lib/libfltk_images.a -lpng -lz -ljpeg
/usr/local/fltk-1.1.9/lib/libfltk.a
/usr/local/fltk-1.1.9/lib/libfltk_gl.a
/usr/local/fltk-1.1.9/lib/libfltk_forms.a -lSM -lICE -lX11 -lXext -lm
-lITKIO -lvtkCommon -lvtkRendering -lvtkFiltering -lvtkGraphics
-lvtkImaging -lvtkIO -lGLU -lGL -lSM -lICE -lX11 -lXext -lGLU
Utilities/FLTK/Fl_Table/libfltk_table.a -lITKNrrdIO -litkgdcm
-litkjpeg12 -litkjpeg16 -litkopenjpeg -luuid -litkpng -litktiff
-litkjpeg8 -lITKSpatialObject -lITKMetaIO -lITKDICOMParser -lITKEXPAT
-lITKniftiio -lITKznz -litkzlib -lvtkftgl -lvtkfreetype -lXt -lXft
-lvtkverdict -lvtkFiltering -lvtkCommon -lvtkDICOMParser -lvtkNetCDF
-lvtkmetaio -lvtksqlite -lvtkpng -lvtktiff -lvtkzlib -lvtkjpeg
-lvtkexpat -lvtksys -lSM -lICE -lX11 -lXext -lGL -lITKAlgorithms
-lITKStatistics -litkNetlibSlatec -lITKNumerics -lITKBasicFilters
-lITKCommon -litkvnl_inst -litkvnl_algo -litkv3p_netlib -litkvnl
-litkvcl -litkv3p_lsqr -lm -litksys -lpthread -ldl -lm
-Wl,-rpath,/usr/local/ITK-3.18/lib/InsightToolkit:/usr/local/VTK-5.4.2/lib/vtk-5.4
Utilities/FLTK/Fl_Table/libfltk_table.a(Fl_Table.cxx.o): In function
`Fl_Table::Fl_Table(int, int, int, int, char const*)':
Fl_Table.cxx:(.text+0x4480): undefined reference to
`Fl_Scroll::Fl_Scroll(int, int, int, int, char const*)'
Utilities/FLTK/Fl_Table/libfltk_table.a(Fl_Table.cxx.o): In function
`Fl_Table::Fl_Table(int, int, int, int, char const*)':
Fl_Table.cxx:(.text+0x4a52): undefined reference to
`Fl_Scroll::Fl_Scroll(int, int, int, int, char const*)'
collect2: ld returned 1 exit status


Which I fix by changing the library order so that libfltk_table is
immediately prior to libfltk:

/usr/bin/c++     -ftemplate-depth-50 -Wall -Wno-deprecated -msse2
-Wno-deprecated
CMakeFiles/InsightSNAP.dir/UserInterface/SNAPMain.cxx.o  -o
InsightSNAP -rdynamic -L/usr/local/ITK-3.18/lib/InsightToolkit
-L/usr/local/VTK-5.4.2/lib/vtk-5.4 -lITKAlgorithms -lITKCommon
-lITKBasicFilters
Utilities/FLTK/Fl_Native_File_Chooser/libfltk_native_file_chooser.a
libitksnapui.a libitksnaplogic.a
/usr/local/fltk-1.1.9/lib/libfltk_images.a -lpng -lz -ljpeg
Utilities/FLTK/Fl_Table/libfltk_table.a
/usr/local/fltk-1.1.9/lib/libfltk.a
/usr/local/fltk-1.1.9/lib/libfltk_gl.a
/usr/local/fltk-1.1.9/lib/libfltk_forms.a -lSM -lICE -lX11 -lXext -lm
-lITKIO -lvtkCommon -lvtkRendering -lvtkFiltering -lvtkGraphics
-lvtkImaging -lvtkIO -lGLU -lGL -lSM -lICE -lX11 -lXext -lGLU
Utilities/FLTK/Fl_Table/libfltk_table.a -lITKNrrdIO -litkgdcm
-litkjpeg12 -litkjpeg16 -litkopenjpeg -luuid -litkpng -litktiff
-litkjpeg8 -lITKSpatialObject -lITKMetaIO -lITKDICOMParser -lITKEXPAT
-lITKniftiio -lITKznz -litkzlib -lvtkftgl -lvtkfreetype -lXt -lXft
-lvtkverdict -lvtkFiltering -lvtkCommon -lvtkDICOMParser -lvtkNetCDF
-lvtkmetaio -lvtksqlite -lvtkpng -lvtktiff -lvtkzlib -lvtkjpeg
-lvtkexpat -lvtksys -lSM -lICE -lX11 -lXext -lGL -lITKAlgorithms
-lITKStatistics -litkNetlibSlatec -lITKNumerics -lITKBasicFilters
-lITKCommon -litkvnl_inst -litkvnl_algo -litkv3p_netlib -litkvnl
-litkvcl -litkv3p_lsqr -lm -litksys -lpthread -ldl -lm
-Wl,-rpath,/usr/local/ITK-3.18/lib/InsightToolkit:/usr/local/VTK-5.4.2/lib/vtk-5.4



On the mac I had fltk link errors with jpeg and png libraries and need
to explicitly include libfltk_png and libfltk_jpeg in the link options
with cmake.


More information about the Insight-developers mailing list