Fix install names of shared libraries under macOS This commit corresponds to the changes previously done in 3.2 branch in 65ad6849d1 (Fix install names of macOS shared libraries, 2025-02-19) and 30c0f6a675 (Fix readlink problem in configure build under macOS < 12, 2025-08-02) and should ensure that we always set the install names correctly. See #24524, #25173, #25182, #25675.
Fix test for .symver asm directive support in configure We need to use it with the correct, i.e. existing, symbol name, which means the mangled name actually used by the linker and not just the name of the function as it appears in the source. Fix the test to actually detect lack of support for .symver when using clang with -flto. This commit is the same as f2b844307d (Fix test for .symver asm directive support in configure, 2025-05-25) in 3.2 branch. See #25438.
... | ... | @@ -31839,18 +31839,26 @@ if ${wx_cv_elf_symver_multiple+:} false; then : |
31839 | 31839 | else
|
31840 | 31840 | |
31841 | 31841 | echo "lib_new {}; lib_old { *; };" >conftest.sym
|
31842 | + ac_ext=cpp
|
|
31843 | +ac_cpp='$CXXCPP $CPPFLAGS'
|
|
31844 | +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
|
31845 | +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
|
31846 | +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
|
31847 | + |
|
31842 | 31848 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
31843 | 31849 | /* end confdefs.h. */
|
31844 | 31850 | |
31845 | 31851 | |
31846 | 31852 | #include "wx/private/elfversion.h"
|
31847 | - wxELF_SYMVER("foo","foo@lib_old")
|
|
31848 | - wxELF_SYMVER("foo","foo@@lib_new")
|
|
31853 | + extern "C" {
|
|
31854 | + wxELF_SYMVER("_foo","_foo@lib_old")
|
|
31855 | + wxELF_SYMVER("_foo","_foo@@lib_new")
|
|
31849 | 31856 | void foo() {}
|
31857 | + }
|
|
31850 | 31858 | int main() { return 0; }
|
31851 | 31859 | |
31852 | 31860 | _ACEOF
|
31853 | -if ac_fn_c_try_link "$LINENO"; then :
|
|
31861 | +if ac_fn_cxx_try_link "$LINENO"; then :
|
|
31854 | 31862 | wx_cv_elf_symver_multiple=yes
|
31855 | 31863 | else
|
31856 | 31864 | wx_cv_elf_symver_multiple=no
|
... | ... | @@ -31858,6 +31866,12 @@ else |
31858 | 31866 | fi
|
31859 | 31867 | rm -f core conftest.err conftest.$ac_objext \
|
31860 | 31868 | conftest$ac_exeext conftest.$ac_ext
|
31869 | + ac_ext=c
|
|
31870 | +ac_cpp='$CPP $CPPFLAGS'
|
|
31871 | +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
|
31872 | +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
|
31873 | +ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
|
31874 | + |
|
31861 | 31875 | rm -f conftest.sym
|
31862 | 31876 | |
31863 | 31877 | |
... | ... | @@ -31875,17 +31889,25 @@ if ${wx_cv_elf_symver+:} false; then : |
31875 | 31889 | else
|
31876 | 31890 | |
31877 | 31891 | echo "lib_new {}; lib_old { *; };" >conftest.sym
|
31892 | + ac_ext=cpp
|
|
31893 | +ac_cpp='$CXXCPP $CPPFLAGS'
|
|
31894 | +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
|
31895 | +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
|
31896 | +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
|
31897 | + |
|
31878 | 31898 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
31879 | 31899 | /* end confdefs.h. */
|
31880 | 31900 | |
31881 | 31901 | |
31882 | 31902 | #include "wx/private/elfversion.h"
|
31883 | - wxELF_SYMVER("foo","foo@@lib_new")
|
|
31903 | + extern "C" {
|
|
31904 | + wxELF_SYMVER("_foo","_foo@@lib_new")
|
|
31884 | 31905 | void foo() {}
|
31906 | + }
|
|
31885 | 31907 | int main() { return 0; }
|
31886 | 31908 | |
31887 | 31909 | _ACEOF
|
31888 | -if ac_fn_c_try_link "$LINENO"; then :
|
|
31910 | +if ac_fn_cxx_try_link "$LINENO"; then :
|
|
31889 | 31911 | wx_cv_elf_symver=yes
|
31890 | 31912 | else
|
31891 | 31913 | wx_cv_elf_symver=no
|
... | ... | @@ -31893,6 +31915,12 @@ else |
31893 | 31915 | fi
|
31894 | 31916 | rm -f core conftest.err conftest.$ac_objext \
|
31895 | 31917 | conftest$ac_exeext conftest.$ac_ext
|
31918 | + ac_ext=c
|
|
31919 | +ac_cpp='$CPP $CPPFLAGS'
|
|
31920 | +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
|
31921 | +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
|
31922 | +ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
|
31923 | + |
|
31896 | 31924 | rm -f conftest.sym
|
31897 | 31925 | |
31898 | 31926 | |
... | ... | @@ -32209,17 +32237,15 @@ rm -f core conftest.err conftest.$ac_objext \ |
32209 | 32237 | DYLIB_RPATH_POSTLINK="${HOST_PREFIX}install_name_tool -id \$@ \$@"
|
32210 | 32238 | cat <<EOF >change-install-names
|
32211 | 32239 | #!/bin/sh
|
32212 | -libnames=\`cd lib ; ls -1 | grep '\.[0-9][0-9]*\.dylib\$'\`
|
|
32240 | +libnames=\$(cd lib ; ls -1 libwx*${WX_RELEASE}.dylib)
|
|
32213 | 32241 | changes=''
|
32214 | 32242 | for dep in \${libnames} ; do
|
32215 | - changes="\${changes} -change \${4}/\${dep} \${3}/\${dep}"
|
|
32243 | + target=\$(readlink -f \${4}/\${dep})
|
|
32244 | + changes="\${changes} -change \${target} \${3}/\${dep}"
|
|
32216 | 32245 | done
|
32217 | 32246 | for i in \${libnames} ; do
|
32218 | - if test -L \${1}/\${i}; then
|
|
32219 | - # skip symbolic links
|
|
32220 | - continue
|
|
32221 | - fi
|
|
32222 | - ${HOST_PREFIX}install_name_tool \${changes} -id \${3}/\${i} \${1}/\${i}
|
|
32247 | + lib=\$(readlink -f \${1}/\${i})
|
|
32248 | + ${HOST_PREFIX}install_name_tool \${changes} -id \${3}/\${i} \${lib}
|
|
32223 | 32249 | done
|
32224 | 32250 | |
32225 | 32251 | if test -f "\${2}/wxrc-${WX_RELEASE}" ; then
|
... | ... | @@ -3518,17 +3518,21 @@ if test "$wxUSE_SHARED" = "yes"; then |
3518 | 3518 | wx_cv_elf_symver_multiple,
|
3519 | 3519 | [
|
3520 | 3520 | echo "lib_new {}; lib_old { *; };" >conftest.sym
|
3521 | + AC_LANG_PUSH(C++)
|
|
3521 | 3522 | AC_LINK_IFELSE([
|
3522 | 3523 | AC_LANG_SOURCE([
|
3523 | 3524 | #include "wx/private/elfversion.h"
|
3524 | - wxELF_SYMVER("foo","foo@lib_old")
|
|
3525 | - wxELF_SYMVER("foo","foo@@lib_new")
|
|
3525 | + extern "C" {
|
|
3526 | + wxELF_SYMVER("_foo","_foo@lib_old")
|
|
3527 | + wxELF_SYMVER("_foo","_foo@@lib_new")
|
|
3526 | 3528 | void foo() {}
|
3529 | + }
|
|
3527 | 3530 | int main() { return 0; }
|
3528 | 3531 | ])],
|
3529 | 3532 | wx_cv_elf_symver_multiple=yes,
|
3530 | 3533 | wx_cv_elf_symver_multiple=no
|
3531 | 3534 | )
|
3535 | + AC_LANG_POP()
|
|
3532 | 3536 | rm -f conftest.sym
|
3533 | 3537 | ]
|
3534 | 3538 | )
|
... | ... | @@ -3540,16 +3544,20 @@ if test "$wxUSE_SHARED" = "yes"; then |
3540 | 3544 | wx_cv_elf_symver,
|
3541 | 3545 | [
|
3542 | 3546 | echo "lib_new {}; lib_old { *; };" >conftest.sym
|
3547 | + AC_LANG_PUSH(C++)
|
|
3543 | 3548 | AC_LINK_IFELSE([
|
3544 | 3549 | AC_LANG_SOURCE([
|
3545 | 3550 | #include "wx/private/elfversion.h"
|
3546 | - wxELF_SYMVER("foo","foo@@lib_new")
|
|
3551 | + extern "C" {
|
|
3552 | + wxELF_SYMVER("_foo","_foo@@lib_new")
|
|
3547 | 3553 | void foo() {}
|
3554 | + }
|
|
3548 | 3555 | int main() { return 0; }
|
3549 | 3556 | ])],
|
3550 | 3557 | wx_cv_elf_symver=yes,
|
3551 | 3558 | wx_cv_elf_symver=no
|
3552 | 3559 | )
|
3560 | + AC_LANG_POP()
|
|
3553 | 3561 | rm -f conftest.sym
|
3554 | 3562 | ]
|
3555 | 3563 | )
|
... | ... | @@ -3627,17 +3635,15 @@ if test "$wxUSE_SHARED" = "yes"; then |
3627 | 3635 | DYLIB_RPATH_POSTLINK="${HOST_PREFIX}install_name_tool -id \$@ \$@"
|
3628 | 3636 | cat <<EOF >change-install-names
|
3629 | 3637 | #!/bin/sh
|
3630 | -libnames=\`cd lib ; ls -1 | grep '\.[[0-9]][[0-9]]*\.dylib\$'\`
|
|
3638 | +libnames=\$(cd lib ; ls -1 libwx*${WX_RELEASE}.dylib)
|
|
3631 | 3639 | changes=''
|
3632 | 3640 | for dep in \${libnames} ; do
|
3633 | - changes="\${changes} -change \${4}/\${dep} \${3}/\${dep}"
|
|
3641 | + target=\$(readlink -f \${4}/\${dep})
|
|
3642 | + changes="\${changes} -change \${target} \${3}/\${dep}"
|
|
3634 | 3643 | done
|
3635 | 3644 | for i in \${libnames} ; do
|
3636 | - if test -L \${1}/\${i}; then
|
|
3637 | - # skip symbolic links
|
|
3638 | - continue
|
|
3639 | - fi
|
|
3640 | - ${HOST_PREFIX}install_name_tool \${changes} -id \${3}/\${i} \${1}/\${i}
|
|
3645 | + lib=\$(readlink -f \${1}/\${i})
|
|
3646 | + ${HOST_PREFIX}install_name_tool \${changes} -id \${3}/\${i} \${lib}
|
|
3641 | 3647 | done
|
3642 | 3648 | |
3643 | 3649 | if test -f "\${2}/wxrc-${WX_RELEASE}" ; then
|
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help