Bug 120985 - [patch] math/suitesparse does not build on amd64, because it ignores CFLAGS
Summary: [patch] math/suitesparse does not build on amd64, because it ignores CFLAGS
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Maho Nakata
Depends on:
Reported: 2008-02-23 08:40 UTC by kamikaze
Modified: 2008-02-27 05:30 UTC (History)
0 users

See Also:

file.diff (749 bytes, patch)
2008-02-23 08:40 UTC, kamikaze
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kamikaze 2008-02-23 08:40:00 UTC
Building terminates in the following way:

-name "*\.a" -exec /bin/mv {} 
/usr/obj/mobileKamikaze.norad/usr/ports/math/suitesparse/work/tmp_shared \;
cd /usr/obj/mobileKamikaze.norad/usr/ports/math/suitesparse/work/tmp_shared 
; for i in `ls *.a | /usr/bin/sed  's/\.a//' `; do  ld -Bshareable -o 
${i}.so.1 -x -soname ${i}.so.1 --whole-archive ${i}.a ; /bin/ln -s ${i}.so.1 
${i}.so ; done
ld: libcsparse.a(cs_add.o): relocation R_X86_64_32 can not be used when 
making a shared object; recompile with -fPIC
libcsparse.a(cs_add.o): could not read symbols: Bad value
*** Error code 1

Stop in /usr/ports/math/suitesparse.

As you see in the following snippet both CC and CFLAGS are ignored 
throughout the build process. Thus the -fPic parameter that gets properly 
set by the ports Makefile does not get through.

cc -O -I../../UFconfig -I../Include -DCS_LONG -DCS_COMPLEX -c 
./Source/cs_print.c -o cs_print_cl.o
cc -O -I../../UFconfig -I../Include -DCS_LONG -DCS_COMPLEX -c 
./Source/cs_norm.c -o cs_norm_cl.o
cc -O -I../../UFconfig -I../Include -DCS_LONG -DCS_COMPLEX -c 
./Source/cs_load.c -o cs_load_cl.o
cc -O -I../../UFconfig -I../Include -DCS_LONG -DCS_COMPLEX -c 
./Source/cs_dfs.c -o cs_dfs_cl.o

Only at the beginning of the build CC and CFLAGS is obeyed:

/usr/local/bin/ccache cc -O2 -fno-strict-aliasing -pipe -march=nocona -fPIC 
-DGETRUSAGE -I../Include -I../Source -I../../AMD/Include -I../../UFconfig 
-DZLONG -c ../Source/umfpack_symbolic.c -o umfpack_zl_symbolic.o
/usr/local/bin/ccache cc -O2 -fno-strict-aliasing -pipe -march=nocona -fPIC 
-DGETRUSAGE -I../Include -I../Source -I../../AMD/Include -I../../UFconfig 
-DZLONG -c ../Source/umfpack_transpose.c -o umfpack_zl_transpose.o
/usr/local/bin/ccache cc -O2 -fno-strict-aliasing -pipe -march=nocona -fPIC 
-DGETRUSAGE -I../Include -I../Source -I../../AMD/Include -I../../UFconfig 
-DZLONG -c ../Source/umfpack_triplet_to_col.c -o umfpack_zl_triplet_to_col.o
/usr/local/bin/ccache cc -O2 -fno-strict-aliasing -pipe -march=nocona -fPIC 
-DGETRUSAGE -I../Include -I../Source -I../../AMD/Include -I../../UFconfig 
-DZLONG -c ../Source/umfpack_scale.c -o umfpack_zl_scale.o

How-To-Repeat: Try to build on amd64.
Comment 1 Edwin Groothuis freebsd_committer 2008-02-23 08:40:06 UTC
Responsible Changed
From-To: freebsd-ports-bugs->maho

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 kamikaze 2008-02-23 08:50:52 UTC
Cursed be my impatience. I sent the wrong version of the patch. This is the 
working one:

--- /usr/ports/math/suitesparse/Makefile.orig	2008-02-23 09:29:28.000000000 +0100
+++ /usr/ports/math/suitesparse/Makefile	2008-02-23 09:45:15.000000000 +0100
@@ -90,12 +90,22 @@

  	@${REINPLACE_CMD}  -e 's,%%CFLAGS%%,${CFLAGS},g' \
  			   -e 's,%%FFLAGS%%,${FFLAGS},g' \
-				 ${WRKSRC}/UFconfig/UFconfig.mk \
+				 ${WRKSRC}/UFconfig/UFconfig.mk

  	@${REINPLACE_CMD}  -e 's,%%CFLAGS%%,${CFLAGS_SHARED},g' \
  			   -e 's,%%FFLAGS%%,${FFLAGS_SHARED},g' \

+	@${FIND} ${WRKSRC} -name Makefile -exec \
+		${REINPLACE_CMD} -Ee 's,(CC =).*,\1 ${CC},1' \
+				 -Ee 's,(CFLAGS =.*),\1 ${CFLAGS},1' \
+					\{} \;
+	@${FIND} ${WRKSRC_SHARED} -name Makefile -exec \
+		${REINPLACE_CMD} -Ee 's,(CC =).*,\1 ${CC},1' \
+				 -Ee 's,(CFLAGS =.*),\1 ${CFLAGS_SHARED},1' \
+					\{} \;
  	cd ${WRKSRC} ; ${GMAKE}
Comment 3 dfilter service freebsd_committer 2008-02-27 05:20:30 UTC
maho        2008-02-27 05:20:25 UTC

  FreeBSD ports repository

  Modified files:
    math/suitesparse     Makefile 
  Added files:
    math/suitesparse/files patch-CSparse+Lib+Makefile 
  Build fix on amd64. I fixed differently, though.
  Submitted by:   Dominic Fandrey
  PR:             120985
  Revision  Changes    Path
  1.26      +10 -2     ports/math/suitesparse/Makefile
  1.1       +11 -0     ports/math/suitesparse/files/patch-CSparse+Lib+Makefile (new)
  1.1       +11 -0     ports/math/suitesparse/files/patch-CXSparse+Lib+Makefile (new)
cvs-all@freebsd.org mailing list
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 4 Maho Nakata freebsd_committer 2008-02-27 05:20:58 UTC
State Changed
From-To: open->closed

Fixed. Thanks!