GNOME Bugzilla – Bug 770735
gnome-autoar-0.1.0 doesn't show error if libarchive version is not high enough
Last modified: 2016-09-07 17:39:45 UTC
Using gnome-autoar-0.1.0 compiling gnome-autoar with: CC="gcc -flto -fuse-linker-plugin -mtune=generic -Os -pipe" CXX="g++ -flto -fuse-linker-plugin -mtune=generic -Os -pipe -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local --disable-static --localstatedir=/var make fails with: CC gnome-autoar/gnome_autoar_libgnome_autoar_0_la-autoar-extractor.lo gnome-autoar/autoar-extractor.c: In function 'autoar_extractor_step_scan_toplevel': gnome-autoar/autoar-extractor.c:1591:9: error: implicit declaration of function 'archive_entry_is_encrypted' [-Werror=implicit-function-declaration] if (archive_entry_is_encrypted (entry)) { ^ gnome-autoar/autoar-extractor.c:1591:5: warning: nested extern declaration of 'archive_entry_is_encrypted' [-Wnested-externs] if (archive_entry_is_encrypted (entry)) { ^ cc1: some warnings being treated as errors Makefile:956: recipe for target 'gnome-autoar/gnome_autoar_libgnome_autoar_0_la-autoar-extractor.lo' failed make[2]: *** [gnome-autoar/gnome_autoar_libgnome_autoar_0_la-autoar-extractor.lo] Error 1 make[2]: Leaving directory '/usr/src/gnome-autoar-0.1.0' Makefile:1169: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/usr/src/gnome-autoar-0.1.0' Makefile:725: recipe for target 'all' failed make: *** [all] Error 2 compiling with: CC="gcc -flto -fuse-linker-plugin -mtune=generic -Os -pipe" CXX="g++ -flto -fuse-linker-plugin -mtune=generic -Os -pipe -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local --disable-static --localstatedir=/var --enable-compile-warnings=no make fails with: /bin/sh ./libtool --tag=CC --mode=link gcc -flto -fuse-linker-plugin -mtune=generic -Os -pipe -pthread -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include -I. -w -o tests/test-extract tests/tests_test_extract-test-extract.o -L/usr/local/lib -lgio-2.0 -lgobject-2.0 -lglib-2.0 ./gnome-autoar/libgnome-autoar-0.la -larchive libtool: link: gcc -flto -fuse-linker-plugin -mtune=generic -Os -pipe -pthread -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include -I. -w -o tests/.libs/test-extract tests/tests_test_extract-test-extract.o -L/usr/local/lib -L/usr/lib ./gnome-autoar/.libs/libgnome-autoar-0.so /usr/local/lib/libgio-2.0.so /usr/local/lib/libgmodule-2.0.so -ldl -lresolv /usr/local/lib/libgobject-2.0.so /usr/local/lib/libffi.so /usr/local/lib/libglib-2.0.so /usr/local/lib/libpcre.so -lpthread /usr/local/lib/libarchive.so -lcrypto /usr/local/lib/libexpat.so -lbz2 -lz -pthread ./gnome-autoar/.libs/libgnome-autoar-0.so: undefined reference to `archive_entry_is_encrypted' collect2: error: ld returned 1 exit status Makefile:873: recipe for target 'tests/test-extract' failed make[2]: *** [tests/test-extract] Error 1 make[2]: Leaving directory '/usr/src/gnome-autoar-0.1.0' Makefile:1169: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/usr/src/gnome-autoar-0.1.0' Makefile:725: recipe for target 'all' failed make: *** [all] Error 2
what version of libarchive do you have?
libarchive-3.1.2
As per the configure file, https://git.gnome.org/browse/gnome-autoar/tree/configure.ac#n57 we require 3.2.0. What distro and version are you using? I checked that all distros latests versions have libarchive 3.2
OK, but in that case, shouldn't the configure script throw up an error when pkgconfig checks for libarchive >= 3.2.0? I'm using tinycorelinux corepure64 v7.2, I'll update libarchive to 3.2.1 and try again.
(In reply to john.frankish@outlook.com from comment #4) > OK, but in that case, shouldn't the configure script throw up an error when > pkgconfig checks for libarchive >= 3.2.0? > > I'm using tinycorelinux corepure64 v7.2, I'll update libarchive to 3.2.1 and > try again. yes, but it's done differently for some reason. I need to check with the maintainer.
Also, were you using jhbuild to build it?
After updating libarchive to 3.2.1, gnome-autoar compiles without error. Thanks :)
..and no, I'm not using jhbuild
Created attachment 334954 [details] [review] configure: Ensure libarchive version is high enough in fallback check The previous version of fallback check uses archive_read_new, which is incorrect because it will wrongly accept an old version of libarchive and fail at link time instead of configure time. This commit fixes it by replacing archive_read_new with archive_entry_is_encrypted. This function is added in libarchive 3.2.0 and systems with lower versions will fail the check.
(In reply to Ting-Wei Lan from comment #9) > Created attachment 334954 [details] [review] [review] > configure: Ensure libarchive version is high enough in fallback check > > The previous version of fallback check uses archive_read_new, which is > incorrect because it will wrongly accept an old version of libarchive > and fail at link time instead of configure time. This commit fixes it > by replacing archive_read_new with archive_entry_is_encrypted. This > function is added in libarchive 3.2.0 and systems with lower versions > will fail the check. Hey, why do we do it in this way and not just check for the version requirement like is done for other libraries?
The fallback check was added to support FreeBSD, which doesn't include libarchive.pc in its base system but always has libarchive installed because tar, cpio, and other important system commands are implemented using libarchive. Although the ports system now unconditionally pulls in another copy of libarchive to provide libarchive.pc because the version in base may be too old, I still want to leave the choice to users. They can either install libarchive from ports/pkg to pass the pkg-config check, or use libarchive from base without installing additional packages to pass the fallback check. There is a plan to make some commonly-used libraries in base private and require third-party programs to use the version from ports/pkg. This will reduce the possibility of version conflict and avoid problems caused by lacking .pc files. I will keep the fallback check until libarchive is made private in all supported FreeBSD releases. FreeBSD 9 base includes libarchive 2.8.5. FreeBSD 10 base includes libarchive 3.1.2. FreeBSD 11 base includes libarchive 3.2.1. All versions use the same port system, which includes libarchive 3.2.1.
Oh okay. That's giving problems to the more general Linux though, and it wouldn't work if the new version doesn't have a new API. Imho I would change it, but it's up to you.
If we require a version that don't have new API, I think we can use AC_COMPILE_IFELSE to compile a small program to test the ARCHIVE_VERSION_NUMBER macro defined in archive.h.
Attachment 334954 [details] pushed as 4aec473 - configure: Ensure libarchive version is high enough in fallback check
Attachment 334954 [details] pushed as 8d75c44 - configure: Ensure libarchive version is high enough in fallback check (gnome-3-22)