Date: Wed, 16 Jul 2014 19:04:03 +0000 From: bugzilla-noreply@freebsd.org To: gnome@FreeBSD.org Subject: [Bug 191611] databases/evolution-data-server fails to link when rebuilding because requisite library (sqlite, Berkeley DB) changed and its /usr/local has become unusable Message-ID: <bug-191611-6497-uMvITWYIKu@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-191611-6497@https.bugs.freebsd.org/bugzilla/> References: <bug-191611-6497@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191611 --- Comment #16 from Matthias Andree <mandree@FreeBSD.org> --- tl;dr: 1. --allow-shlib-undefined is dangerous and can result in non-working executables. 2. Your patch drops the .a files, requiring a pkg-plist change. 3. I propose to work around this problem by patching LDCONFIG; I am attaching my proposed minimal patch. These are the relevant parts of my debugging session. Let's start at the failure. I ran the build, and re-ran it without cleaning with MAKE_JOBS_UNSAFE to single out the first failure, which is: > gmake[4]: Entering directory `/var/tmp/usr/ports.svn/databases/evolution-data-server/work/evolution-data-server-2.32.1/calendar/libedata-cal' > /bin/sh ../../libtool --tag=CC --mode=link cc -O2 -pipe -march=athlon64 -fstack-protector -DLDAP_DEPRECATED -fno-strict-aliasing -L/usr/local/lib -pthread -fstack-protector -o test-e-sexp test_e_sexp-e-cal-backend-sexp.o -lical libedata-cal-1.2.la ../../calendar/libecal/libecal-1.2.la ../../libedataserver/libedataserver-1.2.la -lxml2 -lsoup-2.4 -lgio-2.0 -lgobject-2.0 -lgconf-2 -lglib-2.0 -lintl -L/usr/local/lib -lplds4 -lplc4 -lnspr4 -pthread > libtool: link: cc -O2 -pipe -march=athlon64 -fstack-protector -DLDAP_DEPRECATED -fno-strict-aliasing -pthread -fstack-protector -o .libs/test-e-sexp test_e_sexp-e-cal-backend-sexp.o -pthread -L/usr/local/lib -lical ./.libs/libedata-cal-1.2.so ../../calendar/libecal/.libs/libecal-1.2.so ../../libedataserver/.libs/libedataserver-1.2.so /usr/local/lib/libxml2.so /usr/local/lib/libsoup-2.4.so /usr/local/lib/libgio-2.0.so /usr/local/lib/libgobject-2.0.so /usr/local/lib/libgconf-2.so /usr/local/lib/libglib-2.0.so /usr/local/lib/libintl.so -lplds4 -lplc4 -lnspr4 -pthread -Wl,-rpath -Wl,/usr/local/lib > /usr/bin/ld: warning: libdb-6.0.so, needed by /usr/local/lib/libebackend-1.2.so.0, not found (try using -rpath or -rpath-link) > /usr/local/lib/libebackend-1.2.so.0: undefined reference to `db_create' OK, so let's see who is pulling in libebackend-1.2.so.0 from $PREFIX/$LOCALBASE: > $ "/usr/bin/ld" --verbose "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld-elf.so.1" "--hash-style=both" "--enable-new-dtags" "-o" ".libs/test-e-sexp" "/usr/lib/crt1.o" "/usr/lib/crti.o" "/usr/lib/crtbegin.o" "-L/usr/local/lib" "-L/usr/lib" "-L/usr/lib" "test_e_sexp-e-cal-backend-sexp.o" "-lical" "./.libs/libedata-cal-1.2.so" "../../calendar/libecal/.libs/libecal-1.2.so" "../../libedataserver/.libs/libedataserver-1.2.so" "/usr/local/lib/libxml2.so" "/usr/local/lib/libsoup-2.4.so" "/usr/local/lib/libgio-2.0.so" "/usr/local/lib/libgobject-2.0.so" "/usr/local/lib/libgconf-2.so" "/usr/local/lib/libglib-2.0.so" "/usr/local/lib/libintl.so" "-lplds4" "-lplc4" "-lnspr4" "-rpath" "/usr/local/lib" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lpthread" "-lc" "-lssp_nonshared" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "/usr/lib/crtend.o" "/usr/lib/crtn.o" > ... > libpcre.so.3 needed by ./.libs/libedata-cal-1.2.so > found libpcre.so.3 at /usr/local/lib/libpcre.so.3 > libebackend-1.2.so.0 needed by ./.libs/libedata-cal-1.2.so > found libebackend-1.2.so.0 at /usr/local/lib/libebackend-1.2.so.0 WHOOPS! We need libebackend from $WRKSRC/libebackend/.libs/ instead! We see that the libedata-cal-1.2.so is where the trouble starts. Let's investigate it: > $ readelf -d .libs/libedata-cal-1.2.so > 0x0000000000000001 (NEEDED) Shared library: [libc.so.7] > 0x000000000000000e (SONAME) Library soname: [libedata-cal-1.2.so.10] > 0x000000000000000f (RPATH) Library rpath: [/var/tmp/usr/ports.svn/databases/evolution-data-server/work/evolution-data-server-2.32.1/calendar/libecal/.libs:/usr/local/lib:/var/tmp/usr/ports.svn/databases/evolution-data-server/work/evolution-data-server-2.32.1/libedataserver/.libs:/var/tmp/usr/ports.svn/databases/evolution-data-server/work/evolution-data-server-2.32.1/libebackend/.libs] > 0x000000000000001d (RUNPATH) Library runpath: [/var/tmp/usr/ports.svn/databases/evolution-data-server/work/evolution-data-server-2.32.1/calendar/libecal/.libs:/usr/local/lib:/var/tmp/usr/ports.svn/databases/evolution-data-server/work/evolution-data-server-2.32.1/libedataserver/.libs:/var/tmp/usr/ports.svn/databases/evolution-data-server/work/evolution-data-server-2.32.1/libebackend/.libs] And there you have it: /usr/local/lib is before the ../libebackend/.libs, and this is what screws the build. Now let's see how this broken libedata-cal-1.2.so.10 got linked; further up in the full log I see: > libtool: link: cc -shared .libs/libedata_cal_1_2_la-e-data-cal-enumtypes.o .libs/libedata_cal_1_2_la-e-cal-backend.o .libs/libedata_cal_1_2_la-e-cal-backend-cache.o .libs/libedata_cal_1_2_la-e-cal-backend-factory.o .libs/libedata_cal_1_2_la-e-cal-backend-intervaltree.o .libs/libedata_cal_1_2_la-e-cal-backend-sexp.o .libs/libedata_cal_1_2_la-e-cal-backend-sync.o .libs/libedata_cal_1_2_la-e-cal-backend-util.o .libs/libedata_cal_1_2_la-e-cal-backend-store.o .libs/libedata_cal_1_2_la-e-cal-backend-file-store.o .libs/libedata_cal_1_2_la-e-data-cal.o .libs/libedata_cal_1_2_la-e-data-cal-view.o -Wl,--whole-archive ../../calendar/libegdbus/.libs/libegdbus-cal.a -Wl,--no-whole-archive -Wl,-rpath -Wl,/var/tmp/usr/ports.svn/databases/evolution-data-server/work/evolution-data-server-2.32.1/calendar/libecal/.libs -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/var/tmp/usr/ports.svn/databases/evolution-data-server/work/evolution-data-server-2.32.1/libedataserver/.libs -Wl,-rpath -Wl,/var/tmp/us r/ports.svn/databases/evolution-data-server/work/evolution-data-server-2.32.1/libebackend/.libs -Wl,-rpath -Wl,/usr/local/lib -L/usr/local/lib ../../calendar/libecal/.libs/libecal-1.2.so /usr/local/lib/libgtk-x11-2.0.so /usr/local/lib/libgdk-x11-2.0.so /usr/local/lib/libpangocairo-1.0.so /usr/local/lib/libXext.so /usr/local/lib/libXrender.so /usr/local/lib/libXinerama.so /usr/local/lib/libXi.so /usr/local/lib/libXrandr.so /usr/local/lib/libXcursor.so /usr/local/lib/libXcomposite.so /usr/local/lib/libXdamage.so /usr/local/lib/libXfixes.so /usr/local/lib/libX11.so /usr/local/lib/libatk-1.0.so /usr/local/lib/libcairo.so /usr/local/lib/libgdk_pixbuf-2.0.so /usr/local/lib/libpangoft2-1.0.so /usr/local/lib/libpango-1.0.so /usr/local/lib/libfontconfig.so /usr/local/lib/libfreetype.so /usr/local/lib/libORBit-2.so /usr/local/lib/libgthread-2.0.so /usr/local/lib/libgdata.so /usr/local/lib/libsoup-2.4.so /usr/local/lib/libgmodule-2.0.so -lz /usr/local/lib/libffi.so /usr/local/lib/libiconv.so / usr/local/lib/libpcre.so ../../libedataserve! r/.libs/libedataserver-1.2.so ../../libebackend/.libs/libebackend-1.2.so /usr/local/lib/libgio-2.0.so /usr/local/lib/libgobject-2.0.so -lical -licalss -licalvcal /usr/local/lib/libxml2.so /usr/local/lib/libgconf-2.so /usr/local/lib/libglib-2.0.so /usr/local/lib/libintl.so -march=athlon64 -pthread -pthread -pthread -Wl,-soname -Wl,libedata-cal-1.2.so.10 -o .libs/libedata-cal-1.2.so.10.0.0 So what we see here is that libebackend/.libs/libebackend-1.2.so gets linked by relative path, AND there is a corresponding "-Wl,-rpath -Wl,/var/tmp/usr/ports.svn/databases/evolution-data-server/work/evolution-data-server-2.32.1/libebackend/.libs" option pair, but it is before the /usr/local/lib. That's what breaks the build with the unusable older package installed. I propose to prefix the libebackend/.libs through -rpath-link grafted early in LDFLAGS, that works for me. See the proposed newer patch. -- You are receiving this mail because: You are the assignee for the bug.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-191611-6497-uMvITWYIKu>