Skip to content

Commit

Permalink
libarchive requires bzip2 compiled with -fPIE
Browse files Browse the repository at this point in the history
Trying to build latest rawhide rpms for restraint.  Discovered
Fedora-36 and 37 were not building. Build system showed errors
from libarchive builds with undefined references to methods
like BZ2_bzDecompressInit, BZ2_bzDecompress, etc.  Outside
of build system, I found errors requesting the bzip2 library
be recompiled with -fPIE which is what this changeset does.
Once changes applied, build errors went away and the
executable comes up and runs without issues.
  • Loading branch information
cbouchar committed May 11, 2022
1 parent 4e8f0e6 commit 53e16fd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
6 changes: 5 additions & 1 deletion third-party/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ tree/lib/pkgconfig/openssl.pc: $(OPENSSL)
$(MAKE) -C $(OPENSSL)
$(MAKE) -C $(OPENSSL) PREFIX=$(CURDIR)/tree install_sw

tree/lib/libbz2.a: $(BZIP2)
tree/lib/libbz2.a: $(BZIP2) $(BZIP2)/.patches-done
$(MAKE) -C $(BZIP2)
$(MAKE) -C $(BZIP2) PREFIX=$(CURDIR)/tree install

Expand Down Expand Up @@ -151,6 +151,10 @@ tree/lib/pkgconfig/libarchive.pc: $(LIBARCHIVE) $(LIBARCHIVE)/.patches-done \
$(MAKE) -C $(LIBARCHIVE)
$(MAKE) -C $(LIBARCHIVE) install

$(BZIP2)/.patches-done: $(BZIP2)
patch -d$(BZIP2) -p1 <bzip2-add-fPIE.patch
touch $@

$(LIBARCHIVE)/.patches-done: $(LIBARCHIVE)
patch -d$(LIBARCHIVE) -p1 <libarchive-use-pkgconfig.patch
touch $@
Expand Down
13 changes: 13 additions & 0 deletions third-party/bzip2-add-fPIE.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Makefile b/Makefile
index f8a1772..f798668 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ RANLIB=ranlib
LDFLAGS=

BIGFILES=-D_FILE_OFFSET_BITS=64
-CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
+CFLAGS=-fPIE -Wall -Winline -O2 -g $(BIGFILES)

# Where you want it installed when you do 'make install'
PREFIX=/usr/local

0 comments on commit 53e16fd

Please sign in to comment.