Opened 14 years ago

Closed 14 years ago

#3650 closed defect (fixed)

Multiply defined symbols when using SunPro compiler.

Reported by: jhayes Owned by: warmerdam
Priority: normal Milestone: 1.7.3
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

I'm building GDAL with the SunPro compiler. When linking I get multiply defined symbols for CPLAtomicInc and CPLAtomicDec.

I was able to fix it by setting CPL_INLINE when using SunPro (see the patch).

I should not have had to do this. It looks like the idiom GDAL uses to inline functions does not work. For example:

#ifdef CPL_INLINE CPL_INLINE int CPLAtomicInc(volatile int* ptr) {

return CPLAtomicAdd(ptr, 1);

} #else int CPL_DLL CPLAtomicInc(volatile int* ptr); #endif

This will alway take the first branch because CPL_INLINE is always defined.

However the following idiom does

Attachments (3)

sunpro-inline.patch (488 bytes ) - added by jhayes 14 years ago.
sunpro-inline-2.patch (552 bytes ) - added by jhayes 14 years ago.
sunpro-rasterio.patch (6.7 KB ) - added by jhayes 14 years ago.

Download all attachments as: .zip

Change History (7)

by jhayes, 14 years ago

Attachment: sunpro-inline.patch added

in reply to:  description comment:1 by jhayes, 14 years ago

Replying to jhayes: ignore the last "However the following idiom does" i did not preview before submitting.

comment:2 by Even Rouault, 14 years ago

Milestone: 1.7.3
Resolution: fixed
Status: newclosed

r19884 /trunk/gdal/port/ (cpl_atomic_ops.cpp cpl_atomic_ops.h cpl_port.h): Avoid definition functions in cpl_atomic_port.h if CPL_INLINE is defined to empty (re-fix r19358, #3526) and add support for SunPro compiler while we're at it (#3650)

r19885 /branches/1.7/gdal/port/ (cpl_atomic_ops.cpp cpl_atomic_ops.h cpl_port.h): Avoid definition functions in cpl_atomic_port.h if CPL_INLINE is defined to empty (re-fix r19358, #3526) and add support for SunPro compiler while we're at it (#3650)

by jhayes, 14 years ago

Attachment: sunpro-inline-2.patch added

by jhayes, 14 years ago

Attachment: sunpro-rasterio.patch added

comment:3 by jhayes, 14 years ago

Resolution: fixed
Status: closedreopened

Sorry, it looks like the last patch only worked on SunPro 12. I've added sunpro-inline-2.patch that I've tested on both 11 and 12.

When I was building on SunPro 11, I was having namespace problems in gcore/rasterio.cpp, see sunpro-rasterio.patch for a fix.

comment:4 by Even Rouault, 14 years ago

Resolution: fixed
Status: reopenedclosed

r19886 /trunk/gdal/port/cpl_port.h: Make CPL_INLINE compatible with both SunPro 11 & 12 (#3650)

r19887 /branches/1.7/gdal/port/cpl_port.h: Make CPL_INLINE compatible with both SunPro 11 & 12 (#3650)

For the rasterio thing, please open a separate new ticket with more details why it is necessary. I'm not a C++ expert to judge myself ;-)

Note: See TracTickets for help on using tickets.