]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Fix shared library support on Android.
authorBruno Haible <bruno@clisp.org>
Mon, 18 Sep 2023 10:47:08 +0000 (12:47 +0200)
committerIleana Dumitrescu <ileanadumitrescu95@gmail.com>
Mon, 15 Jan 2024 20:58:56 +0000 (22:58 +0200)
This patch fixes two problems:
1) A libtool library created with the -release option and no -version-info
   option was, when built with --enable-shared, installed without the
   symlink libNAME.so -> libNAME-RELEASE.so. This led to subsequent failures
   during "make install" of shared libraries that depend on it.
2) Executables were created without a RUNPATH property. These executables
   then did not find their shared libraries when run.

* m4/libtool.m4: On Android, fix library_names_spec and
hardcode_libdir_flag_spec.

m4/libtool.m4

index 695ccac4dfa2ca17be9f0bdcf41066d86521ff91..20d2c3ab36f0255e151902813dc787caeb151148 100644 (file)
@@ -2839,7 +2839,7 @@ linux*android*)
   version_type=none # Android doesn't support versioned libraries.
   need_lib_prefix=no
   need_version=no
-  library_names_spec='$libname$release$shared_ext'
+  library_names_spec='$libname$release$shared_ext $libname$shared_ext'
   soname_spec='$libname$release$shared_ext'
   finish_cmds=
   shlibpath_var=LD_LIBRARY_PATH
@@ -2851,8 +2851,9 @@ linux*android*)
   hardcode_into_libs=yes
 
   dynamic_linker='Android linker'
-  # Don't embed -rpath directories since the linker doesn't support them.
-  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+  # -rpath works at least for libraries that are not overridden by
+  # libraries installed in system locations.
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
   ;;
 
 # This must be glibc/ELF.