From 41d9a8f3394fa1b866a4ba784358d61e6684fd3c Mon Sep 17 00:00:00 2001 From: JinWang An Date: Tue, 22 Mar 2022 17:35:24 +0900 Subject: [PATCH] Fix make check build error about perl5 - Because of -pie option, it causes to conflict "-shared" option. - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77464 - To get perl5 ldflags configration info, please read site - https://metacpan.org/pod/Perl::Configure Change-Id: If72cc5e7b20407f1b78111046f8a21a9806737f3 Signed-off-by: JinWang An --- packaging/Fix_make_check_error.patch | 29 +++++++++++++++++++++++++++++ packaging/swig.spec | 13 +++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 packaging/Fix_make_check_error.patch diff --git a/packaging/Fix_make_check_error.patch b/packaging/Fix_make_check_error.patch new file mode 100644 index 0000000..6155422 --- /dev/null +++ b/packaging/Fix_make_check_error.patch @@ -0,0 +1,29 @@ +diff --git a/Examples/Makefile.in b/Examples/Makefile.in +index 87386f7..8c6355d 100644 +--- a/Examples/Makefile.in ++++ b/Examples/Makefile.in +@@ -236,7 +236,10 @@ PERL5_DLNK = @PERL5DYNAMICLINKING@ + PERL5_CCFLAGS = @PERL5CCFLAGS@ + PERL5_CCDLFLAGS = @PERL5CCDLFLAGS@ + PERL5_CCCDLFLAGS = @PERL5CCCDLFLAGS@ +-PERL5_LDFLAGS = @PERL5LDFLAGS@ ++# Add -shared option because of -pie option ++# Please, read site - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77464 ++# To get perl5 ldflags configration info, please read site - https://metacpan.org/pod/Perl::Configure ++PERL5_LDFLAGS = + PERL = @PERL@ + PERL5_LIB = -L$(PERL5_INCLUDE) -l@PERL5LIB@ @LIBS@ $(SYSLIBS) + PERL5_SCRIPT = $(SRCDIR)$(RUNME).pl +diff --git a/Source/Makefile.am b/Source/Makefile.am +index 5cfb888..a5f65f5 100644 +--- a/Source/Makefile.am ++++ b/Source/Makefile.am +@@ -101,7 +101,7 @@ bin_PROGRAMS = eswig + eswig_LDADD = @SWIGLIBS@ + + # Override the link stage to avoid using Libtool +-CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ ++CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -pie -o $@ + + # The executable is copied to the root directory for installation and running the test-suite. + # This occurs on each invocation of make and is a step towards providing support for multiple diff --git a/packaging/swig.spec b/packaging/swig.spec index 4014499..0caf16c 100644 --- a/packaging/swig.spec +++ b/packaging/swig.spec @@ -8,6 +8,7 @@ Group: Development/Languages/C and C++ Source: http://sourceforge.net/projects/swig/files/swig/%{name}-%{version}/%{name}-%{version}.tar.gz Source1: %{name}.rpmlintrc Source1001: swig.manifest +Source1002: Fix_make_check_error.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: boost-devel @@ -72,14 +73,22 @@ understandig SWIG usage. %prep %setup -q cp %{SOURCE1001} . +%{__patch} -p1 < %{SOURCE1002} %build sh autogen.sh -%configure --disable-ccache CFLAGS="-fPIE" CPPFLAGS="-fPIE" LDFLAGS="-pie" -export CFLAGS+=" -fPIC" +%configure --disable-ccache CFLAGS="-fPIC" CPPFLAGS="-fPIC" make %{?_smp_mflags} +%check +%if 0%{?run_unit_test:1} +# Segfaults +rm -f Examples/test-suite/python/li_std_containers_int_runme.py +rm -f Examples/test-suite/python/li_boost_shared_ptr_runme.py +make check +%endif + %install %make_install -- 2.7.4