OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 8:34 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: libpng doesn't build as shared library: inter-library deps
PostPosted: Tue Nov 29, 2016 3:37 pm 
Offline
Member
Member

Joined: Sat Oct 16, 2010 3:38 pm
Posts: 587
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:
/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:
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?


Top
 Profile  
 
 Post subject: Re: libpng doesn't build as shared library: inter-library de
PostPosted: Fri Dec 02, 2016 2:09 am 
Offline
Member
Member

Joined: Wed Mar 30, 2011 12:31 am
Posts: 676
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).

_________________
toaruos on github | toaruos.org | gitlab | twitter | bim - a text editor


Top
 Profile  
 
 Post subject: Re: libpng doesn't build as shared library: inter-library de
PostPosted: Fri Dec 02, 2016 4:56 am 
Offline
Member
Member

Joined: Sat Oct 16, 2010 3:38 pm
Posts: 587
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.


Top
 Profile  
 
 Post subject: Re: libpng doesn't build as shared library: inter-library de
PostPosted: Tue Feb 18, 2020 3:38 am 
Offline
Member
Member
User avatar

Joined: Mon Mar 05, 2012 11:23 am
Posts: 616
Location: Germany
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:
    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?

_________________
Ghost OS - GitHub


Top
 Profile  
 
 Post subject: Re: libpng doesn't build as shared library: inter-library de
PostPosted: Wed Feb 19, 2020 12:31 am 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 999
Here is a working patch: https://github.com/managarm/bootstrap-managarm/blob/master/patches/libtool/0002-Fill-in-managarm-characteristics.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-managarm/blob/master/bootstrap.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].


Top
 Profile  
 
 Post subject: Re: libpng doesn't build as shared library: inter-library de
PostPosted: Wed Feb 19, 2020 10:13 am 
Offline
Member
Member
User avatar

Joined: Mon Mar 05, 2012 11:23 am
Posts: 616
Location: Germany
Hey Korona,

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

Greets

_________________
Ghost OS - GitHub


Top
 Profile  
 
 Post subject: Re: libpng doesn't build as shared library: inter-library de
PostPosted: Wed Feb 19, 2020 11:21 am 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 999
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].


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 187 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group