Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#3526 closed defect (fixed)

Build errors on Solaris

Reported by: ripleybd Owned by: warmerdam
Priority: low Milestone: 1.8.0
Component: default Version: 1.7.1
Severity: normal Keywords:
Cc: pvachon


I have been building GDAL on Solaris with the SunStudio compilers. There were several issues:

$(CC) is used to compile C++ in frmts/pcidsk/GNUmakefile

g++ is hardcoded in frmts/pcidsk/sdk/Makefile

port/cpl_port.h simply leaves CPL_INLINE empty, and this will not work (lots of multiply defined symbols). My understanding that 'inline' is standard (C99 and C++), but if you want to do something else my patch will need altering.

The SunStudio compiler wants extern "C" declared around all the components in alg/gdalmediancut.cpp or it generates a mangled symbol.

frmts/pcidsk/sdk/segment/metadatasegment_p.cpp frmts/pcidsk/sdk/pcidsk_exception.h need to declare use of namespace std

Attachments (1)

gdal.patch (3.6 KB ) - added by ripleybd 14 years ago.

Download all attachments as: .zip

Change History (4)

by ripleybd, 14 years ago

Attachment: gdal.patch added

comment:1 by Even Rouault, 14 years ago

Cc: pvachon added
  • $(CC) vs $(CXX) issue already fixed in trunk in r18656. I've just backported the change in branches/1.7 in r19356
  • frmts/pcidsk/sdk/Makefile is unused by GDAL build process
  • in branches/1.7 (r19357) and in trunk (r19358) : "Avoid definition functions in cpl_atomic_port.h if CPL_INLINE is not defined; define them in the .cpp file instead". Ideally a configure test should fill CPL_INLINE with the right keyword, but that fix should be enough for compiling.
  • I don't understand why extern "C" is needed in alg/gdalmediancut.cpp, so I won't apply this part for now. The GDALComputeMedianCutPCT() and GDALDitherRGB2PCT() symbols are declared within a CPL_C_START / CPL_C_END block in gdal_alg.h, so they should be exported without any C++ mangling. I'm not sure why this would be needed again in the .cpp file. And the problem should be identical for GDALChecksumImage() and the other symbols declared in gdal_alg.h. So there's something particular there that you should identify more clearly.
  • For frmts/pcidsk/sdk/segment/metadatasegment_p.cpp frmts/pcidsk/sdk/pcidsk_exception.h, this should be fixed in upstream pcidsk sdk first. So I let Frank or Phil deal with that.

comment:2 by Even Rouault, 13 years ago

Milestone: 1.8.0
Resolution: fixed
Status: newclosed

With the latest changes in trunk, GDAL in its default configuration builds under Solaris 10 / SunStudio 12

comment:3 by Even Rouault, 13 years ago

I reproduced the issue with gdalmediancut.cpp on OpenIndiana with the sunstudioexpress version in its repo (I think the bug has been fixed in later sunstudio version).

Fixed in r20629 /trunk/gdal/alg/gdalmediancut.cpp: Workaround sunstudio (pre 12) bug that uses C++ linkage instead of C one (#3526)

Note: See TracTickets for help on using tickets.