[GRASS5] [bug #2232] (grass) FreeBSD configure/build issues in 5.7
Request Tracker
grass-bugs at intevation.de
Fri Nov 21 00:31:37 EST 2003
this bug's URL: http://intevation.de/rt/webrt?serial_num=2232
-------------------------------------------------------------------------
Subject: FreeBSD configure/build issues in 5.7
Platform: other
grass obtained from: CVS
grass binary for platform: Compiled from Sources
GRASS Version: CVS for 5.7 checked out 20031120
When trying to configure grass5.7 under FreeBSD I encountered the following issues:
1) LOC_CHECK_VERSION lead to an (inconsequential) core dump during configure
2) the probe for GL didn't work out of the box, needed some help
3) aclocal.m4 has FreeBSD-specific code that set "SHLIB_LD" in a way that
caused gcc to exit with an error during the attempt to build datetime.so
4) include/Make/Shlib.make uses the C compiler as a linker with SHLIB_LD
as its arguments --- even when SHLIB_LD is fixed up to look like
gcc arguments instead of a loader this fails, but if the make rule
is changed to use SHLIB_LD as the loader I was able to get past this
particular failure.
Here's more details:
1) LOC_CHECK_VERSION tries to check PROJ4's version in two ways, first by
trying to fputs(PJ_VERSION,fp), then using an fprintf. The first causes
a segfault on FreeBSD. Seeing this segfault caused me to go down
several blind alleys looking for a problem, where there was none --
the second try actually found the version just fine.
2) The probe for GL tries to build with -lpthread if -lGL didn't link.
Turns out that on FreeBSD the way to get pthreads is to include -pthread
in CFLAGS. There's code in aclocal.m4 that puts -pthread into
EXTRA_CFLAGS, but this isn't used inside configure for any probes. I
had to use CFLAGS="-pthread" in the configure line.
3) Here's a big one: in the FreeBSD specific code in aclocal.m4, SHLIB_LD
is set to "ld -Bshareable -x", and then in include/Make/Shlib.make
SHLIB_LD is used in a $(CC) line as extra flags. Since "-x" is the
gcc option used to specify alternate languages, the build dies with a
complaint "unrecognized language ..../between.o". A more correct
SHLIB_LD would be "-Wl,-Bshareable,-x" if it were to be used as arguments
for $(CC)... but more on that later
Reading through the aclocal.m4, there seems to be an inconsistency in how
SHLIB_LD is set. In some cases (as in the various BSDs) it looks like
it's meant to be used as the program to run (with options) to get
shared libraries, and in others it appears to be intended as extra flags
for $(CC).
4) After tweaking configure so that SHLIB_LD was "-Wl,-Bshareable,-x",
the attempt to build libgrass_datetime.so dies with a complaint about an
undefined reference to "main":
The exact command that's dying is:
gcc -export-dynamic -L/users/russo/src/grass_experimental/grass57_exp_2003_11_15/dist.i386-unknown-freebsd4.8/lib -rpath -Wl,-Bshareable,-x \
OBJ.i386-unknown-freebsd4.8/between.o \
OBJ.i386-unknown-freebsd4.8/copy.o OBJ.i386-unknown-freebsd4.8/same.o \
OBJ.i386-unknown-freebsd4.8/diff.o OBJ.i386-unknown-freebsd4.8/error.o \
OBJ.i386-unknown-freebsd4.8/format.o OBJ.i386-unknown-freebsd4.8/incr1.o \
OBJ.i386-unknown-freebsd4.8/incr2.o OBJ.i386-unknown-freebsd4.8/incr3.o \
OBJ.i386-unknown-freebsd4.8/local.o OBJ.i386-unknown-freebsd4.8/misc.o \
OBJ.i386-unknown-freebsd4.8/change.o OBJ.i386-unknown-freebsd4.8/scan.o \
OBJ.i386-unknown-freebsd4.8/sign.o OBJ.i386-unknown-freebsd4.8/type.o \
OBJ.i386-unknown-freebsd4.8/tz1.o OBJ.i386-unknown-freebsd4.8/tz2.o \
OBJ.i386-unknown-freebsd4.8/values.o -o \
/users/russo/src/grass_experimental/grass57_exp_2003_11_15/dist.i386-unknown-freebsd4.8/lib/libgrass_datetime.so
which results in
/usr/lib/crt1.o: In function `_start':
/usr/lib/crt1.o(.text+0x82): undefined reference to `main'
It appears that this problem is due to the use of $(CC) ... $(SHLIB_LD) as the shared-library linker. gcc is trying to link an executable, not a shared library.
When I edited include/Make/Shlib.make to use $(SHLIB_LD) instead of $(CC)...$(SHLIB_LD), and returned SHLIB_LD to the "ld -Bshareable -x" it had been initially, I was able to get farther along in the build. I've not
yet been successful in getting the whole thing built (I'm currently stuck during a link phase), but these issues took a long time to get past.
-------------------------------------------- Managed by Request Tracker
More information about the grass-dev
mailing list