[GRASS5] CVS version of grass5 failing to compile nviz & r.in.gdal because of -ldl flag

Just tried to compile today's CVS version of GRASS5 (is CVS HEAD the right terminology if I've just checked out / updated the grass directory without specifying any tags?) so I could get the "history with r.mapcalc" working. I've posted separately about the fact that r.mapcalc itself won't compile on my Linux box.

But here on my Darwin/MacOS X machine, everything apparently compiled (including r.mapcalc, and it's recording the formulae used now - yay ! Thanks, Glynn !) except for r.in.gdal and NVIZ 2.2.

Digging deeper, the error was the same in both cases - when it tries to link everything together there's a lib flag for the DL library (-ldl) and libdl isn't found. IF I understand correctly (and that's a big if), libopen() etc are provided by dlcompat in this OS so there is no such DL library.

So... I tracked down the -ldl call to the head file, and just made the DLLIB variable empty in my copy of head.powerpc-apple-darwin6.1 - and then tried to compile NVIZ and it does so without an error.

Is that the appropriate fix ? NVIZ seems to be working now, anyways.

For some reason, taking the DLLIB definition away doesn't stop the compile for r.in.gdal from trying to load libdl so I still have that error, but will keep digging for it...

thanks,

------
Scott W. Mitchell smitch AT geog.utoronto.ca
Department of Geography
University of Toronto at Mississauga

Scott W Mitchell wrote:

Just tried to compile today's CVS version of GRASS5 (is CVS HEAD the
right terminology if I've just checked out / updated the grass
directory without specifying any tags?) so I could get the "history
with r.mapcalc" working. I've posted separately about the fact that
r.mapcalc itself won't compile on my Linux box.

But here on my Darwin/MacOS X machine, everything apparently compiled
(including r.mapcalc, and it's recording the formulae used now - yay !
Thanks, Glynn !) except for r.in.gdal and NVIZ 2.2.

Digging deeper, the error was the same in both cases - when it tries to
link everything together there's a lib flag for the DL library (-ldl)
and libdl isn't found. IF I understand correctly (and that's a big
if), libopen() etc are provided by dlcompat in this OS so there is no
such DL library.

So... I tracked down the -ldl call to the head file, and just made the
DLLIB variable empty in my copy of head.powerpc-apple-darwin6.1 - and
then tried to compile NVIZ and it does so without an error.

Is that the appropriate fix ? NVIZ seems to be working now, anyways.

For some reason, taking the DLLIB definition away doesn't stop the
compile for r.in.gdal from trying to load libdl so I still have that
error, but will keep digging for it...

1. The use of $(DLLIB) by NVIZ is gratuitous; the NVWISH2.2 binary
doesn't directly call dlopen() etc.

It's possible that one of the libraries against which NVIZ is linked
may require libdl on some platforms; however, that should be handled
by configure when detecting the library in question (libtcl and libGL
are both candidates; configure *does* check for $DLLIB when checking
libtcl).

2. r.in.gdal *does* use dlopen() unless you use the --with-gdal
configure switch. However, this is handled by configure, which adds
$DLLIB to GDAL_LIBS where appropriate (i.e. when you aren't using
--with-gdal).

3. However, neither of the above should really matter, because DLLIB
should be empty unless configure actually finds dlsym() in libdl.
Specifically, configure:

a) checks whether dlsym() is available without any additional
switches; if it is, then DLLIB is set to empty.

b) otherwise, it checks whether dlsym() is available when linking
against the "dl" library (i.e. with "-ldl"); if it is, then DLLIB is
set to "-ldl".

c) otherwise, DLLIB is set to empty.

The resulting value of DLLIB is used in the rest of the configure
script, and is substituted when converting src/CMD/head/head.in into
src/CMD/head/head (which is later renamed to e.g.
src/CMD/head/head.powerpc-apple-darwin6.1).

So, I'm curious as to why configure decided to set DLLIB to "-ldl" if
you don't have a library with that name.

--
Glynn Clements <glynn.clements@virgin.net>

I'm sorry, I didn't search for all the possibilities when I concluded that libdl was not on my system. Turns out there's a libdl.0.dylib in /sw/lib, which is where the fink packaging system puts things under Mac OS. Not sure how I managed to miss that, must have been dumb mistake.

Sure enough, configure found it:

configure:4491: checking for dlsym in -ldl
configure:4508: gcc -o conftest -g -O2 -I/sw/include -L/sw/lib conftest.c -
ldl 1>&5
configure:4535: checking for iconv
...

So, then the question is why the nviz compile can't find it:

/Volumes/newData/smitchHome/src/grass/src.contrib/GMSL/NVIZ2.2/src
   make -f OBJ.powerpc-apple-darwin6.1/make.rules

gcc -L/Volumes/newData/smitchHome/src/grass/src/libes/LIB.powerpc-apple-darwin6.1 -L/sw/lib -o nvwish OBJ.powerpc-apple-darwin6.1/nvizAppInit.o OBJ.powerpc-apple-darwin6.1/change_view.o OBJ.powerpc-apple-darwin6.1/draw.o OBJ.powerpc-apple-darwin6.1/exag.o OBJ.powerpc-apple-darwin6.1/glwrappers.o OBJ.powerpc-apple-darwin6.1/init_commands.o OBJ.powerpc-apple-darwin6.1/lights.o OBJ.powerpc-apple-darwin6.1/map_obj.o OBJ.powerpc-apple-darwin6.1/misc.o OBJ.powerpc-apple-darwin6.1/nviz_init.o OBJ.powerpc-apple-darwin6.1/position.o OBJ.powerpc-apple-darwin6.1/quick_draw.o OBJ.powerpc-apple-darwin6.1/anim_support.o OBJ.powerpc-apple-darwin6.1/cutplane_obj.o OBJ.powerpc-apple-darwin6.1/script_support.o OBJ.powerpc-apple-darwin6.1/do_zoom.o OBJ.powerpc-apple-darwin6.1/label.o OBJ.powerpc-apple-darwin6.1/nvizMain.o OBJ.powerpc-apple-darwin6.1/togl.o OBJ.powerpc-apple-darwin6.1/togl_cb.o OBJ.powerpc-apple-darwin6.1/query_postgr.o OBJ.powerpc-apple-darwin6.1/openvect.o OBJ.powerpc-apple-darwin6.1/getCat.o OBJ.powerpc-apple-darwin6.1/buildInfxQry.o OBJ.powerpc-apple-darwin6.1/runInfxQry.o /Volumes/newData/smitchHome/src/grass/src/libes/ogsf/LIB.powerpc-apple-darwin6.1/libgsf.a /Volumes/newData/smitchHome/src/grass/src/libes/libimage/LIB.powerpc-apple-darwin6.1/libimage.a \
-lbitmap -llinkm -lvect -ldig2 \
-lgis -lz \
-ldatetime -ltk -L/usr/X11R6/lib -lSM -lICE -lX11 -ltcl -L/usr/X11R6/lib -lGLU -L/usr/X11R6/lib -lGL -lSM -lICE -lX11 -lXmu -lXext -ldl -lz -L/usr/X11R6/lib -ltiff -lSM -lICE -lX11
ld: can't locate file for: -ldl
make[1]: *** [nvwish] Error 1
make: *** [nvwish] Error 2

I guess it has to do with Darwin peculiarities re: shared libs, but we just hit the walls of my understanding again. I don't see anything that explains it to me at http://fink.sourceforge.net/doc/porting/shared.php

I THOUGHT it might be to do with the problem reported at:
http://www.opendarwin.org/en/faq.php#linksym

because that says all the -L and -l statements need to be listed AFTER the object files, and that isn't the case in the failed compile above. But typing it in all manually at the command prompt so that the -L's and -l's come last did not change / get rid of the ld error for me.

Well, for now my workaround is to not include $DLLIB in the NVIZ compile, and I'll leave it at that for now, but can help track this down over time if needed.

Thanks,

Scott

On Monday, November 18, 2002, at 11:53 PM, Glynn Clements wrote:

Scott W Mitchell wrote:

Just tried to compile today's CVS version of GRASS5 (is CVS HEAD the
right terminology if I've just checked out / updated the grass
directory without specifying any tags?) so I could get the "history
with r.mapcalc" working. I've posted separately about the fact that
r.mapcalc itself won't compile on my Linux box.

But here on my Darwin/MacOS X machine, everything apparently compiled
(including r.mapcalc, and it's recording the formulae used now - yay !
Thanks, Glynn !) except for r.in.gdal and NVIZ 2.2.

Digging deeper, the error was the same in both cases - when it tries to
link everything together there's a lib flag for the DL library (-ldl)
and libdl isn't found. IF I understand correctly (and that's a big
if), libopen() etc are provided by dlcompat in this OS so there is no
such DL library.

So... I tracked down the -ldl call to the head file, and just made the
DLLIB variable empty in my copy of head.powerpc-apple-darwin6.1 - and
then tried to compile NVIZ and it does so without an error.

Is that the appropriate fix ? NVIZ seems to be working now, anyways.

For some reason, taking the DLLIB definition away doesn't stop the
compile for r.in.gdal from trying to load libdl so I still have that
error, but will keep digging for it...

1. The use of $(DLLIB) by NVIZ is gratuitous; the NVWISH2.2 binary
doesn't directly call dlopen() etc.

It's possible that one of the libraries against which NVIZ is linked
may require libdl on some platforms; however, that should be handled
by configure when detecting the library in question (libtcl and libGL
are both candidates; configure *does* check for $DLLIB when checking
libtcl).

2. r.in.gdal *does* use dlopen() unless you use the --with-gdal
configure switch. However, this is handled by configure, which adds
$DLLIB to GDAL_LIBS where appropriate (i.e. when you aren't using
--with-gdal).

3. However, neither of the above should really matter, because DLLIB
should be empty unless configure actually finds dlsym() in libdl.
Specifically, configure:

a) checks whether dlsym() is available without any additional
switches; if it is, then DLLIB is set to empty.

b) otherwise, it checks whether dlsym() is available when linking
against the "dl" library (i.e. with "-ldl"); if it is, then DLLIB is
set to "-ldl".

c) otherwise, DLLIB is set to empty.

The resulting value of DLLIB is used in the rest of the configure
script, and is substituted when converting src/CMD/head/head.in into
src/CMD/head/head (which is later renamed to e.g.
src/CMD/head/head.powerpc-apple-darwin6.1).

So, I'm curious as to why configure decided to set DLLIB to "-ldl" if
you don't have a library with that name.

--
Glynn Clements <glynn.clements@virgin.net>

A slight update, since it looks like it may explain what's happening; a random brain electron just fired, and I tried changing -ldl to -ldl.0 (i.e. added a "zero" version number since I have /sw/lib/libdl.0.dylib in my system) in a call to gcc, and it compiled the output file despite some TclTk symbol warnings. So I'm not sure what this means in terms of a portable solution as opposed to Darwin weirdness, but it gets around the error without taking away the DLLIB definition...

[fats:GMSL/NVIZ2.2/src] smitch% gcc -o nvwish OBJ.powerpc-apple-darwin6.1/nvizAppInit.o OBJ.powerpc-apple-darwin6.1/change_view.o OBJ.powerpc-apple-darwin6.1/draw.o OBJ.powerpc-apple-darwin6.1/exag.o OBJ.powerpc-apple-darwin6.1/glwrappers.o OBJ.powerpc-apple-darwin6.1/init_commands.o OBJ.powerpc-apple-darwin6.1/lights.o OBJ.powerpc-apple-darwin6.1/map_obj.o OBJ.powerpc-apple-darwin6.1/misc.o OBJ.powerpc-apple-darwin6.1/nviz_init.o OBJ.powerpc-apple-darwin6.1/position.o OBJ.powerpc-apple-darwin6.1/quick_draw.o OBJ.powerpc-apple-darwin6.1/anim_support.o OBJ.powerpc-apple-darwin6.1/cutplane_obj.o OBJ.powerpc-apple-darwin6.1/script_support.o OBJ.powerpc-apple-darwin6.1/do_zoom.o OBJ.powerpc-apple-darwin6.1/label.o OBJ.powerpc-apple-darwin6.1/nvizMain.o OBJ.powerpc-apple-darwin6.1/togl.o OBJ.powerpc-apple-darwin6.1/togl_cb.o OBJ.powerpc-apple-darwin6.1/query_postgr.o OBJ.powerpc-apple-darwin6.1/openvect.o OBJ.powerpc-apple-darwin6.1/getCat.o OBJ.powerpc-apple-darwin6.1/buildInfxQry.o OBJ.powerpc-apple-darwin6.1/runInfxQry.o /Volumes/newData/smitchHome/src/grass/src/libes/ogsf/LIB.powerpc-apple-darwin6.1/libgsf.a /Volumes/newData/smitchHome/src/grass/src/libes/libimage/LIB.powerpc-apple-darwin6.1/libimage.a -L/Volumes/newData/smitchHome/src/grass/src/libes/LIB.powerpc-apple-darwin6.1 -L/sw/lib -lbitmap -llinkm -lvect -ldig2 -lgis -lz -ldatetime -ltk -L/usr/X11R6/lib -lSM -lICE -lX11 -ltcl -L/usr/X11R6/lib -lGLU -L/usr/X11R6/lib -lGL -lSM -lICE -lX11 -lXmu -lXext -ldl.0 -lz -L/usr/X11R6/lib -ltiff -lSM -lICE -lX11
ld: warning multiple definitions of symbol _dataKey
/sw/lib/libtk.dylib(tkMain.o) definition of _dataKey
/sw/lib/libtcl.dylib(tclMain.o) definition of _dataKey
[fats:GMSL/NVIZ2.2/src] smitch% ls -l nvwish
-rwxr-xr-x 1 smitch unknown 1781440 Nov 19 12:20 nvwish
[fats:GMSL/NVIZ2.2/src] smitch% date
Tue Nov 19 12:20:23 EST 2002

On Tuesday, November 19, 2002, at 12:12 PM, Scott W Mitchell wrote:

I'm sorry, I didn't search for all the possibilities when I concluded that libdl was not on my system. Turns out there's a libdl.0.dylib in /sw/lib, which is where the fink packaging system puts things under Mac OS. Not sure how I managed to miss that, must have been dumb mistake.

Sure enough, configure found it:

configure:4491: checking for dlsym in -ldl
configure:4508: gcc -o conftest -g -O2 -I/sw/include -L/sw/lib conftest.c -
ldl 1>&5
configure:4535: checking for iconv
...

So, then the question is why the nviz compile can't find it:

/Volumes/newData/smitchHome/src/grass/src.contrib/GMSL/NVIZ2.2/src
  make -f OBJ.powerpc-apple-darwin6.1/make.rules

gcc -L/Volumes/newData/smitchHome/src/grass/src/libes/LIB.powerpc-apple-darwin6.1 -L/sw/lib -o nvwish OBJ.powerpc-apple-darwin6.1/nvizAppInit.o OBJ.powerpc-apple-darwin6.1/change_view.o OBJ.powerpc-apple-darwin6.1/draw.o OBJ.powerpc-apple-darwin6.1/exag.o OBJ.powerpc-apple-darwin6.1/glwrappers.o OBJ.powerpc-apple-darwin6.1/init_commands.o OBJ.powerpc-apple-darwin6.1/lights.o OBJ.powerpc-apple-darwin6.1/map_obj.o OBJ.powerpc-apple-darwin6.1/misc.o OBJ.powerpc-apple-darwin6.1/nviz_init.o OBJ.powerpc-apple-darwin6.1/position.o OBJ.powerpc-apple-darwin6.1/quick_draw.o OBJ.powerpc-apple-darwin6.1/anim_support.o OBJ.powerpc-apple-darwin6.1/cutplane_obj.o OBJ.powerpc-apple-darwin6.1/script_support.o OBJ.powerpc-apple-darwin6.1/do_zoom.o OBJ.powerpc-apple-darwin6.1/label.o OBJ.powerpc-apple-darwin6.1/nvizMain.o OBJ.powerpc-apple-darwin6.1/togl.o OBJ.powerpc-apple-darwin6.1/togl_cb.o OBJ.powerpc-apple-darwin6.1/query_postgr.o OBJ.powerpc-apple-darwin6.1/openvect.o OBJ.powerpc-apple-darwin6.1/getCat.o OBJ.powerpc-apple-darwin6.1/buildInfxQry.o OBJ.powerpc-apple-darwin6.1/runInfxQry.o /Volumes/newData/smitchHome/src/grass/src/libes/ogsf/LIB.powerpc-apple-darwin6.1/libgsf.a /Volumes/newData/smitchHome/src/grass/src/libes/libimage/LIB.powerpc-apple-darwin6.1/libimage.a \
-lbitmap -llinkm -lvect -ldig2 \
-lgis -lz \
-ldatetime -ltk -L/usr/X11R6/lib -lSM -lICE -lX11 -ltcl -L/usr/X11R6/lib -lGLU -L/usr/X11R6/lib -lGL -lSM -lICE -lX11 -lXmu -lXext -ldl -lz -L/usr/X11R6/lib -ltiff -lSM -lICE -lX11
ld: can't locate file for: -ldl
make[1]: *** [nvwish] Error 1
make: *** [nvwish] Error 2

I guess it has to do with Darwin peculiarities re: shared libs, but we just hit the walls of my understanding again. I don't see anything that explains it to me at http://fink.sourceforge.net/doc/porting/shared.php

I THOUGHT it might be to do with the problem reported at:
http://www.opendarwin.org/en/faq.php#linksym

because that says all the -L and -l statements need to be listed AFTER the object files, and that isn't the case in the failed compile above. But typing it in all manually at the command prompt so that the -L's and -l's come last did not change / get rid of the ld error for me.

Well, for now my workaround is to not include $DLLIB in the NVIZ compile, and I'll leave it at that for now, but can help track this down over time if needed.

Thanks,

Scott

On Monday, November 18, 2002, at 11:53 PM, Glynn Clements wrote:

Scott W Mitchell wrote:

Just tried to compile today's CVS version of GRASS5 (is CVS HEAD the
right terminology if I've just checked out / updated the grass
directory without specifying any tags?) so I could get the "history
with r.mapcalc" working. I've posted separately about the fact that
r.mapcalc itself won't compile on my Linux box.

But here on my Darwin/MacOS X machine, everything apparently compiled
(including r.mapcalc, and it's recording the formulae used now - yay !
Thanks, Glynn !) except for r.in.gdal and NVIZ 2.2.

Digging deeper, the error was the same in both cases - when it tries to
link everything together there's a lib flag for the DL library (-ldl)
and libdl isn't found. IF I understand correctly (and that's a big
if), libopen() etc are provided by dlcompat in this OS so there is no
such DL library.

So... I tracked down the -ldl call to the head file, and just made the
DLLIB variable empty in my copy of head.powerpc-apple-darwin6.1 - and
then tried to compile NVIZ and it does so without an error.

Is that the appropriate fix ? NVIZ seems to be working now, anyways.

For some reason, taking the DLLIB definition away doesn't stop the
compile for r.in.gdal from trying to load libdl so I still have that
error, but will keep digging for it...

1. The use of $(DLLIB) by NVIZ is gratuitous; the NVWISH2.2 binary
doesn't directly call dlopen() etc.

It's possible that one of the libraries against which NVIZ is linked
may require libdl on some platforms; however, that should be handled
by configure when detecting the library in question (libtcl and libGL
are both candidates; configure *does* check for $DLLIB when checking
libtcl).

2. r.in.gdal *does* use dlopen() unless you use the --with-gdal
configure switch. However, this is handled by configure, which adds
$DLLIB to GDAL_LIBS where appropriate (i.e. when you aren't using
--with-gdal).

3. However, neither of the above should really matter, because DLLIB
should be empty unless configure actually finds dlsym() in libdl.
Specifically, configure:

a) checks whether dlsym() is available without any additional
switches; if it is, then DLLIB is set to empty.

b) otherwise, it checks whether dlsym() is available when linking
against the "dl" library (i.e. with "-ldl"); if it is, then DLLIB is
set to "-ldl".

c) otherwise, DLLIB is set to empty.

The resulting value of DLLIB is used in the rest of the configure
script, and is substituted when converting src/CMD/head/head.in into
src/CMD/head/head (which is later renamed to e.g.
src/CMD/head/head.powerpc-apple-darwin6.1).

So, I'm curious as to why configure decided to set DLLIB to "-ldl" if
you don't have a library with that name.

--
Glynn Clements <glynn.clements@virgin.net>

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

------
Scott W. Mitchell smitch@geog.utoronto.ca
Department of Geography Phone: (613) 730-5375
University of Toronto at Mississauga UTM fax: (905) 828-5273
3359 Mississauga Road Local fax (613) 822-5143
Mississauga, ON L5L 1C6 Canada

OK, sorry to be answering my own post for the second time, but I found the answer, so here it is to make sure it's in the archives for the next person... at least I learned and hopefully nobody else (i.e. Glynn - thanks for all the help !) will expend effort on this before seeing that I have an answer.

Took a break and with a fresh mind, finally paid attention to the fact that I only had the .dylib version of libdl, and investigated that further. Turned out that at some point the fink dlcompat package got broken into 3 sub-packages, and I didn't have the -dev package that is needed to install the .a version of the library, AND it installs a "versionless" softlink to libdl.0.dylib, taking care of the version number that I worked around in my previous post.

So the answer is that Mac OS X users will need the dlcompat-dev package installed if they are using fink - there are also other ways to install the dlcompat package, but no matter how they do it, they need those bits - you want all three libdl files available:

[fats:GMSL/NVIZ2.2/src] smitch% fink list apropos dlcompat
Information about 1752 packages read in 3 seconds.

  i dlcompat 20021117-1 Dynamic loading compatibility library
  i dlcompat-dev 20021117-1 headers and static libraries for dlcompat
  i dlcompat-shlibs 20021117-1 shared libraries for dlcompat
[fats:GMSL/NVIZ2.2/src] smitch% ls -l /sw/lib/libdl*
-rw-r--r-- 1 root unknown 20852 Nov 18 11:28 /sw/lib/libdl.0.dylib
-rw-r--r-- 1 root unknown 15964 Nov 18 11:28 /sw/lib/libdl.a
lrwxr-xr-x 1 smitch unknown 13 Nov 19 13:28 /sw/lib/libdl.dylib -> libdl.0.dylib

On Tuesday, November 19, 2002, at 12:23 PM, Scott W Mitchell wrote:

A slight update, since it looks like it may explain what's happening; a random brain electron just fired, and I tried changing -ldl to -ldl.0 (i.e. added a "zero" version number since I have /sw/lib/libdl.0.dylib in my system) in a call to gcc, and it compiled the output file despite some TclTk symbol warnings. So I'm not sure what this means in terms of a portable solution as opposed to Darwin weirdness, but it gets around the error without taking away the DLLIB definition...

[trim]

On Monday, November 18, 2002, at 11:53 PM, Glynn Clements wrote:

Scott W Mitchell wrote:

[trimmed]

Digging deeper, the error was the same in both cases - when it tries to
link everything together there's a lib flag for the DL library (-ldl)
and libdl isn't found. IF I understand correctly (and that's a big
if), libopen() etc are provided by dlcompat in this OS so there is no
such DL library.

So... I tracked down the -ldl call to the head file, and just made the
DLLIB variable empty in my copy of head.powerpc-apple-darwin6.1 - and
then tried to compile NVIZ and it does so without an error.

[trimmed]

1. The use of $(DLLIB) by NVIZ is gratuitous; the NVWISH2.2 binary
doesn't directly call dlopen() etc.

It's possible that one of the libraries against which NVIZ is linked
may require libdl on some platforms; however, that should be handled
by configure when detecting the library in question (libtcl and libGL
are both candidates; configure *does* check for $DLLIB when checking
libtcl).

2. r.in.gdal *does* use dlopen() unless you use the --with-gdal
configure switch. However, this is handled by configure, which adds
$DLLIB to GDAL_LIBS where appropriate (i.e. when you aren't using
--with-gdal).

3. However, neither of the above should really matter, because DLLIB
should be empty unless configure actually finds dlsym() in libdl.
Specifically, configure:

a) checks whether dlsym() is available without any additional
switches; if it is, then DLLIB is set to empty.

b) otherwise, it checks whether dlsym() is available when linking
against the "dl" library (i.e. with "-ldl"); if it is, then DLLIB is
set to "-ldl".

c) otherwise, DLLIB is set to empty.

The resulting value of DLLIB is used in the rest of the configure
script, and is substituted when converting src/CMD/head/head.in into
src/CMD/head/head (which is later renamed to e.g.
src/CMD/head/head.powerpc-apple-darwin6.1).

So, I'm curious as to why configure decided to set DLLIB to "-ldl" if
you don't have a library with that name.

--
Glynn Clements <glynn.clements@virgin.net>

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

Scott W Mitchell wrote:

I'm sorry, I didn't search for all the possibilities when I concluded
that libdl was not on my system. Turns out there's a libdl.0.dylib in
/sw/lib, which is where the fink packaging system puts things under Mac
OS. Not sure how I managed to miss that, must have been dumb mistake.

Sure enough, configure found it:

configure:4491: checking for dlsym in -ldl
configure:4508: gcc -o conftest -g -O2 -I/sw/include -L/sw/lib
conftest.c -
ldl 1>&5
configure:4535: checking for iconv
...

So, then the question is why the nviz compile can't find it:

ld: can't locate file for: -ldl

I guess it has to do with Darwin peculiarities re: shared libs, but we
just hit the walls of my understanding again. I don't see anything
that explains it to me at
http://fink.sourceforge.net/doc/porting/shared.php

I THOUGHT it might be to do with the problem reported at:
http://www.opendarwin.org/en/faq.php#linksym

because that says all the -L and -l statements need to be listed AFTER
the object files, and that isn't the case in the failed compile above.
But typing it in all manually at the command prompt so that the -L's
and -l's come last did not change / get rid of the ld error for me.

My suspicion is that this is an oughtright bug rather than just a
"peculiarity". However, you could try performing the configure check
manually in two stages (compile, link) with:

  gcc -c -g -O2 -I/sw/include conftest.c
  gcc -o conftest -g -O2 -L/sw/lib conftest.o -ldl

in case there is a difference between compiling/linking in one step
(as is done by configure) and linking separately (as is done by the
actual build process).

The actual test program is just:

  char dlsym();
  
  int main() {
  dlsym()
  ; return 0; }

OTOH, it might be related to the number of linker switches. This is
partly gratuituous; NVIZ2.2/src/Gmakefile shouldn't be explicitly
referencing the X libraries; however, it should be referencing both
OpenGL and Tcl/Tk, and both of those may have the X libraries as
dependencies.

--
Glynn Clements <glynn.clements@virgin.net>

Scott W Mitchell wrote:

OK, sorry to be answering my own post for the second time, but I found
the answer, so here it is to make sure it's in the archives for the
next person... at least I learned and hopefully nobody else (i.e. Glynn
- thanks for all the help !) will expend effort on this before seeing
that I have an answer.

Took a break and with a fresh mind, finally paid attention to the fact
that I only had the .dylib version of libdl, and investigated that
further. Turned out that at some point the fink dlcompat package got
broken into 3 sub-packages, and I didn't have the -dev package that is
needed to install the .a version of the library, AND it installs a
"versionless" softlink to libdl.0.dylib, taking care of the version
number that I worked around in my previous post.

So the answer is that Mac OS X users will need the dlcompat-dev package
installed if they are using fink - there are also other ways to install
the dlcompat package, but no matter how they do it, they need those
bits - you want all three libdl files available:

From a user's perspective, that probably counts as an answer, but from
a developers perspective it's only half of an answer. It explains why
linking NVWISH2.2 failed; however, it doesn't explain why linking the
configure test succeeded.

The whole point of the configure test is to determine whether a
particular set of switches will result in successfully constructing a
program which requires a particular function. A false positive is the
worst possible result, because configure claims that everything is OK,
then goes on to add switches will break the build process.

--
Glynn Clements <glynn.clements@virgin.net>