|
Hi,
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. 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. Regards, Stefan ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ micro-manager-general mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/micro-manager-general |
|
Administrator
|
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 ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ micro-manager-general mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/micro-manager-general |
|
On 11/16/2011 12:05 AM, Nico Stuurman wrote:
> > 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. Yes, they are platform dependent, but AFAIK they can be generated through the build process. Thus when building FreeImage, you would for instance run ./configure which configures all the platform dependent stuff. Once you run "make", it should also generate the .la files based on the information from configure and related tools. The code responsible for this would have to be in the Makefile. > 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. Hmm ok, that's the problem in my case. All my custom libs are in /usr/local/lib. I don't have a /usr/local/$ARCH/ on my Ubuntu system. Maybe adding /usr/local/lib would be an idea ? AFAIK on Linux systems, there usually is no /usr/local/$ARCH. Instead, all content that is not managed through the package management system is just installed to /usr/local. So libraries would end up in /usr/local/lib. However, I can only speak for debian based systems. Maybe on other distributions it is different, I don't know. > 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). Well, as long as it works, I can go with the statically linked version. But if it's ok with you, I would like to add /usr/local/lib to configure.in. After all, it can't do any harm if it's there and things like java also contain /usr/local/* (without $ARCH) in their search path. If you accept this solution, I can prepare a patch. Regards, Stefan ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ micro-manager-general mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/micro-manager-general |
| Powered by Nabble | See how NAML generates this page |
