[78104] trunk/dports/net

Ryan Schmidt ryandesign at macports.org
Thu Apr 28 19:30:44 PDT 2011


I'm sending this reply back to the mailing list as well.


On Apr 28, 2011, at 03:49, Andrea D'Amore wrote:

> Hi Ryan,
> please check r78199 [1], I took the ${archflags} bit from redis port.

That's the general idea, yes, but you need only attempt to build the port and look at the build output to see that it hasn't had any effect for vnstat:


$ sudo port -v build vnstat
Password:
--->  Computing dependencies for vnstat.
--->  Fetching vnstat
--->  Verifying checksum(s) for vnstat
--->  Checksumming vnstat-1.10.tar.gz
--->  Extracting vnstat
--->  Extracting vnstat-1.10.tar.gz
--->  Applying patches to vnstat
--->  Applying /Users/rschmidt/macports/dports/net/vnstat/files/patch-Makefile.diff
patching file Makefile
--->  Configuring vnstat
--->  Building vnstat
make -C src all
gcc -O2   -c -o vnstat.o vnstat.c
gcc -O2   -c -o ifinfo.o ifinfo.c
gcc -O2   -c -o dbxml.o dbxml.c
gcc -O2   -c -o dbshow.o dbshow.c
gcc -O2   -c -o dbaccess.o dbaccess.c
gcc -O2   -c -o dbmerge.o dbmerge.c
gcc -O2   -c -o common.o common.c
gcc -O2   -c -o misc.o misc.c
gcc -O2   -c -o cfg.o cfg.c
gcc -O2   -c -o traffic.o traffic.c
gcc -O2   -c -o vnstatd.o vnstatd.c
gcc -O2   -c -o dbcache.o dbcache.c
gcc -O2   -c -o vnstati.o vnstati.c
gcc -O2   -c -o image.o image.c
gcc  vnstat.o ifinfo.o dbxml.o dbshow.o dbaccess.o dbmerge.o common.o misc.o cfg.o traffic.o -lm -o vnstat
gcc  vnstatd.o ifinfo.o dbaccess.o dbcache.o common.o misc.o cfg.o -lm -o vnstatd
gcc  vnstati.o image.o dbaccess.o dbmerge.o common.o misc.o cfg.o -lm -lgd -o vnstati


See? No "-arch" flags, no correct compiler (just "gcc"). If you had used the method described at the bottom of the UsingTheRightCompiler wiki page, you would even have gotten a nice build failure:


$ sudo port -v build vnstat
--->  Computing dependencies for vnstat.
--->  Fetching vnstat
--->  Verifying checksum(s) for vnstat
--->  Checksumming vnstat-1.10.tar.gz
--->  Extracting vnstat
--->  Extracting vnstat-1.10.tar.gz
--->  Applying patches to vnstat
--->  Applying /Users/rschmidt/macports/dports/net/vnstat/files/patch-Makefile.diff
patching file Makefile
--->  Configuring vnstat
--->  Building vnstat
make -C src all
gcc -O2   -c -o vnstat.o vnstat.c
gcc -O2   -c -o ifinfo.o ifinfo.c
gcc -O2 -c -o ifinfo.o ifinfo.c
gcc: Error: You should be using ${configure.cc}
See http://trac.macports.org/wiki/UsingTheRightCompiler
gcc -O2 -c -o vnstat.o vnstat.c
gcc: Error: You should be using ${configure.cc}
See http://trac.macports.org/wiki/UsingTheRightCompiler
make[1]: *** [ifinfo.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [vnstat.o] Error 1
make: *** [all] Error 2


You could also simply try to build the port in a MacPorts prefix with a nonstandard build_arch and see that it fails. For example, I have a separate MacPorts prefix at /i386-10.6-mp that has build_arch set to i386. (I'm on Snow Leopard on a Core 2 Duo so my default build_arch is x86_64.)


$ sudo /i386-10.6-mp/bin/port -v install
--->  Computing dependencies for vnstat.
--->  Fetching vnstat
--->  Verifying checksum(s) for vnstat
--->  Checksumming vnstat-1.10.tar.gz
--->  Extracting vnstat
--->  Extracting vnstat-1.10.tar.gz
--->  Applying patches to vnstat
--->  Applying /Users/rschmidt/macports/dports/net/vnstat/files/patch-Makefile.diff
patching file Makefile
--->  Configuring vnstat
--->  Building vnstat
make -C src all
gcc -O2   -c -o vnstat.o vnstat.c
gcc -O2   -c -o ifinfo.o ifinfo.c
gcc -O2   -c -o dbxml.o dbxml.c
gcc -O2   -c -o dbshow.o dbshow.c
gcc -O2   -c -o dbaccess.o dbaccess.c
gcc -O2   -c -o dbmerge.o dbmerge.c
gcc -O2   -c -o common.o common.c
gcc -O2   -c -o misc.o misc.c
gcc -O2   -c -o cfg.o cfg.c
gcc -O2   -c -o traffic.o traffic.c
gcc -O2   -c -o vnstatd.o vnstatd.c
gcc -O2   -c -o dbcache.o dbcache.c
gcc -O2   -c -o vnstati.o vnstati.c
gcc -O2   -c -o image.o image.c
gcc  vnstat.o ifinfo.o dbxml.o dbshow.o dbaccess.o dbmerge.o common.o misc.o cfg.o traffic.o -lm -o vnstat
gcc  vnstatd.o ifinfo.o dbaccess.o dbcache.o common.o misc.o cfg.o -lm -o vnstatd
gcc  vnstati.o image.o dbaccess.o dbmerge.o common.o misc.o cfg.o -lm -lgd -o vnstati
ld: warning: in /i386-10.6-mp/lib/libgd.dylib, file was built for i386 which is not the architecture being linked (x86_64)
Undefined symbols:
  "_gdFontGetSmall", referenced from:
      _drawlegend in image.o
[snip]


Or you could try installing the port +universal, then see if the files that got installed are actually universal (e.g. by using "lipo -info" on them).


The reason for the problem is that vnstat's main Makefile runs make in subdirectories but does not preserve the variables we've given it. I've patched the Makefile to fix this problem:

https://trac.macports.org/changeset/78227


> Do I still need to explicitly set build_arch when using ${archflags}
> as CC argument?

configure.cc_archflags contains build_arch, just like configure.universal_cflags contains universal_archs. So no, you don't need to do anything else with build_arch or universal_archs specifically, given the code you've already added.


> I've cleaned the patch part.
> 
> Bye
> 
> -- 
> Andrea
> 
> 
> [1] http://trac.macports.org/changeset/78199/





More information about the macports-dev mailing list