2024-11-22 00:22 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000106mercuryBugpublic2009-09-22 02:09
Reporterjanicek 
Assigned Tojuliensf 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000106: Linking with multiple C++ files yields a "duplicate symbol" error
DescriptionLinking a Mercury main module with two (or more) C++ files that utilise some Mercury code through pragma foreign_export fails with the linker reporting the following:

** Error making `mercury_main'.
ld: duplicate symbol _MR_trace_tailrec_have_reused_frames in CPlusPlus2.o and CPlusPlus1.o
collect2: ld returned 1 exit status

(See the attachment for a minimal example.)

The platform is Darwin (Mac OS X 10.5.8), using Apple's GCC 4.1.2 which is shipped with Xcode 3.1.2.

$ uname -a
Darwin dfki-guestpool3.dfki.uni-sb.de 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386

$ g++ --version
i686-apple-darwin9-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5566)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ mmc --version
Mercury Compiler, version rotd-2008-11-30, configured for i686-apple-darwin9.6.0
Copyright (C) 1993-2008 The University of Melbourne
Additional InformationAdding the keyword "extern" to variables

MR_trace_tailrec_have_reused_frames
and
MR_trace_tailrec_num_reused_frames

in `mercury_trace_base.h'

seems to resolve the issue, i.e. the program links and seems to run fine.
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0000183

janicek (reporter)

Ah, forgot to mention the grade -- it's hlc.gc. Sorry!

~0000184

juliensf (administrator)

The missing externs are a bug - I will fix this shortly.

~0000185

juliensf (administrator)

Fix committed - it will take a day or two to make its way into the ROTDS.
+Notes

-Issue History
Date Modified Username Field Change
2009-09-22 01:07 janicek New Issue
2009-09-22 01:07 janicek File Added: duplicate-symbol-error.tar.gz
2009-09-22 01:09 janicek Note Added: 0000183
2009-09-22 01:53 juliensf Note Added: 0000184
2009-09-22 01:53 juliensf Assigned To => juliensf
2009-09-22 01:53 juliensf Status new => assigned
2009-09-22 02:09 juliensf Note Added: 0000185
2009-09-22 02:09 juliensf Status assigned => resolved
2009-09-22 02:09 juliensf Resolution open => fixed
+Issue History