[GRASS-dev] library not found

Hi,

This is my first mail to the list, so be patience with ignorance, please.

I am trying to compile a program from mac terminal. This program is seemed to need some grass libraries. I write on the terminal ‘make; make install’ and this is the result:

$ make;make install

gcc ew_horizon.o fileio.o grassio.o -L/lib -lm -lgrass_gis -o ew_horizon
ld: library not found for -lgrass_gis
collect2: ld returned 1 exit status
make: *** [ew_horizon] Error 1
gcc ew_horizon.o fileio.o grassio.o -L/lib -lm -lgrass_gis -o ew_horizon
ld: library not found for -lgrass_gis
collect2: ld returned 1 exit status
make: *** [ew_horizon] Error 1


-lgrass_gis is noted on the makefile as:

PGM = cf7
EW_PGM = ew_horizon
CC = gcc
CFLAGS =
RHESSYS_BIN = /usr/local/bin

OBJECTS = main.o build_flow_table.o fileio.o find_patch.o check_neighbours.o zero_flow_table.o
print_flow_table.o sort_flow_table.o compute_gamma.o remove_pits.o
find_top.o in_list.o adjust_pit.o add_roads.o find_stream.o
find_max_flna.o find_min_flna.o route_roads_to_patches.o compute_upslope_area.o
print_drain_stats.o compute_drainage_density.o compute_dist_from_road.o print_stream_table.o
grassio.o

LIBS = -lm
GIS_LIBS = -lgrass_gis

$(PGM): $(EW_PGM) $(OBJECTS)
$(CC) $(OBJECTS) -L$(GISBASE)/lib $(GIS_LIBS) $(LIBS) $(CFLAGS) -o $(PGM)

$(EW_PGM): ew_horizon.o fileio.o grassio.o
$(CC) ew_horizon.o fileio.o grassio.o $(CFLAGS) -L$(GISBASE)/lib $(LIBS) $(GIS_LIBS) -o $(EW_PGM)

install: $(PGM) $(EW_PGM)
cp $(PGM) $(RHESSYS_BIN)
cp $(EW_PGM) $(RHESSYS_BIN)

clean:
rm -f $(OBJECTS) ew_horizon.o

clobber: clean
rm -f $(PGM) $(EW_PGM)

print_drain_stats.o:
$(CC) $(CFLAGS) -c print_drain_stats.c
print_stream_table.o:
$(CC) $(CFLAGS) -c print_stream_table.c
print_flow_table.o:
$(CC) $(CFLAGS) -c print_flow_table.c
zero_flow_table.o:
$(CC) $(CFLAGS) -c zero_flow_table.c
in_list.o:
$(CC) $(CFLAGS) -c in_list.c
adjust_pit.o:
$(CC) $(CFLAGS) -c adjust_pit.c
ew_horizon.o: ew_horizon.c
$(CC) -I$(GISBASE)/include $(CFLAGS) -c ew_horizon.c
add_roads.o:
$(CC) $(CFLAGS) -c add_roads.c
find_top.o:
$(CC) $(CFLAGS) -c find_top.c
find_stream.o:
$(CC) $(CFLAGS) -c find_stream.c
find_min_flna.o:
$(CC) $(CFLAGS) -c find_min_flna.c
find_max_flna.o:
$(CC) $(CFLAGS) -c find_max_flna.c
remove_pits.o:
$(CC) $(CFLAGS) -c remove_pits.c
sort_flow_table.o:
$(CC) $(CFLAGS) -c sort_flow_table.c
build_flow_table.o: build_flow_table.c
$(CC) $(CFLAGS) -c build_flow_table.c
compute_upslope_area.o:
$(CC) $(CFLAGS) -c compute_upslope_area.c
compute_dist_from_road.o:
$(CC) $(CFLAGS) -c compute_dist_from_road.c
compute_drainage_density.o:
$(CC) $(CFLAGS) -c compute_drainage_density.c
compute_gamma.o:
$(CC) $(CFLAGS) -c compute_gamma.c
route_roads_to_patches.o:
$(CC) $(CFLAGS) -c route_roads_to_patches.c
find_patch.o:
$(CC) $(CFLAGS) -c find_patch.c
fileio.o:
$(CC) $(CFLAGS) -c fileio.c
grassio.o:
$(CC) $(CFLAGS) -I$(GISBASE)/include -c grassio.c
main.o: main.c
$(CC) $(CFLAGS) -I$(GISBASE)/include -c main.c

Thank you in advance.

javi.

It seems that grass_gis is not in the library path. Usually it is in
<install_path>/grass-<version>/lib, I think. This path needs to be
added, on e.g. Linux to /etc/ld.so.conf.d/ (check your distro) where
you could add a file like grass.conf with the path to the grass
library directory in it.

HTH,

Markus M

2010/4/28 <jzabalza@ipe.csic.es>:

Hi,

This is my first mail to the list, so be patience with ignorance, please.

I am trying to compile a program from mac terminal. This program is seemed
to need some grass libraries. I write on the terminal 'make; make install'
and this is the result:

$ make;make install

gcc ew_horizon.o fileio.o grassio.o -L/lib -lm -lgrass_gis -o
ew_horizon
ld: library not found for -lgrass_gis
collect2: ld returned 1 exit status
make: *** [ew_horizon] Error 1
gcc ew_horizon.o fileio.o grassio.o -L/lib -lm -lgrass_gis -o
ew_horizon
ld: library not found for -lgrass_gis
collect2: ld returned 1 exit status
make: *** [ew_horizon] Error 1

--------

-lgrass_gis is noted on the makefile as:

PGM = cf7
EW_PGM = ew_horizon
CC = gcc
CFLAGS =
RHESSYS_BIN = /usr/local/bin

OBJECTS = main.o build_flow_table.o fileio.o find_patch.o check_neighbours.o
zero_flow_table.o \
print_flow_table.o sort_flow_table.o compute_gamma.o remove_pits.o \
find_top.o in_list.o adjust_pit.o add_roads.o find_stream.o \
find_max_flna.o find_min_flna.o route_roads_to_patches.o
compute_upslope_area.o \
print_drain_stats.o compute_drainage_density.o compute_dist_from_road.o
print_stream_table.o \
grassio.o

LIBS = -lm
GIS_LIBS = -lgrass_gis

$(PGM): $(EW_PGM) $(OBJECTS)
$(CC) $(OBJECTS) -L$(GISBASE)/lib $(GIS_LIBS) $(LIBS) $(CFLAGS) -o
$(PGM)

$(EW_PGM): ew_horizon.o fileio.o grassio.o
$(CC) ew_horizon.o fileio.o grassio.o $(CFLAGS) -L$(GISBASE)/lib $(LIBS)
$(GIS_LIBS) -o $(EW_PGM)

install: $(PGM) $(EW_PGM)
cp $(PGM) $(RHESSYS_BIN)
cp $(EW_PGM) $(RHESSYS_BIN)

clean:
rm -f $(OBJECTS) ew_horizon.o

clobber: clean
rm -f $(PGM) $(EW_PGM)

print_drain_stats.o:
$(CC) $(CFLAGS) -c print_drain_stats.c
print_stream_table.o:
$(CC) $(CFLAGS) -c print_stream_table.c
print_flow_table.o:
$(CC) $(CFLAGS) -c print_flow_table.c
zero_flow_table.o:
$(CC) $(CFLAGS) -c zero_flow_table.c
in_list.o:
$(CC) $(CFLAGS) -c in_list.c
adjust_pit.o:
$(CC) $(CFLAGS) -c adjust_pit.c
ew_horizon.o: ew_horizon.c
$(CC) -I$(GISBASE)/include $(CFLAGS) -c ew_horizon.c
add_roads.o:
$(CC) $(CFLAGS) -c add_roads.c
find_top.o:
$(CC) $(CFLAGS) -c find_top.c
find_stream.o:
$(CC) $(CFLAGS) -c find_stream.c
find_min_flna.o:
$(CC) $(CFLAGS) -c find_min_flna.c
find_max_flna.o:
$(CC) $(CFLAGS) -c find_max_flna.c
remove_pits.o:
$(CC) $(CFLAGS) -c remove_pits.c
sort_flow_table.o:
$(CC) $(CFLAGS) -c sort_flow_table.c
build_flow_table.o: build_flow_table.c
$(CC) $(CFLAGS) -c build_flow_table.c
compute_upslope_area.o:
$(CC) $(CFLAGS) -c compute_upslope_area.c
compute_dist_from_road.o:
$(CC) $(CFLAGS) -c compute_dist_from_road.c
compute_drainage_density.o:
$(CC) $(CFLAGS) -c compute_drainage_density.c
compute_gamma.o:
$(CC) $(CFLAGS) -c compute_gamma.c
route_roads_to_patches.o:
$(CC) $(CFLAGS) -c route_roads_to_patches.c
find_patch.o:
$(CC) $(CFLAGS) -c find_patch.c
fileio.o:
$(CC) $(CFLAGS) -c fileio.c
grassio.o:
$(CC) $(CFLAGS) -I$(GISBASE)/include -c grassio.c
main.o: main.c
$(CC) $(CFLAGS) -I$(GISBASE)/include -c main.c

Thank you in advance.

javi.

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Better is to set GISBASE to the path to your installed GRASS. The OSX install location (standard app build) is Applications folder. So if you have GRASS 6.4 installed:

export GISBASE="/Applications/GRASS-6.4.app/Contents/MacOS"

Then make. Note, you will need to use sudo on the install: sudo make install.

On Apr 28, 2010, at 12:46 PM, Markus Metz wrote:

It seems that grass_gis is not in the library path. Usually it is in
<install_path>/grass-<version>/lib, I think. This path needs to be
added, on e.g. Linux to /etc/ld.so.conf.d/ (check your distro) where
you could add a file like grass.conf with the path to the grass
library directory in it.

HTH,

Markus M

2010/4/28 <jzabalza@ipe.csic.es>:

Hi,

This is my first mail to the list, so be patience with ignorance, please.

I am trying to compile a program from mac terminal. This program is seemed
to need some grass libraries. I write on the terminal 'make; make install'
and this is the result:

$ make;make install

gcc ew_horizon.o fileio.o grassio.o -L/lib -lm -lgrass_gis -o
ew_horizon
ld: library not found for -lgrass_gis
collect2: ld returned 1 exit status
make: *** [ew_horizon] Error 1
gcc ew_horizon.o fileio.o grassio.o -L/lib -lm -lgrass_gis -o
ew_horizon
ld: library not found for -lgrass_gis
collect2: ld returned 1 exit status
make: *** [ew_horizon] Error 1

--------

-lgrass_gis is noted on the makefile as:

PGM = cf7
EW_PGM = ew_horizon
CC = gcc
CFLAGS =
RHESSYS_BIN = /usr/local/bin

OBJECTS = main.o build_flow_table.o fileio.o find_patch.o check_neighbours.o
zero_flow_table.o \
print_flow_table.o sort_flow_table.o compute_gamma.o remove_pits.o \
find_top.o in_list.o adjust_pit.o add_roads.o find_stream.o \
find_max_flna.o find_min_flna.o route_roads_to_patches.o
compute_upslope_area.o \
print_drain_stats.o compute_drainage_density.o compute_dist_from_road.o
print_stream_table.o \
grassio.o

LIBS = -lm
GIS_LIBS = -lgrass_gis

$(PGM): $(EW_PGM) $(OBJECTS)
    $(CC) $(OBJECTS) -L$(GISBASE)/lib $(GIS_LIBS) $(LIBS) $(CFLAGS) -o
$(PGM)

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

[Trillian] What are you supposed to do WITH a maniacally depressed robot?

[Marvin] You think you have problems? What are you supposed to do if you ARE a maniacally depressed robot? No, don't try and answer, I'm 50,000 times more intelligent than you and even I don't know the answer...

- HitchHiker's Guide to the Galaxy

jzabalza@ipe.csic.es wrote:

   This is my first mail to the list, so be patience with ignorance,
please.

I am trying to compile a program from mac terminal. This program is
seemed to need some grass libraries.

I strongly suggest that you use the include/Make/*.make files, as if
you were writing a module within GRASS.

You will need to set MODULE_TOPDIR, and override certain variables,
e.g. ARCH_DISTDIR, RUN_GISBASE.

--
Glynn Clements <glynn@gclements.plus.com>