Bug 197103 - science/vmd: Requires GCC, Respect CC/CXX
Summary: science/vmd: Requires GCC, Respect CC/CXX
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: John Marino
URL:
Keywords: patch, patch-ready
Depends on:
Blocks:
 
Reported: 2015-01-26 18:03 UTC by sakaue.mamoru
Modified: 2015-03-15 13:13 UTC (History)
2 users (show)

See Also:


Attachments
Patch to fix build failure on systems without gcc (1.82 KB, patch)
2015-01-26 18:03 UTC, sakaue.mamoru
no flags Details | Diff
Output of the test by make (635.85 KB, text/plain)
2015-01-27 22:04 UTC, sakaue.mamoru
no flags Details
Fix for the duplicated repalcement (1.37 KB, patch)
2015-02-27 04:22 UTC, sakaue.mamoru
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description sakaue.mamoru 2015-01-26 18:03:18 UTC
Created attachment 152189 [details]
Patch to fix build failure on systems without gcc

I experienced build failure of science/vmd on 10.1-RELEASE where gcc, g++ and cc have been removed from the base system. In such systems, gcc installed by ports/packages should be used. My patch fixes the symptom in such systems keeping the compatibility with the older systems.

Following is from the log of the build failure:
------------------------------------------------------------------------
root@tmpjail:/ # env LANG=C make -C /usr/ports/science/vmd/
===>   vmd-1.9.1_3 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by vmd-1.9.1_3 for building
===>  Extracting for vmd-1.9.1_3
=> SHA256 Checksum OK for vmd-1.9.1.src.tar.gz.
=> SHA256 Checksum OK for tachyon-0.99b2.tar.gz.
=> SHA256 Checksum OK for Stride_src.tar.Z.
/bin/mkdir -p /usr/ports/science/vmd/work
/usr/bin/tar -xzf /usr/ports/distfiles/vmd-1.9.1.src.tar.gz -C /usr/ports/science/vmd/work
/usr/bin/tar -xzf /usr/ports/science/vmd/work/vmd-1.9.1/lib/surf/surf.tar.Z -C /usr/ports/science/vmd/work/vmd-1.9.1/lib/surf
/usr/bin/tar -xzf /usr/ports/distfiles/tachyon-0.99b2.tar.gz -C /usr/ports/science/vmd/work/vmd-1.9.1/lib
/usr/bin/tar -xzf /usr/ports/distfiles/Stride_src.tar.Z -C /usr/ports/science/vmd/work/vmd-1.9.1/lib/stride
===>  Patching for vmd-1.9.1_3
===>  Applying FreeBSD patches for vmd-1.9.1_3
/usr/bin/sed -i.bak "s/-lpthread/-pthread/" /usr/ports/science/vmd/work/vmd-1.9.1/configure
/usr/bin/sed -i.bak "s/-ltk8.5/-ltk85/" /usr/ports/science/vmd/work/vmd-1.9.1/configure
/usr/bin/sed -i.bak "s/-ltcl8.5/-ltcl85/" /usr/ports/science/vmd/work/vmd-1.9.1/configure
/usr/bin/sed -i.bak "s%\$python_dir/lib_\$config_arch%/usr/local%" /usr/ports/science/vmd/work/vmd-1.9.1/configure
/usr/bin/sed -i.bak "s/python2.5/python2.7/" /usr/ports/science/vmd/work/vmd-1.9.1/configure
/usr/bin/sed -i.bak "s/.SILENT:/#.SILENT:/" /usr/ports/science/vmd/work/plugins/Makefile
/usr/bin/sed -i.bak "s/.SILENT:/#.SILENT:/" /usr/ports/science/vmd/work/plugins/*/Makefile
/usr/bin/sed -i.bak "s%log2f(\([^ ,]*\))%logf(\1)/(float)M_LN2%g" /usr/ports/science/vmd/work/vmd-1.9.1/src/Orbital.C
/usr/bin/sed -i.bak -e "s|%%PREFIX%%|/usr/local|g"  -e "s|/usr/local|/usr/local|g" /usr/ports/science/vmd/work/vmd-1.9.1/configure
===>   vmd-1.9.1_3 depends on executable: makedepend - found
===>   vmd-1.9.1_3 depends on file: /usr/local/lib/python2.7/site-packages/Numeric/Numeric.py - found
===>   vmd-1.9.1_3 depends on executable: gmake - found
===>   vmd-1.9.1_3 depends on file: /usr/local/bin/python2.7 - found
===>   vmd-1.9.1_3 depends on file: /usr/local/libdata/pkgconfig/glproto.pc - found
===>   vmd-1.9.1_3 depends on file: /usr/local/libdata/pkgconfig/dri2proto.pc - found
===>   vmd-1.9.1_3 depends on file: /usr/local/bin/perl5.18.4 - found
===>   vmd-1.9.1_3 depends on shared library: libtcl85.so - found (/usr/local/lib/libtcl85.so.1.0)
===>   vmd-1.9.1_3 depends on shared library: libtk85.so - found (/usr/local/lib/libtk85.so.1.0)
===>   vmd-1.9.1_3 depends on shared library: libfltk.so - found (/usr/local/lib/libfltk.so.1.3)
===>   vmd-1.9.1_3 depends on shared library: libnetcdf.so - found (/usr/local/lib/libnetcdf.so.4.3.2)
===>   vmd-1.9.1_3 depends on shared library: libGLU.so - found (/usr/local/lib/libGLU.so.1.3.1)
===>  Configuring for vmd-1.9.1_3
===>  Building for vmd-1.9.1_3
/usr/bin/env XDG_DATA_HOME=/usr/ports/science/vmd/work  XDG_CONFIG_HOME=/usr/ports/science/vmd/work  HOME=/usr/ports/science/vmd/work XDG_DATA_HOME=/usr/ports/science/vmd/work  XDG_CONFIG_HOME=/usr/ports/science/vmd/work  HOME=/usr/ports/science/vmd/work NO_PIE=yes SHELL=/bin/sh NO_LINT=YES PREFIX=/usr/local  LOCALBASE=/usr/local  LIBDIR="/usr/lib"  CC="cc" CFLAGS="-O2 -pipe  -fstack-protector -fno-strict-aliasing"  CPP="cpp" CPPFLAGS=""  LDFLAGS=" -fstack-protector" LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -fstack-protector -fno-strict-aliasing "  MANPREFIX="/usr/local" BSD_INSTALL_PROGRAM="install  -s -o root -g wheel -m 555"  BSD_INSTALL_LIB="install  -s -o root -g wheel -m 444"  BSD_INSTALL_SCRIPT="install  -o root -g wheel -m 555"  BSD_INSTALL_DATA="install  -o root -g wheel -m 0644"  BSD_INSTALL_MAN="install  -o root -g wheel -m 444" gmake bsd -C /usr/ports/science/vmd/work/vmd-1.9.1/lib/tachyon/unix  && /bin/mv /usr/ports/science/vmd/work/vmd-1.9.1/lib/tachyon/compile/bsd/tachyon  /usr/ports/science/vmd/work/vmd-1.9.1/lib/tachyon/tachyon_FREEBSDAMD64
gmake[1]: Entering directory '/usr/ports/science/vmd/work/vmd-1.9.1/lib/tachyon/unix'
gmake all \
"ARCH = bsd" \
"CC = gcc" \
"CFLAGS += -O3 -fomit-frame-pointer -ffast-math -DBsd        " \
"AR = ar" \
"ARFLAGS = r" \
"STRIP = strip" \
"RANLIB = ranlib" \
"LIBS = -L. -ltachyon    -lm"
gmake[2]: Entering directory '/usr/ports/science/vmd/work/vmd-1.9.1/lib/tachyon/unix'
Building Tachyon Parallel Ray Tracing library
Copyright 1994-2007, John E. Stone
All Rights Reserveed
Making architecture directory ../compile/bsd
Making library directory ../compile/bsd/libtachyon
gmake ../compile ../compile/bsd ../compile/bsd/libtachyon  ../compile/bsd/libtachyon.a  ../compile/bsd/tachyon
gmake[3]: Entering directory '/usr/ports/science/vmd/work/vmd-1.9.1/lib/tachyon/unix'
gmake[3]: Nothing to be done for '../compile'.
gmake[3]: Nothing to be done for '../compile/bsd'.
gmake[3]: Nothing to be done for '../compile/bsd/libtachyon'.
gcc -O2 -pipe  -fstack-protector -fno-strict-aliasing -O3 -fomit-frame-pointer -ffast-math -DBsd         -c ../src/api.c -o ../compile/bsd/libtachyon/api.o
gmake[3]: gcc: Command not found
Makefile:371: recipe for target '../compile/bsd/libtachyon/api.o' failed
gmake[3]: *** [../compile/bsd/libtachyon/api.o] Error 127
gmake[3]: Leaving directory '/usr/ports/science/vmd/work/vmd-1.9.1/lib/tachyon/unix'
Makefile:84: recipe for target 'all' failed
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory '/usr/ports/science/vmd/work/vmd-1.9.1/lib/tachyon/unix'
Make-arch:989: recipe for target 'bsd' failed
gmake[1]: *** [bsd] Error 2
gmake[1]: Leaving directory '/usr/ports/science/vmd/work/vmd-1.9.1/lib/tachyon/unix'
*** Error code 2

Stop.
make: stopped in /usr/ports/science/vmd
------------------------------------------------------------------------

The cause of this symptom is that the commands of gcc, g++ and cc are specified without the version suffix in makefiles and configure scripts. My patch modifies them to reflect ${CC} and ${CXX} defined by bsd.gcc.mk. I confirmed that the patched port succeeded the build and install on 10.1-RELEASE (amd64).
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2015-01-27 09:36:41 UTC
Thanks for your submission :)

It would be great if you could also provide (as attachments) for QA:

1) portlint -AC output, AND 
2) poudriere testport or bulk -t output, OR
3) Output of: make stage && make check-plist && make stage-qa && make package
Comment 2 sakaue.mamoru 2015-01-27 22:04:04 UTC
Created attachment 152281 [details]
Output of the test by make

This is the output of make stage && make check-plist && make stage-qa && make package.
Comment 3 sakaue.mamoru 2015-01-27 22:05:43 UTC
This is the output of portlint.
----------------------------------------------------------------------
root@tmpjail:/ # portlint -AC /usr/ports/science/vmd/
WARN: /usr/ports/science/vmd/pkg-plist: [97]: installing shared libraries, please define USE_LDCONFIG as appropriate
WARN: /usr/ports/science/vmd/pkg-plist: [98]: installing shared libraries, please define USE_LDCONFIG as appropriate
WARN: /usr/ports/science/vmd/pkg-plist: [115]: installing shared libraries, please define USE_LDCONFIG as appropriate
WARN: /usr/ports/science/vmd/pkg-plist: [119]: installing shared libraries, please define USE_LDCONFIG as appropriate
WARN: Makefile: [0]: possible direct use of command "file" found. use ${FILE} instead.
WARN: Makefile: [0]: possible direct use of command "install" found. use ${INSTALL_foobaa} instead.
WARN: Makefile: for new port, make $FreeBSD$ tag in comment section empty, to make SVN happy.
WARN: Makefile: new ports should not set PORTREVISION.
WARN: Makefile: new ports should not be maintained by ports@FreeBSD.org.
WARN: Makefile: Consider defining LICENSE.
WARN: Makefile: "RESTRICTED" found. do not forget to update ports/LEGAL.
WARN: Consider to set DEVELOPER=yes in /etc/make.conf
0 fatal errors and 12 warnings found.
----------------------------------------------------------------------
Comment 4 John Marino freebsd_committer 2015-02-04 11:06:13 UTC
Are you checking the port outside of the tree?  Why does portlint think this is a new port?  All those warnings need to be checked but I suspect they are bogus.
Comment 5 sakaue.mamoru 2015-02-11 15:20:09 UTC
For instance, this is the portlint output for the original port without modification. The same warnings are reported by portlint, however, they are not fatal at the present moment. The Ports tree was updated by portsnap at January 26, 2015.

------------------------------------------------------------------------
~# cd /usr/ports/science/vmd/
vmd# env LANG=C TZ= ls -l /usr/ports/INDEX-*
-rw-r--r--  1 root  wheel  30231696 Jan 26 16:51 /usr/ports/INDEX-10
-rw-r--r--  1 root  wheel  30340347 Jan 26 16:51 /usr/ports/INDEX-8
-rw-r--r--  1 root  wheel  30296657 Jan 26 16:51 /usr/ports/INDEX-9
vmd# make package-name
vmd-1.9.1_3
vmd# env LANG=C TZ= find . -ls
29653374        4 drwxr-xr-x    3 root                             wheel                                 512 Dec 16 22:05 .
29653375       12 -rw-r--r--    1 root                             wheel                                4603 Sep 10 20:50 ./Makefile
29653376        4 -rw-r--r--    1 root                             wheel                                 399 Jan 22  2014 ./distinfo
29653377        4 drwxr-xr-x    2 root                             wheel                                 512 Dec 16 22:05 ./files
29653378        4 -rw-r--r--    1 root                             wheel                                 983 Jan 22  2014 ./files/patch-Make-arch
29653379        4 -rw-r--r--    1 root                             wheel                                 588 Jan 22  2014 ./files/patch-Makefile
29653380       12 -rw-r--r--    1 root                             wheel                                5254 Aug 30 14:17 ./files/patch-configure
29653381        4 -rw-r--r--    1 root                             wheel                                 365 Jan 22  2014 ./files/patch-lib_tachyon_unix_Make-arch
29653382        4 -rw-r--r--    1 root                             wheel                                 321 Jan 22  2014 ./files/patch-plugins__hesstrans__Makefile
29653383        4 -rw-r--r--    1 root                             wheel                                 290 Jan 22  2014 ./files/patch-stride.c
29653384        4 -rw-r--r--    1 root                             wheel                                 427 Jan 22  2014 ./files/patch-stride.h
29653385        4 -rw-r--r--    1 root                             wheel                                 754 Jan 22  2014 ./files/patch-stride_Makefile
29653386        4 -rw-r--r--    1 root                             wheel                                 426 Jan 22  2014 ./files/patch-surf_Makefile
29653387        4 -rw-r--r--    1 root                             wheel                                 195 Jan 22  2014 ./pkg-descr
29653388      120 -rw-r--r--    1 root                             wheel                               60251 Nov 12 18:48 ./pkg-plist
vmd# portlint -V
portlint version 2.16.1
vmd# portlint -AC
WARN: /usr/ports/science/vmd/pkg-plist: [97]: installing shared libraries, please define USE_LDCONFIG as appropriate
WARN: /usr/ports/science/vmd/pkg-plist: [98]: installing shared libraries, please define USE_LDCONFIG as appropriate
WARN: /usr/ports/science/vmd/pkg-plist: [115]: installing shared libraries, please define USE_LDCONFIG as appropriate
WARN: /usr/ports/science/vmd/pkg-plist: [119]: installing shared libraries, please define USE_LDCONFIG as appropriate
WARN: Makefile: [0]: possible direct use of command "file" found. use ${FILE} instead.
WARN: Makefile: [0]: possible direct use of command "install" found. use ${INSTALL_foobaa} instead.
WARN: Makefile: for new port, make $FreeBSD$ tag in comment section empty, to make SVN happy.
WARN: Makefile: new ports should not set PORTREVISION.
WARN: Makefile: new ports should not be maintained by ports@FreeBSD.org.
WARN: Makefile: Consider defining LICENSE.
WARN: Makefile: "RESTRICTED" found. do not forget to update ports/LEGAL.
WARN: Consider to set DEVELOPER=yes in /etc/make.conf
0 fatal errors and 12 warnings found.
------------------------------------------------------------------------
Comment 6 John Marino freebsd_committer 2015-02-24 08:48:00 UTC
I am not sure what you are doing with portlint, but when I try on the current /usr/ports/science/vmd, I only see three warnings total.
Comment 7 John Marino freebsd_committer 2015-02-24 08:50:34 UTC
the patch itself looks ok.  nobody has seen this error because this is a "manual build" port and so the builders don't build it (so no error logs come)
Comment 8 John Marino freebsd_committer 2015-02-24 09:34:45 UTC
the line should be "USE_GCC= any", not "USE_GCC= yes".
From your description, the gcc that came with FreeBSD 8 and 9 was fine.
Comment 9 commit-hook freebsd_committer 2015-02-24 09:46:21 UTC
A commit references this bug:

Author: marino
Date: Tue Feb 24 09:46:16 UTC 2015
New revision: 379777
URL: https://svnweb.freebsd.org/changeset/ports/379777

Log:
  science/vmd: Unbreak on F10+

  This patch removes the hardcoded "gcc" so that it works with USE_GCC
  variable.  There is a slightly newer version of vmd available, so a
  version upgrade may soon follow.

  PR:		197103
  Submitted by:	Sakaue Mamoru

Changes:
  head/science/vmd/Makefile
Comment 10 John Marino freebsd_committer 2015-02-24 10:05:56 UTC
In the process of trying to update to version 1.9.2, I found your code has logic bugs.

if you grep after "make patch" you'll find lots of hits for "gcc4848" (or gcc4747).  Your code is replacing gcc twice!
Comment 11 John Marino freebsd_committer 2015-02-24 10:06:39 UTC
these seems to be happening only in plugins:

Make-arch
cionize/Makefile.* (3 times)
Comment 12 sakaue.mamoru 2015-02-27 04:22:35 UTC
Created attachment 153570 [details]
Fix for the duplicated repalcement

This patch fixes the duplicated replacement observed for plugins/cionize/Makefile.* and plugins/Make-arch.
This patch is applied to the version commited at 2015-02-24 09:46:15Z by marino.
Comment 13 John Marino freebsd_committer 2015-02-27 07:27:36 UTC
hmm, I had just changed the order of the replacements and it worked for me.

I got stuck on the update to 1.9.2 so I never committed it.

Unfortunately 1.9.2 is not as close to 1.9.1 as one might think.  Also, I don't think the plugin makefiles were actually used so the replacement error had no real effect.
Comment 14 commit-hook freebsd_committer 2015-03-15 13:11:57 UTC
A commit references this bug:

Author: marino
Date: Sun Mar 15 13:11:49 UTC 2015
New revision: 381327
URL: https://svnweb.freebsd.org/changeset/ports/381327

Log:
  science/vmd: Improve cc/gcc replacement patterns for Makefiles

  PR:		197103
  Submitted by:	Sakaue Mamoru

Changes:
  head/science/vmd/Makefile
Comment 15 John Marino freebsd_committer 2015-03-15 13:13:20 UTC
Thanks for the fix.

I don't think I'll pursue updating to 1.9.2, there seems to be a lot to change and I don't have the inclination right now.