gphoto / libgphoto2

The libgphoto2 camera access and control library.
GNU Lesser General Public License v2.1
1.03k stars 324 forks source link

How to cross-compile libgphoto2 (to aarch64 on Ubuntu/Debian)? #1032

Open axxel opened 1 week ago

axxel commented 1 week ago

I'm trying to cross-compile to aarch64. I installed crossbuild-essential-arm64 and now have a working compiler and toolchain, meaning I can compile a hello-world program and run it happily.

Next step was

configure --build x86_64-pc-linux-gnu --host aarch64-linux-gnu --enable-mpers=check
    --disable-nls --without-jpeg --with-libxml-2.0=no --with-libexif=no --with-libcurl=no --with-gdlib=no
    --disable-serial --with-camlibs=ptp2
    --disable-shared --enable-static  CFLAGS="-g"

trying to make it as easy as possible by removing all unnecessary dependencies. configure fails with the following error:

configure: error: 
libgphoto2 requires libltdl (a part of libtool)

Why is libltdl still required if I --disable-shared?

I'd appreciate any hints towards either:

Maybe @ndim or @hfiguiere have some relevant insights?

ndim commented 6 days ago

Whether you build libgphoto2 and libgphoto2_port as a static or as a dynamic library makes no difference here. They both unconditionally use libltdl to dynamically load camlibs (camera drivers) or iolibs (port drivers), respectively.

axxel commented 6 days ago

Thanks for the clarification. Maybe the real question is: why? What is the use case for having a static build that still loads dlls at runtime?

Is there maybe some "hack" that could be applied to the build system to link those symbols statically into the library?

ndim commented 6 days ago

The variables to set for building with your custom libltdl:

$ ./configure --help | grep -i ltdl
  LTDLINCL    CFLAGS for compiling with libltdl
  LIBLTDL     LIBS to add for linking against libltdl
$ _