libpng doesn't build as shared library: inter-library deps

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
mariuszp
Member
Member
Posts: 587
Joined: Sat Oct 16, 2010 3:38 pm

libpng doesn't build as shared library: inter-library deps

Post by mariuszp »

I pass the --disable-static option when cross-compling libpng for my OS, but regardless, it build only the static library. During linking, libtool prints the following message:

Code: Select all

/bin/bash ./libtool  --tag=CC   --mode=link x86_64-glidix-gcc  -g -O2 -no-undefined -export-dynamic -version-number 16:21:0  -Wl,--version-script=libpng.vers   -o libpng16.la -rpath /usr/lib png.lo pngerror.lo pngget.lo pngmem.lo pngpread.lo pngread.lo pngrio.lo pngrtran.lo pngrutil.lo pngset.lo pngtrans.lo pngwio.lo pngwrite.lo pngwtran.lo pngwutil.lo    -lz -lm 

*** Warning: inter-library dependencies are not known to be supported.
*** All declared inter-library dependencies are being dropped.
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.

*** Since this library must not contain undefined symbols,
*** because either the platform does not support them or
*** it was explicitly requested with -no-undefined,
*** libtool will only create a static version of it.
Why does it think inter-library dependencies are not supported? And why is it passing -no-undefined anyway?

Is there any way I can configure it to know that inter-library dependencies work on my OS and therefore it can build the shared library?

EDIT: I have also edited the "configure" script, specifically the part that decides whether a dynamic linker is available (otherwise it complains that one doesn't exist, and decides that building shared libs is impossible), by adding the following rule:

Code: Select all

glidix*)
  version_type=linux
  need_lib_prefix=no
  need_version=no
  library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
  dynamic_linker='Glidix dynld'
  shlibpath_var=LD_LIBRARY_PATH
  shlibpath_overrides_runpath=yes
  hardcode_into_libs=yes
  ;;
I set "version_type" to linux because a lot of rules for different operating systems had that.
Do I perhaps have to set something here? Or is it elsewhere?
klange
Member
Member
Posts: 679
Joined: Wed Mar 30, 2011 12:31 am
Libera.chat IRC: klange
Discord: klange

Re: libpng doesn't build as shared library: inter-library de

Post by klange »

Hey mariuszp, I just ran into this same issue trying to build freetype and I think I've got a solution for you: There's a lot more places you'll need to tell libtool about your OS's dynamic linking. I was reading through some patches in Pedigree to see what was happening there. You can install your own libtool with a patched libtool.m4 (with all of those patches) and re-run autoconf and libtoolize on the package and it should work, or edit the relevant configure script directly (probably the same one you already edited).
mariuszp
Member
Member
Posts: 587
Joined: Sat Oct 16, 2010 3:38 pm

Re: libpng doesn't build as shared library: inter-library de

Post by mariuszp »

Yeah, i just figured out i can do this by editing the configure script. Thanks for trlling me about libtool.m4 though, i will patch that to avoid repeating the process constantly later.
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: libpng doesn't build as shared library: inter-library de

Post by max »

Sorry for digging out this old thread :P

Unfortunately the patch you linked @klange is no longer there.. I'm facing the same issue, when building libpng it says:

Code: Select all

    checking if libtool supports shared libraries... no
    checking whether to build shared libraries... no
Therefore I don't get any .so files generated. I've configured it simply with --host=i686-ghost and patched the config.sub to accept my system type. But how must I edit the libtool config so it understands how to link for my OS?

Thanks in advance!!

EDIT: Tried it by editing the configure file by hand, this works.. but what would be the autoconf way of achieving this?
Korona
Member
Member
Posts: 1000
Joined: Thu May 17, 2007 1:27 pm
Contact:

Re: libpng doesn't build as shared library: inter-library de

Post by Korona »

Here is a working patch: https://github.com/managarm/bootstrap-m ... tics.patch. The same dir also has a patch that fixes libtool's --with-sysroot that I highly recommend to avoid problems where host libs get linked into target binaries.

Patch libtool and autoreconf the target package. Usually, there is a autogen.sh script to call autoreconf for you. You can also look at Managarm's bootstrap.yml for libpng's build process in particular: https://github.com/managarm/bootstrap-m ... p.yml#L969.
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: libpng doesn't build as shared library: inter-library de

Post by max »

Hey Korona,

very nice thanks for the links. Maybe we could add this somewhere to the OSDev wiki if someones looking for it.

Greets
Korona
Member
Member
Posts: 1000
Joined: Thu May 17, 2007 1:27 pm
Contact:

Re: libpng doesn't build as shared library: inter-library de

Post by Korona »

Feel free to steal my libtool patch (under any license of your choice) and add info on how use it to the wiki!
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].
Post Reply