Opened 10 years ago

Closed 8 years ago

#838 closed defect (invalid)

Compile error for lib/driver

Reported by: sprice Owned by: grass-dev@…
Priority: normal Milestone: 6.4.0
Component: Default Version: svn-releasebranch64
Keywords: Cc:
CPU: OSX/Intel Platform: MacOSX

Description

When compiling the GRASS GIS from SVN source (& RC5), I have this bug during compilation. I use this line for ./configure:

./configure "CFLAGS=-g -Wall -O" --with-iconv --with-freetype --with-freetype-includes=/usr/local/include/freetype2 --with-opengl=aqua --without-tcltk --libdir=/usr/local/lib --with-cxx

But I have this error:

cp -f /usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/bin./grass64 /usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/dist./grass64.tmp
/usr/bin/install -c  tools/mkhtml.sh /usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/dist./tools/ 2>/dev/null
build_html_index.sh
Generating HTML manual pages index (help system)...
Generated HTML docs in ../dist./docs/html/index.html
----------------------------------------------------------------------
Following modules are missing the 'description.html' file in src code:
----------------------------------------------------------------------
GRASS GIS compilation log
-------------------------
Started compilation: Tue Dec 15 12:41:07 MST 2009
--
Errors in:
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/lib/driver
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/lib/pngdriver
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/lib/psdriver
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/lib/raster
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/lib/display
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/drivers/PNG
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/drivers/HTMLMAP
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/drivers/PS
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.ask
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.barscale
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.colorlist
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.colors
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.colortable
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.erase
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.extend
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.extract
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.font
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.frame
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.geodesic
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.graph
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.grid
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.his
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.histogram
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.info
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.legend
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.linegraph
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.mapgraph
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.measure
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.menu
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.mon/cmd
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.mon/pgms
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.nviz
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.paint.labels
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.path
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.profile
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.rast
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.rast.arrow
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.rast.num
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.rgb
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.rhumbline
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.save
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.text.new
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.thematic.area
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.title
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.vect
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.vect.chart
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.what.rast
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.what.vect
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.where
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/display/d.zoom
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/general/g.mapset
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/imagery/i.ask
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/raster/r.le/r.le.setup
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/raster/r.le/r.le.trace
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/raster/r.profile
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/raster/wildfire/r.spread
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/vector/v.label
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/vector/v.label.sa
--
In case of errors please change into the directory with error and run 'make'.
If you get multiple errors, you need to deal with them in the order they
appear in the error log. If you get an error building a library, you will
also get errors from anything which uses the library.
--
Finished compilation: Tue Dec 15 12:49:22 MST 2009
make: *** [default] Error 1
seth:grass-6.4.svn_src_snapshot_2009_12_12 sprice$ cd lib/driver/
seth:driver sprice$ make
cc -dynamiclib -compatibility_version 6.4 -current_version 6.4 -install_name /usr/local/grass-6.4.0svn/lib/libgrass_driver.dylib -o /usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/dist./lib/libgrass_driver.6.4.0svn.dylib -L/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/dist./lib      OBJ./Bitmap.o OBJ./Box.o OBJ./Client.o OBJ./Color.o OBJ./Cont.o OBJ./Draw.o OBJ./Erase.o OBJ./Font.o OBJ./Get_location.o OBJ./Get_t_box.o OBJ./Graph.o OBJ./Line_width.o OBJ./Move.o OBJ./Panel.o OBJ./Polydots.o OBJ./Polyline.o OBJ./Polygon.o OBJ./Raster.o OBJ./Respond.o OBJ./Returns.o OBJ./Set_window.o OBJ./Text.o OBJ./Text_size.o OBJ./Work.o OBJ./font2.o OBJ./font_freetype.o OBJ./init.o OBJ./pad.o OBJ./parse_ftcap.o OBJ./text2.o OBJ./text3.o OBJ./main.o OBJ./command.o OBJ./connect_sock.o -lgrass_gis -lgrass_datetime -lz     -lfreetype  -liconv   && \
	(cd /usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/dist./lib; ln -f -s libgrass_driver.6.4.0svn.dylib /usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/dist./lib/libgrass_driver.dylib)
Undefined symbols:
  "_libiconv_close", referenced from:
      _draw_main in text3.o
  "_libiconv", referenced from:
      _draw_main in text3.o
  "_libiconv_open", referenced from:
      _draw_main in text3.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/dist./lib/libgrass_driver.6.4.0svn.dylib] Error 1

So the simple fix for it is to add "-L/usr/local/lib" to the cc command. You can see from my './configure' above that I tried to force it to use the correct library directory, but somehow this is lost when compiling the driver. So I just copy-paste in the correct flag, and compile proceeds as it should.

seth:driver sprice$ cc -dynamiclib -compatibility_version 6.4 -current_version 6.4 -install_name /usr/local/grass-6.4.0svn/lib/libgrass_driver.dylib -o /usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/dist./lib/libgrass_driver.6.4.0svn.dylib -L/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/dist./lib      OBJ./Bitmap.o OBJ./Box.o OBJ./Client.o OBJ./Color.o OBJ./Cont.o OBJ./Draw.o OBJ./Erase.o OBJ./Font.o OBJ./Get_location.o OBJ./Get_t_box.o OBJ./Graph.o OBJ./Line_width.o OBJ./Move.o OBJ./Panel.o OBJ./Polydots.o OBJ./Polyline.o OBJ./Polygon.o OBJ./Raster.o OBJ./Respond.o OBJ./Returns.o OBJ./Set_window.o OBJ./Text.o OBJ./Text_size.o OBJ./Work.o OBJ./font2.o OBJ./font_freetype.o OBJ./init.o OBJ./pad.o OBJ./parse_ftcap.o OBJ./text2.o OBJ./text3.o OBJ./main.o OBJ./command.o OBJ./connect_sock.o -lgrass_gis -lgrass_datetime -lz     -lfreetype  -liconv   -L/usr/local/lib && (cd /usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/dist./lib; ln -f -s libgrass_driver.6.4.0svn.dylib /usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12/dist./lib/libgrass_driver.dylib)
seth:driver sprice$ cd -
/usr/local/grass/grass-6.4.svn_src_snapshot_2009_12_12
seth:grass-6.4.svn_src_snapshot_2009_12_12 sprice$ make

I'm filing this bug in the hopes that someone forgot to included the flag somewhere in the make process, and we can fix that.

Change History (10)

comment:1 Changed 10 years ago by sprice

Version: unspecifiedsvn-releasebranch64

comment:2 Changed 10 years ago by sprice

CPU: UnspecifiedOSX/Intel
Platform: UnspecifiedMacOSX

comment:3 Changed 10 years ago by kyngchaos

the flag is --with-libs.

comment:4 Changed 10 years ago by sprice

It compiles fine with that flag, but make still gives problems without any flag. (iconv is found in by configure)

comment:5 Changed 10 years ago by kyngchaos

Without the flag, iconv will be found in the system, so no lib/include flags will be added to compilation. Your --with-iconv flag does nothing - GRASS doesn't have an option to configure a custom location to iconv, so you're left with using --with-libs. I think the main reason configure checks at all is to see if iconv functions need a library or are in an automatic system library.

I haven't had problems yet with using the system libiconv on OSX. Possibly what you're getting is a confusion of iconv versions - compilation sees the system iconv (/usr/include/iconv.h) because you don't specify --with-includes=/usr/local/include, but when linking finds /usr/local/lib/libiconv because you've configured to look for FreeType? in /usr/local so -L/usr/local/lib is in your link command.

comment:6 Changed 10 years ago by sprice

Looks like it works with "--libdir=/usr/local/lib", but doesn't work with "--with-includes=/usr/local/include" instead of "libdir=...".

You're right, it is probably a versioning issue, though. Looks like fink has a copy installed in /sw/lib and I have a copy in /usr/local/lib.

comment:7 Changed 10 years ago by kyngchaos

You need to be very detailed with GRASS configure. use both --with-libs and --with-includes. That way compilation will find the right headers and linking will find the right libs.

comment:8 in reply to:  7 Changed 10 years ago by glynn

Replying to kyngchaos:

You need to be very detailed with GRASS configure. use both --with-libs and --with-includes. That way compilation will find the right headers and linking will find the right libs.

It goes beyond that. There is no (portable) way to tell the compiler/linker to look for a specific header/library in a specific directory. You specify header/library search paths with -I/-L switches, then all headers/libraries are located using the same search path.

If you have multiple versions of a library installed, there may not be any combination of options which will make it work. Two modules which both use a particular library may use different combinations of other libraries, resulting in different combinations of -L switches, resulting in different versions of the first library being used.

If you happen get into this situation, the only reliable way out of it (other than uninstalling stuff) is to create a dedicated header/library directory populated with symlinks to the desired versions, and specify that directory as the only additional header/library directory to be used.

For the most part, it's much easier to just ensure that you don't have more than one version of anything. Of course, that's easier said than done if your OS vendor only ships versions which have been considered "stable" for at least three years but you need to use some FOSS package whose maintainers view anything over a month old as a historical relic.

comment:9 Changed 10 years ago by kyngchaos

So, is this sorted out for you now?

comment:10 Changed 8 years ago by kyngchaos

Resolution: invalid
Status: newclosed

closing from lack of feedback. include behavior is as expected.

Note: See TracTickets for help on using tickets.