Re: [micro-manager-general] please add missing .la files to FreeImage and FreeImagePlus build
Status: Beta
Brought to you by:
nicost
|
From: Nico S. <ni...@cm...> - 2011-11-15 23:05:38
|
On Nov 15, 2011, at 2:21 PM, Stefan Schoenleitner wrote:
> when working with SimpleCam/gphoto, I discovered that in
> 3rdpartypublic/FreeImage there are no libfreeimage.la and
> libfreeimageplus.la files when the FreeImage build completes.
Correct me if I am wrong, but those libtool files are platform dependent and you will need to generate these yourself if you need them.
> Since the micro-manager building code heavily relies on libtool, some
> linking issues arise if these files are missing.
> For instance, in DeviceAdapters/SimpleCam/Makefile.am, the FreeImage
> libraries are correctly added to the build process with:
>
> ------------------------------------------------
> libmmgr_dal_GPhoto_la_LIBADD += $(LIBFREEIMAGE)
> ------------------------------------------------
>
> However, since there are no .la files, $(LIBFREEIMAGE) is empty and the
> resulting .so file misses the dependencies to the FreeImage libraries.
> Thus, even through the .so file builds just fine, loading the file will
> ultimately fail with unresolved symbols.
>
> The solution is to either add .la file generation so freeImage, or
> link code like SimpleCam statically with:
>
> ------------------------------------------------
> libmmgr_dal_GPhoto_la_LIBADD += /usr/local/lib/libfreeimage.a
> libmmgr_dal_GPhoto_la_LIBADD += /usr/local/lib/libfreeimageplus.a
> ------------------------------------------------
>
> Obviously, the latter option is not a good choice since, apart from the
> static linking, it relies on fixed file locations.
DeviceAdapter2/configure.in contains the following:
AC_FIND_FILE([libfreeimage.a], [/usr/lib /usr/lib64 /usr/local/$ARCH/lib], FREEIMAGELIBDIR)
if test x$FREEIMAGELIBDIR = xNO; then
buildsc=false
AC_MSG_RESULT(["libfreeimage.a" not found...])
else
AC_MSG_RESULT(["libfreeimage.a" found])
AC_SUBST(LIBFREEIMAGE, "$FREEIMAGELIBDIR/libfreeimage.a")
AC_SUBST(LIBFREEIMAGE_CXXFLAGS, "-I../../../3rdpartypublic/FreeImage/Dist -I../../../3rdpartypublic/FreeImage/Wrapper/FreeImagePlus ")
fi
So, as long as you have a libfreeimage.a in /usr/lib, /usr/lib64, or /usr/local/$ARCH/lib, then the variable LIBFREEIMAGE should be set up correctly for static linking.
I really prefer static linking on the Mac, since this ensures that everything is where it should be. If you want things differently on Linux, send me a patch (that should not break things on the Mac).
Best,
Nico
|