Skip to content

Commit 63daa7f

Browse files
committed
Add rpath for libpython3.so
1 parent a30ce17 commit 63daa7f

File tree

1 file changed

+14
-27
lines changed

1 file changed

+14
-27
lines changed
Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
diff --git a/Makefile.pre.in b/Makefile.pre.in
2-
index 6c9cba59e27..39fc2e911d0 100644
2+
index 6c9cba59e27..b817e09f4ff 100644
33
--- a/Makefile.pre.in
44
+++ b/Makefile.pre.in
5-
@@ -1028,7 +1028,12 @@ libpython3.so: libpython$(LDVERSION).so
6-
$(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^
5+
@@ -1025,10 +1025,20 @@ libpython$(LDVERSION).so: $(LIBRARY_OBJS) $(DTRACE_OBJS)
6+
fi
7+
8+
libpython3.so: libpython$(LDVERSION).so
9+
- $(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^
10+
+ if [ "$(RELOCATABLE)" = "yes" ]; then \
11+
+ lib_basename=$$(basename $^); \
12+
+ $(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ -Wl,-rpath,'$$ORIGIN' '-Wl,-l:$$ORIGIN/'"$$lib_basename"; \
13+
+ else \
14+
+ $(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^; \
15+
+ fi
716

817
libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
918
- $(CC) -dynamiclib $(PY_CORE_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(DTRACE_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
@@ -17,7 +26,7 @@ index 6c9cba59e27..39fc2e911d0 100644
1726

1827
libpython$(VERSION).sl: $(LIBRARY_OBJS)
1928
diff --git a/configure b/configure
20-
index 38f2d4dfbf2..153add6ac12 100755
29+
index 38f2d4dfbf2..9991932680e 100755
2130
--- a/configure
2231
+++ b/configure
2332
@@ -13749,7 +13749,13 @@ then
@@ -35,19 +44,8 @@ index 38f2d4dfbf2..153add6ac12 100755
3544
# -u libsys_s pulls in all symbols in libsys
3645
Darwin/*|iOS/*)
3746
LINKFORSHARED="$extra_undefs -framework CoreFoundation"
38-
@@ -13774,6 +13780,10 @@ printf "%s\n" "#define THREAD_STACK_SIZE 0x$stack_size" >>confdefs.h
39-
if test "$enable_framework"; then
40-
LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
41-
fi
42-
+ # Add rpath for relocatable builds
43-
+ if test "x$enable_relocatable" = xyes; then
44-
+ LINKFORSHARED="$LINKFORSHARED -Wl,-rpath,@executable_path/../lib"
45-
+ fi
46-
LINKFORSHARED="$LINKFORSHARED"
47-
elif test $ac_sys_system = "iOS"; then
48-
LINKFORSHARED="-Wl,-stack_size,$stack_size $LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)'
4947
diff --git a/configure.ac b/configure.ac
50-
index b1c859071f4..a40d279ebab 100644
48+
index b1c859071f4..f75f41441e2 100644
5149
--- a/configure.ac
5250
+++ b/configure.ac
5351
@@ -3613,7 +3613,13 @@ then
@@ -65,14 +63,3 @@ index b1c859071f4..a40d279ebab 100644
6563
# -u libsys_s pulls in all symbols in libsys
6664
Darwin/*|iOS/*)
6765
LINKFORSHARED="$extra_undefs -framework CoreFoundation"
68-
@@ -3638,6 +3644,10 @@ then
69-
if test "$enable_framework"; then
70-
LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
71-
fi
72-
+ # Add rpath for relocatable builds
73-
+ if test "x$enable_relocatable" = xyes; then
74-
+ LINKFORSHARED="$LINKFORSHARED -Wl,-rpath,@executable_path/../lib"
75-
+ fi
76-
LINKFORSHARED="$LINKFORSHARED"
77-
elif test $ac_sys_system = "iOS"; then
78-
LINKFORSHARED="-Wl,-stack_size,$stack_size $LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)'

0 commit comments

Comments
 (0)