[Android-tools-devel] Bug#916250: android-platform-art: FTBFS with ld --as-needed
Logan Rosen
logan at ubuntu.com
Wed Dec 12 04:29:40 GMT 2018
Source: android-platform-art
Version: 8.1.0+r23-2
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu disco ubuntu-patch
Dear Maintainer,
android-platform-art currently fails to build from source with ld
--as-needed, which is by default in Ubuntu. This linker argument
requires that libraries be placed in the order that they are needed,
after the objects that require them. Libraries should not be colocated
with LDFLAGS - those are specifically options for the linker itself.
In Ubuntu, the attached patch was applied to achieve the following:
* debian/lib{art,sigchain}.mk: Move libraries to LIBS variable at the
end of linking command to fix FTBFS with ld --as-needed.
Thanks for considering the patch.
Logan Rosen
-- System Information:
Debian Release: buster/sid
APT prefers cosmic-updates
APT policy: (500, 'cosmic-updates'), (500, 'cosmic-security'), (500, 'cosmic'), (400, 'cosmic-proposed'), (100, 'cosmic-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.18.0-12-generic (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
diff -Nru android-platform-art-8.1.0+r23/debian/libart.mk android-platform-art-8.1.0+r23/debian/libart.mk
--- android-platform-art-8.1.0+r23/debian/libart.mk 2018-12-05 14:19:06.000000000 -0500
+++ android-platform-art-8.1.0+r23/debian/libart.mk 2018-12-11 23:02:50.000000000 -0500
@@ -400,6 +400,8 @@
-L/usr/lib/$(DEB_HOST_MULTIARCH)/android \
-Ldebian/out \
-Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
+ -shared -Wl,-soname,$(NAME).so.0
+LIBS += \
-lbacktrace \
-lbase \
-lcutils \
@@ -411,12 +413,11 @@
-lpthread \
-lsigchain \
-lz \
- -lziparchive \
- -shared -Wl,-soname,$(NAME).so.0
+ -lziparchive
debian/out/$(NAME).so.0: $(OBJECTS_CXX) $(OBJECTS_ASSEMBLY)
mkdir --parents debian/out
- $(CXX) -o $@ $(LDFLAGS) $^
+ $(CXX) -o $@ $(LDFLAGS) $^ $(LIBS)
ln -s $(NAME).so.0 debian/out/$(NAME).so
clean:
@@ -432,4 +433,4 @@
clang -o $@ $(CFLAGS) $(CPPFLAGS) $^
operator_out.cc: $(SOURCES_OPERATOR)
- python3 tools/generate-operator-out.py runtime $^ > $@
\ No newline at end of file
+ python3 tools/generate-operator-out.py runtime $^ > $@
diff -Nru android-platform-art-8.1.0+r23/debian/libsigchain.mk android-platform-art-8.1.0+r23/debian/libsigchain.mk
--- android-platform-art-8.1.0+r23/debian/libsigchain.mk 2018-11-14 00:22:16.000000000 -0500
+++ android-platform-art-8.1.0+r23/debian/libsigchain.mk 2018-12-11 23:02:50.000000000 -0500
@@ -4,12 +4,12 @@
SOURCES := $(foreach source, $(SOURCES), sigchainlib/$(source))
CPPFLAGS += -Isigchainlib
-LDFLAGS += \
+LDFLAGS += -shared -Wl,-soname,$(NAME).so.0
+LIBS += \
-ldl \
- -lpthread \
- -shared -Wl,-soname,$(NAME).so.0
+ -lpthread
debian/out/$(NAME).so.0: $(SOURCES)
mkdir --parents debian/out
- $(CXX) -o $@ $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $^
- ln -s $(NAME).so.0 debian/out/$(NAME).so
\ No newline at end of file
+ $(CXX) -o $@ $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $^ $(LIBS)
+ ln -s $(NAME).so.0 debian/out/$(NAME).so
More information about the Android-tools-devel
mailing list