Opened 19 years ago

Last modified 19 years ago

#852 closed defect (fixed)

Does not build on Solaris with CC/cc

Reported by: harri.kiiskinen@… Owned by: warmerdam
Priority: high Milestone:
Component: default Version: unspecified
Severity: critical Keywords:
Cc:

Description

GDAL 1.2.6 does not build on Solaris 5.9, SPARC:

A warning is issued:
"cpl_multiproc.cpp", line 239: Warning: function int(void(*)(void*),void*)
overloads extern "C" int(extern "C" void(*)(void*),void*) because of different
language linkages.

This line is part of the definition of CPLCreateThread, and, when linking with
programs, it results in:
CC -fast -xarch=native64 ogrinfo.o -L.. -lgdal -lz -lm -ldl   -o ogrinfo
Undefined                       first referenced
 symbol                             in file
CPLCreateThread                     ../libgdal.so
ld: fatal: Symbol referencing errors. No output written to ogrinfo

The compilers are:
cc: Sun C 5.5 2003/03/12
CC: Sun C++ 5.5 2003/03/12

With g++/gcc the library compiles ok, but won't run, because libgcc_s is only
32bit on the system I'm using. With cc/CC everything is 64bit, which is quite
nice, as I'm compiling GRASS for use with GRASS.

I have absolutely no idea what the warning above means, but it doesn't seem to
be to complex an issue.

Change History (4)

comment:1 by harri.kiiskinen@…, 19 years ago

Actually, the page http://www.glenmccl.com/ansi028.htm may give an explanation
to this: a change in the linkage standards. I guess this means, that where the
name should be mangled, it isn't, or then the other way around. Probably also
the definition(s) of the function CPLCreateThread should be included in an
extern "C" block as well. Or then appropriate typedefs should be included.

I do have the feeling, this is not the only place where this problem appears...
Haven't been able to link furhther yet.

(In reply to comment #0)
> GDAL 1.2.6 does not build on Solaris 5.9, SPARC:
> 
> A warning is issued:
> "cpl_multiproc.cpp", line 239: Warning: function int(void(*)(void*),void*)
> overloads extern "C" int(extern "C" void(*)(void*),void*) because of different
> language linkages.
> 
> This line is part of the definition of CPLCreateThread, and, when linking with
> programs, it results in:
> CC -fast -xarch=native64 ogrinfo.o -L.. -lgdal -lz -lm -ldl   -o ogrinfo
> Undefined                       first referenced
>  symbol                             in file
> CPLCreateThread                     ../libgdal.so
> ld: fatal: Symbol referencing errors. No output written to ogrinfo
> 
> The compilers are:
> cc: Sun C 5.5 2003/03/12
> CC: Sun C++ 5.5 2003/03/12
> 
> With g++/gcc the library compiles ok, but won't run, because libgcc_s is only
> 32bit on the system I'm using. With cc/CC everything is 64bit, which is quite
> nice, as I'm compiling GRASS for use with GRASS.
> 
> I have absolutely no idea what the warning above means, but it doesn't seem to
> be to complex an issue.


comment:2 by warmerdam, 19 years ago

Harri, 

This has been reported and fixed by changing line 237 in cpl_multiproc.cpp
to read:

int CPLCreateThread( CPLThreadFunc pfnMain, void *pArg )

instead of 

int CPLCreateThread( void (*pfnMain)(void *), void *pArg )


1.2.7 should be ok, but in the meantime you can easily modify your 1.2.6
version.

comment:3 by harri.kiiskinen@…, 19 years ago

This look very sensible, but of course you need to have a declaration and a
definition for CPLThreadFunc somewhere; just doing this replacement is not
enough. Everything compiles happily when the definition of the function is
enclosed in a CPL_C_START - CPL_C_END -block.

comment:4 by warmerdam, 19 years ago

Harri,

I thought the definition:

typedef void (*CPLThreadFunc)(void *);

was already in cpl_multiproc.h in 1.2.6.  Perhaps not.  In not, it would need
to be added as well.

Note: See TracTickets for help on using tickets.