Opened 8 years ago

Last modified 6 years ago

#3230 new defect

lib/raster/gdal.c – missing libgdal.20.dylib in the GDAL library names list

Reported by: vince Owned by: grass-dev@…
Priority: normal Milestone: 7.4.5
Component: LibRaster Version: svn-releasebranch72
Keywords: macosx Cc:
CPU: Unspecified Platform: MacOSX

Description

static void load_library(void)
{
    static const char *const candidates[] = {
# ifdef __unix__
    "libgdal.so.20",
    "libgdal.so.1",
    "libgdal.1.1.so",
    "gdal.1.0.so",
    "gdal.so.1.0",
    "libgdal.so",
    "libgdal1.6.0.so",
    "libgdal1.7.0.so",
# endif

Humm… where is “libgdal.20.dylib” for poor MacOS X users?

Shame on you! :P :P

Change History (19)

comment:1 by martinl, 8 years ago

Keywords: macosx added
Milestone: 7.0.6

comment:2 by martinl, 8 years ago

Based on (1) correct identification is

__APPLE__ && __MACH__

or

__APPLE__

is enough?

(1) https://sourceforge.net/p/predef/wiki/OperatingSystems/

comment:3 by vince, 8 years ago

Will try and let you know. Thanks for your reactivity

comment:4 by vince, 8 years ago

test.c:

#include <stdio.h>

int main (int argc, char * argv []) {

#ifdef __APPLE__
    printf ("Apple!\n");
#else
    print ("Something else. Yuck :P\n");
#endif
}
Air > clang -o test test.c
Air > ./test
Apple!

in reply to:  3 comment:5 by martinl, 8 years ago

Replying to vince:

Will try and let you know. Thanks for your reactivity

really for my reactivity? No, thanks :-)

comment:6 by vince, 8 years ago

Woops, sorry. I didn’t mean you were sour. :P Sometimes when I’m tuckered some French words manage to seep in.

I’m still stuck though. Adding the dylib name won’t suffice, as MacOS X doesn’t define LD_LIBRARY_PATH, so the whole path is needed.

Isn’t there a way to define default library paths at compile time?

comment:7 by vince, 8 years ago

By the way, _ _unix_ _ is not defined by clang on MacOS, so I have to replace all occurrences of _ _unix_ _ by _ _APPLE_ _. It would be nice to have both in the code…

Last edited 8 years ago by vince (previous) (diff)

comment:8 by neteler, 7 years ago

Milestone: 7.0.67.0.7

comment:9 by neteler, 7 years ago

Milestone: 7.0.77.4.1

Since GDAL 2.3.0 is due soon, I was wondering how up-to-date the code in question is:

lib/raster/gdal.c

static void load_library(void)
{
    static const char *const candidates[] = {
# ifdef __unix__
	"libgdal.so.20",
	"libgdal.so.1",
	"libgdal.1.1.so",
	"gdal.1.0.so",
	"gdal.so.1.0",
	"libgdal.so",
	"libgdal1.6.0.so",
	"libgdal1.7.0.so",
# endif
# ifdef _WIN32
	"gdal202.dll",        
	"gdal201.dll",
	"gdal200.dll",
	"gdal111.dll",
	"gdal110.dll",
	"gdal19.dll",
	"gdal18.dll",
	"gdal17.dll",
	"gdal16.dll",
	"gdal15.dll",
	"gdal11.dll",
	"gdal.1.0.dll",
	"libgdal-1.dll",
	"gdal.dll",
# endif
	NULL
    };
    int i;

This ticket is still open, so probably it should be all revisited now.

comment:10 by neteler, 6 years ago

Milestone: 7.4.17.4.2

in reply to:  9 comment:11 by neteler, 6 years ago

Replying to neteler:

Since GDAL 2.3.0 is due soon, I was wondering how up-to-date the code in question is:

lib/raster/gdal.c

... any suggestion? This is now rather imminent.

comment:12 by neteler, 6 years ago

gdal203.dll was added in r73573:73575

Not sure about other needed changes?

# ifdef __unix__

seems to be lagging behind?

@cmbarton: what about MacOS? Should libgdal.20.dylib or similar be added?

comment:13 by neteler, 6 years ago

Milestone: 7.4.27.4.3

Ticket retargeted after milestone closed

comment:14 by martinl, 6 years ago

Milestone: 7.4.37.4.4

Bump milestone to 7.4.4

comment:15 by neteler, 6 years ago

Milestone: 7.4.47.4.5

Ticket retargeted after milestone closed

comment:16 by vince, 6 years ago

This hasn't been corrected in 7.6 :(

Also, I think the smartest way to handle this is to make the configure script record the proper path to the GDAL library using gdal-config. Once the access path is known, there is no need for that (silly?) function enumerating all possible names and forgetting about some.

Also more ifdef APPLE are needed here and there in the same file.

comment:17 by neteler, 6 years ago

@vince: do you see a chance to provide a patch?

comment:18 by vince, 6 years ago

Yes, I could probably do that within a few days, if you’re willing to integrate it.

in reply to:  18 comment:19 by neteler, 6 years ago

Replying to vince:

Yes, I could probably do that within a few days, if you’re willing to integrate it.

Problem solving contributions are always welcome :-)

Note: See TracTickets for help on using tickets.