On Wed, Sep 12, 2012 at 11:17:50AM -0700, Ryan Freeman wrote:
> Hey ports@
Hey Ryan,
> Hoping I can borrow some eyes on this one, as I have beaten this to
> death myself.
>
> Basically, a program that build just fine with its plain source
> archive always fails when trying to turn it into a port:
>
>
> building via ports:
>
> [ 60%] Building CXX object source/CMakeFiles/vavoom.dir/net_udp.o
> cd /home/ryan/obj/pobj/vavoom-1.33/build-i386/source && /usr/bin/c++
> -DHAVE_INTTYPES_H=1 -g -I/home/ryan/obj/pobj/vavoom-1.33/build-i386/source
> -I/usr/local/include/SDL -I/usr/local/include -I/usr/X11R6/include
> -I/usr/local/include/AL -I/usr/local/include/libpng
> -I/home/ryan/obj/pobj/vavoom-1.33/vavoom-1.33/source/-pthread -o
> CMakeFiles/vavoom.dir/net_udp.o -c
> /home/ryan/obj/pobj/vavoom-1.33/vavoom-1.33/source/net_udp.cpp
> /home/ryan/obj/pobj/vavoom-1.33/vavoom-1.33/source/net_udp.cpp:59: error:
> expected identifier before numeric constant
> /home/ryan/obj/pobj/vavoom-1.33/vavoom-1.33/source/net_udp.cpp:59: error:
> expected `}' before numeric constant
> /home/ryan/obj/pobj/vavoom-1.33/vavoom-1.33/source/net_udp.cpp:59: error:
> expected unqualified-id before numeric constant
> /home/ryan/obj/pobj/vavoom-1.33/vavoom-1.33/source/net_udp.cpp:61: error:
> expected unqualified-id before ')' token
> /home/ryan/obj/pobj/vavoom-1.33/vavoom-1.33/source/net_udp.cpp:82: error:
> expected declaration before '}' token
> *** Error code 1
Line 59 of that file reads:
enum { MAXHOSTNAMELEN = 256 };
This name is also defined as a macro in sys/param.h:
sys/param.h:#define MAXHOSTNAMELEN 256 /* max hostname
size */
So it expands to this, leading to the error you're seeing because
it's invalid syntax:
enum { 256 = 256 };
>
> building from source archive:
>
> [ 60%] Building CXX object source/CMakeFiles/vavoom.dir/net_udp.o
> cd /home/ryan/src/vavoom/vavoom-1.33/build/source && /usr/bin/c++
> -DHAVE_INTTYPES_H=1 -g -I/home/ryan/src/vavoom/vavoom-1.33/build/source
> -I/usr/local/include/SDL -I/usr/local/include -I/usr/X11R6/include
> -I/usr/local/include/AL -I/usr/local/include/libpng
> -I/home/ryan/src/vavoom/vavoom-1.33/source/-pthread -o
> CMakeFiles/vavoom.dir/net_udp.o -c
> /home/ryan/src/vavoom/vavoom-1.33/source/net_udp.cpp
>
>
> On the latter example, the build continues to linking and a working
> binary. jasperix suggested CFLAGS, but unless I am out to lunch
> those CFLAGS in above output are exactly the same. The only differing
> factor is where the source and output directories reside.
>
> Anything come to mind?
>
> Cheers,
> --ryan
For some reason sys/param.h is not included in the latter case.
Not sure why. Could be due to autoconf magic, perhaps, i.e. some
decision made by the configure script.
In any case, renaming MAXHOSTNAMELEN throughout the net_udp.cpp
file should fix it. Alternatively, since both expand to 256 anyway
you could also wrap line 59 like this:
#ifndef MAXHOSTNAMELEN
enum { MAXHOSTNAMELEN = 256 };
#endif