bugDDD - Bugs: bug #24874, C/C++ linkage errors building DDD...

 
 

bug #24874: C/C++ linkage errors building DDD 3.3.11

Submitter:  None
Submitted:  Tue 18 Nov 2008 07:17:28 PM UTC
 
Category:  Build Severity:  3 - Normal
Item Group:  None Status:  Works For Me
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       No canned response available

 

( Jump to the original submission )

Wed 26 Nov 2008 09:31:05 AM UTC, comment #9: 

Good that it works for you.

I should think the upstream are aware of the problem, it seems to be quite an old bug: see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=377230, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=377100.

I've not come across it on any of my machines.  I think it probably only occurs if you have a combination of old libXt headers (RHEL 4.2 is quite old now) with a more recent GCC.  Apparently it was only in GCC 4.2 that the compiler started being picky about matching data declarations.

Anyway, I'm closing this report now, hopefully if anyone else runs into this one they will have this workaround to refer to.

Peter Wainwright <pwainwright>
Tue 25 Nov 2008 10:21:30 PM UTC, comment #8: 

Removing the "C" doesn't work for me: it only leads back to the original c/c++ linkage conflict error.

On the other hand Peter hit it right on the head.  The conditional works like a charm for me.  I think I will save this for my bags of tricks.  Thanks a chump to both Peter and Marcelo for your help and patient.

Is this something that needs to be flowed to the X/Xt/Motif/Lesstif people?

T.V. Nguyen <thomas_n>
Tue 25 Nov 2008 08:08:19 AM UTC, comment #7: 

Ah, but DocSpace.c is an ordinary C file, not C++.

I find some versions of gcc don't like the extern "C" construct in plain C mode.  So, try this fragment instead:

#ifdef VMS
#define externalref globalref
#define externaldef(psect) globaldef {"psect"} noshare
#else
#if defined(__cplusplus) || defined(c_plusplus)
#define externalref extern "C"
#define externaldef(psect)
#else
#define externalref extern
#define externaldef(psect)
#endif
#endif /* VMS */

Peter Wainwright <pwainwright>
Tue 25 Nov 2008 12:27:29 AM UTC, comment #6: 

Try to remove the "C" you added in the header when you reach this other error, then continue with the build.
It's strange... here works with and without the "C" when compiling DocSpace.c

Marcelo A. B. Slomp <mslomp>
Mon 24 Nov 2008 10:31:53 PM UTC, comment #5: 

No, I didn't copy the "<=== here" string.  That part was obvious.

The error was encountered while compiling DocSpace.c (see attached make.log) so I recompiled it with the -E option.  The exact command used is (copied from make command, only changing -c into -E and modifying the argument to -o option):

gcc -DHAVE_CONFIG_H -I. -I. -I.  -I./.. -isystem /usr/X11R6/include   -g -O2 -MT DocSpace.o -MD -MP -MF ".deps/DocSpace.Tpo" -E -o DocSpace.prep DocSpace.c

As far as I can tell all of the extern "C" declarations in the attached DocSpace.prep look correct.  However, I'm not a C++ expert so I'm sure I'm missing something.

(file #16917, file #16918)

T.V. Nguyen <thomas_n>
Sat 22 Nov 2008 10:06:43 AM UTC, comment #4: 

These are the lines where the externalref macro is used.

Look at the preprocessed source (using g++ with the -E option) to see what this actually expanded to.  It should give lines like

extern "C" WidgetClass shellWidgetClass;
extern "C" WidgetClass overrideShellWidgetClass;
extern "C" WidgetClass wmShellWidgetClass;
extern "C" WidgetClass transientShellWidgetClass;
extern "C" WidgetClass topLevelShellWidgetClass;
extern "C" WidgetClass applicationShellWidgetClass;
extern "C" WidgetClass sessionShellWidgetClass;

I hope you didn't accidentally copy/paste "<=== here" from the recipe below.  It would cause a syntax error if you left it in...

Peter Wainwright <pwainwright>
Sat 22 Nov 2008 01:11:25 AM UTC, comment #3: 

The workaround gets pass the previous error but runs into a new one:

/usr/X11R6/include/X11/Core.h:58: error: expected identifier or '(' before string constant

which is exhibited in numerous places:

/usr/X11R6/include/X11/Core.h:61
/usr/X11R6/include/X11/Composite.h:101
/usr/X11R6/include/X11/Constraint.h:56
/usr/X11R6/include/X11/Object.h:57
/usr/X11R6/include/X11/RectObj.h:57
/usr/X11R6/include/X11/Intrinsic.h:632
/usr/X11R6/include/X11/Intrinsic.h:633
/usr/X11R6/include/X11/CoreP.h:58
/usr/X11R6/include/X11/CoreP.h:167
/usr/X11R6/include/X11/CompositeP.h:102
/usr/X11R6/include/X11/ConstrainP.h:89
/usr/X11R6/include/X11/ObjectP.h:133
/usr/X11R6/include/X11/RectObjP.h:127

T.V. Nguyen <thomas_n>
Thu 20 Nov 2008 01:54:12 AM UTC, comment #2: 

This is a known issue that affects libXt 1.0.5 against lesstif 0.95.0 and is not DDD related.
I have not a solution, but a workaround: edit the /usr/include/X11/Intrinsic.h header file and at line 99 append a "C":

...
098: #else
099: #define externalref extern "C"   <=== here
100: #define externaldef(psect)
...

then ddd will build fine (@ 1686-pc-linux, GCC 4.3.2 && 4.4.0-svn)

Marcelo A. B. Slomp <mslomp>
Tue 18 Nov 2008 09:05:52 PM UTC, comment #1: 

This shouldn't happen on a properly configured Motif system, because the X/Xt/Motif declarations should be protected by extern "C".

Please go to the "ddd" subdirectory of the source, run the commands

g++ -DHAVE_CONFIG_H -I.  -I./.. -g -E -C ddd.C > ddd.I
g++ -DHAVE_CONFIG_H -I.  -I./.. -g -E -dM ddd.C > ddd.macros

and post the resulting files ddd.I and ddd.macros.

On my development systems, the Xt Intrinsics are protected by the macros _XFUNCPROTOBEGIN and _XFUNCPROTOEND which expand to

#define _XFUNCPROTOBEGIN extern "C" {
#define _XFUNCPROTOEND }

but for some reason this isn't working for you.

Peter Wainwright <pwainwright>
Tue 18 Nov 2008 07:17:28 PM UTC, original submission:  

While building DDD 3.3.11 from source on Red Hat Enterprise Linux 4.2 with GCC 4.2.2 and using LessTif 0.95.0, the following errors were encountered:

/usr/X11R6/include/X11/VendorP.h:87: error: previous declaration of 'VendorShellClassRec vendorShellClassRec' with 'C++' linkage
/usr/local/include/Xm/VendorSP.h:58: error: conflicts with new declaration with 'C' linkage

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #16917:  make.log added by thomas_n (61KiB - application/octet-stream)
file #16918:  DocSpace.prep added by thomas_n (132KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by thomas_n (Posted a comment)
  • -email is unavailable- added by mslomp (Posted a comment)
  • -email is unavailable- added by pwainwright (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

     

     

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-11-26 pwainwright StatusNeed Info Works For Me
        Open/ClosedOpen Closed
    2008-11-24 thomas_n Attached File- Added make.log, #16917
        Attached File- Added DocSpace.prep, #16918
    2008-11-18 pwainwright StatusNone Need Info

    Back to the top


    Powered by Savane 3.9