diff options
author | Gunnar Beutner <gunnar@beutner.name> | 2021-04-25 08:42:41 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-25 10:14:50 +0200 |
commit | 5b69e8d2c67cf9c05dac61393edaaa0a363993aa (patch) | |
tree | 3cccaade28a00bdc9a3cc2da4a80b7118ffd504c | |
parent | e6953d14d8e9f430e70071e23b6ad3f4f440d0de (diff) | |
download | serenity-5b69e8d2c67cf9c05dac61393edaaa0a363993aa.zip |
Ports: Build shared libraries with -Wl,-soname
Without a SONAME gcc will put the whole library path into executables
which link against these libraries:
$ readelf -d Root/usr/local/games/openttd
Dynamic section at offset 0xf0747c contains 32 entries:
Tag Type Name/Value
0x00000001 (NEEDED) [libgcc_s.so]
0x00000001 (NEEDED) [/serenity/Build/i686/Root/usr/local/lib/libpng.so]
0x00000001 (NEEDED) [/serenity/Build/i686/Root/usr/local/lib/libz.so]
0x00000001 (NEEDED) [/serenity/Build/i686/Root/usr/local/lib/liblzma.so]
0x00000001 (NEEDED) [libSDL2-2.0.so.1]
0x00000001 (NEEDED) [libicui18n.so.69]
0x00000001 (NEEDED) [libicuuc.so.69]
0x00000001 (NEEDED) [libicudata.so.69]
0x00000001 (NEEDED) [libpthread.so]
0x00000001 (NEEDED) [libm.so]
0x00000001 (NEEDED) [libc.so]
This causes the executable to fail because the dynamic linker
tries to find the library in the incorrect path.
-rwxr-xr-x | Ports/SDL2_gfx/package.sh | 2 | ||||
-rwxr-xr-x | Ports/SDL2_image/package.sh | 2 | ||||
-rwxr-xr-x | Ports/SDL2_mixer/package.sh | 2 | ||||
-rwxr-xr-x | Ports/SDL2_ttf/package.sh | 2 | ||||
-rwxr-xr-x | Ports/libiconv/package.sh | 2 | ||||
-rwxr-xr-x | Ports/libjpeg/package.sh | 2 | ||||
-rwxr-xr-x | Ports/libogg/package.sh | 2 | ||||
-rwxr-xr-x | Ports/libpng/package.sh | 2 | ||||
-rwxr-xr-x | Ports/libtiff/package.sh | 4 | ||||
-rwxr-xr-x | Ports/libvorbis/package.sh | 6 | ||||
-rwxr-xr-x | Ports/xz/package.sh | 2 | ||||
-rwxr-xr-x | Ports/zlib/package.sh | 2 |
12 files changed, 15 insertions, 15 deletions
diff --git a/Ports/SDL2_gfx/package.sh b/Ports/SDL2_gfx/package.sh index db2e54cc2d..7c5f0ca443 100755 --- a/Ports/SDL2_gfx/package.sh +++ b/Ports/SDL2_gfx/package.sh @@ -10,5 +10,5 @@ configopts="--with-sdl-prefix=${SERENITY_INSTALL_ROOT}/usr/local" install() { run make install DESTDIR=${SERENITY_INSTALL_ROOT} $installopts - run ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_gfx.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_gfx.a -Wl,--no-whole-archive + run ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_gfx.so -Wl,-soname,libSDL2_gfx.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_gfx.a -Wl,--no-whole-archive } diff --git a/Ports/SDL2_image/package.sh b/Ports/SDL2_image/package.sh index ac75b670c6..84059ffc84 100755 --- a/Ports/SDL2_image/package.sh +++ b/Ports/SDL2_image/package.sh @@ -20,6 +20,6 @@ build() { install() { run make -k DESTDIR="${SERENITY_INSTALL_ROOT}" install - ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_image.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_image.a -Wl,--no-whole-archive -lpng -ljpeg -ltiff + ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_image.so -Wl,-soname,libSDL2_image.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_image.a -Wl,--no-whole-archive -lpng -ljpeg -ltiff rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_image.la } diff --git a/Ports/SDL2_mixer/package.sh b/Ports/SDL2_mixer/package.sh index f8666cb83a..bdbfa994d5 100755 --- a/Ports/SDL2_mixer/package.sh +++ b/Ports/SDL2_mixer/package.sh @@ -21,6 +21,6 @@ build() { install() { run make -k DESTDIR="${SERENITY_INSTALL_ROOT}" install - ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_mixer.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_mixer.a -Wl,--no-whole-archive -Wl,--no-as-needed -lvorbis -lvorbisfile + ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_mixer.so -Wl,-soname,libSDL2_mixer.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_mixer.a -Wl,--no-whole-archive -Wl,--no-as-needed -lvorbis -lvorbisfile rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_mixer.la } diff --git a/Ports/SDL2_ttf/package.sh b/Ports/SDL2_ttf/package.sh index d6d855fb08..f554968529 100755 --- a/Ports/SDL2_ttf/package.sh +++ b/Ports/SDL2_ttf/package.sh @@ -17,5 +17,5 @@ configure() { install() { run make install DESTDIR=${SERENITY_INSTALL_ROOT} $installopts - run ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_ttf.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_ttf.a -Wl,--no-whole-archive + run ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_ttf.so -Wl,-soname,libSDL2_ttf.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_ttf.a -Wl,--no-whole-archive } diff --git a/Ports/libiconv/package.sh b/Ports/libiconv/package.sh index cf52c41be0..8080c89fa9 100755 --- a/Ports/libiconv/package.sh +++ b/Ports/libiconv/package.sh @@ -12,5 +12,5 @@ auth_opts="--keyring ./gnu-keyring.gpg libiconv-${version}.tar.gz.sig" install() { run make DESTDIR=${SERENITY_INSTALL_ROOT} $installopts install - run ${SERENITY_ARCH}-pc-serenity-gcc -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libiconv.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libiconv.a -Wl,--no-whole-archive + run ${SERENITY_ARCH}-pc-serenity-gcc -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libiconv.so -Wl,-soname,libiconv.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libiconv.a -Wl,--no-whole-archive } diff --git a/Ports/libjpeg/package.sh b/Ports/libjpeg/package.sh index fd17c70dd8..eaec025364 100755 --- a/Ports/libjpeg/package.sh +++ b/Ports/libjpeg/package.sh @@ -8,6 +8,6 @@ workdir="jpeg-$version" install() { run make DESTDIR=${SERENITY_INSTALL_ROOT} $installopts install - ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libjpeg.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libjpeg.a -Wl,--no-whole-archive + ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libjpeg.so -Wl,-soname,libjpeg.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libjpeg.a -Wl,--no-whole-archive rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/libjpeg.la } diff --git a/Ports/libogg/package.sh b/Ports/libogg/package.sh index f5147049b6..a79f23b1fd 100755 --- a/Ports/libogg/package.sh +++ b/Ports/libogg/package.sh @@ -7,6 +7,6 @@ auth_type=md5 install() { run make DESTDIR=${SERENITY_INSTALL_ROOT} $installopts install - ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libogg.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libogg.a -Wl,--no-whole-archive + ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libogg.so -Wl,-soname,libogg.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libogg.a -Wl,--no-whole-archive rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/libogg.la } diff --git a/Ports/libpng/package.sh b/Ports/libpng/package.sh index c5b669ffe8..8640ce2e9b 100755 --- a/Ports/libpng/package.sh +++ b/Ports/libpng/package.sh @@ -8,7 +8,7 @@ depends="zlib" install() { run make DESTDIR=${SERENITY_INSTALL_ROOT} $installopts install - ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libpng16.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libpng16.a -Wl,--no-whole-archive -lz + ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libpng16.so -Wl,-soname,libpng16.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libpng16.a -Wl,--no-whole-archive -lz ln -sf libpng16.so ${SERENITY_INSTALL_ROOT}/usr/local/lib/libpng.so rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/libpng16.la ${SERENITY_INSTALL_ROOT}/usr/local/lib/libpng.la } diff --git a/Ports/libtiff/package.sh b/Ports/libtiff/package.sh index bf802063c2..e6a9b351d0 100755 --- a/Ports/libtiff/package.sh +++ b/Ports/libtiff/package.sh @@ -11,7 +11,7 @@ depends="zstd xz" install() { run make DESTDIR=${SERENITY_INSTALL_ROOT} $installopts install - ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libtiff.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libtiff.a -Wl,--no-whole-archive -lzstd -llzma - ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libtiffxx.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libtiffxx.a -Wl,--no-whole-archive -lzstd -llzma + ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libtiff.so -Wl,-soname,libtiff.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libtiff.a -Wl,--no-whole-archive -lzstd -llzma + ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libtiffxx.so -Wl,-soname,libtiffxx.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libtiffxx.a -Wl,--no-whole-archive -lzstd -llzma rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/libtiff.la ${SERENITY_INSTALL_ROOT}/usr/local/lib/libtiffxx.la } diff --git a/Ports/libvorbis/package.sh b/Ports/libvorbis/package.sh index 37511b308c..fd08758474 100755 --- a/Ports/libvorbis/package.sh +++ b/Ports/libvorbis/package.sh @@ -8,10 +8,10 @@ depends=libogg install() { run make DESTDIR=${SERENITY_INSTALL_ROOT} $installopts install - ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libvorbis.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libvorbis.a -Wl,--no-whole-archive -logg + ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libvorbis.so -Wl,-soname,libvorbis.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libvorbis.a -Wl,--no-whole-archive -logg rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/libvorbis.la - ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libvorbisenc.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libvorbisenc.a -Wl,--no-whole-archive -lvorbis + ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libvorbisenc.so -Wl,-soname,libvorbisenc.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libvorbisenc.a -Wl,--no-whole-archive -lvorbis rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/libvorbisenc.la - ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libvorbisfile.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libvorbisfile.a -Wl,--no-whole-archive -lvorbis + ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libvorbisfile.so -Wl,-soname,libvorbisfile.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libvorbisfile.a -Wl,--no-whole-archive -lvorbis rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/libvorbisfile.la } diff --git a/Ports/xz/package.sh b/Ports/xz/package.sh index d9f753fd28..cb6f56b712 100755 --- a/Ports/xz/package.sh +++ b/Ports/xz/package.sh @@ -8,6 +8,6 @@ depends="zlib libiconv" install() { run make DESTDIR=${SERENITY_INSTALL_ROOT} $installopts install - ${CC} -pthread -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/liblzma.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/liblzma.a -Wl,--no-whole-archive -lz -liconv + ${CC} -pthread -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/liblzma.so -Wl,-soname,liblzma.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/liblzma.a -Wl,--no-whole-archive -lz -liconv rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/liblzma.la } diff --git a/Ports/zlib/package.sh b/Ports/zlib/package.sh index af2c8fe6ca..134336df01 100755 --- a/Ports/zlib/package.sh +++ b/Ports/zlib/package.sh @@ -15,6 +15,6 @@ configure() { install() { run make DESTDIR=${SERENITY_INSTALL_ROOT} $installopts install - ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libz.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libz.a -Wl,--no-whole-archive + ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libz.so -Wl,-soname,libz.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libz.a -Wl,--no-whole-archive rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/libz.la } |