After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 770735 - gnome-autoar-0.1.0 doesn't show error if libarchive version is not high enough
gnome-autoar-0.1.0 doesn't show error if libarchive version is not high enough
Status: RESOLVED FIXED
Product: gnome-autoar
Classification: Other
Component: general
0.1.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME Autoar maintainer(s)
GNOME Autoar maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-09-02 07:46 UTC by john.frankish@outlook.com
Modified: 2016-09-07 17:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
configure: Ensure libarchive version is high enough in fallback check (1.39 KB, patch)
2016-09-07 03:54 UTC, Ting-Wei Lan
committed Details | Review

Description john.frankish@outlook.com 2016-09-02 07:46:56 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
Comment 1 Carlos Soriano 2016-09-02 07:56:43 UTC
what version of libarchive do you have?
Comment 2 john.frankish@outlook.com 2016-09-02 07:59:16 UTC
libarchive-3.1.2
Comment 3 Carlos Soriano 2016-09-02 08:02:21 UTC
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
Comment 4 john.frankish@outlook.com 2016-09-02 08:05:15 UTC
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.
Comment 5 Carlos Soriano 2016-09-02 08:07:55 UTC
(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.
Comment 6 Carlos Soriano 2016-09-02 08:18:19 UTC
Also, were you using jhbuild to build it?
Comment 7 john.frankish@outlook.com 2016-09-02 08:22:23 UTC
After updating libarchive to 3.2.1, gnome-autoar compiles without error.

Thanks :)
Comment 8 john.frankish@outlook.com 2016-09-02 08:22:55 UTC
..and no, I'm not using jhbuild
Comment 9 Ting-Wei Lan 2016-09-07 03:54:33 UTC
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.
Comment 10 Carlos Soriano 2016-09-07 07:54:24 UTC
(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?
Comment 11 Ting-Wei Lan 2016-09-07 10:12:52 UTC
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.
Comment 12 Carlos Soriano 2016-09-07 10:57:33 UTC
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.
Comment 13 Ting-Wei Lan 2016-09-07 17:16:25 UTC
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.
Comment 14 Ting-Wei Lan 2016-09-07 17:37:07 UTC
Attachment 334954 [details] pushed as 4aec473 - configure: Ensure libarchive version is high enough in fallback check
Comment 15 Ting-Wei Lan 2016-09-07 17:39:45 UTC
Attachment 334954 [details] pushed as 8d75c44 - configure: Ensure libarchive version is high enough in fallback check (gnome-3-22)