[MacPorts] #36924: gcc47 @4.7.2 or ld(64) problem

MacPorts noreply at macports.org
Thu Nov 8 15:25:07 PST 2012


#36924: gcc47 @4.7.2 or ld(64) problem
--------------------------------+-------------------
  Reporter:  angelo.graziosi@…  |      Owner:  mww@…
      Type:  defect             |     Status:  new
  Priority:  Normal             |  Milestone:
 Component:  ports              |    Version:  2.1.2
Resolution:                     |   Keywords:
      Port:  gcc47              |
--------------------------------+-------------------

Comment (by angelo.graziosi@…):

 Replying to [comment:3 jeremyhu@…]:
 > Compile each individually and then link together, so it will tell you
 which units have the collisions.

 This is the result:

 {{{
 g++-mp-4.7 -c ../fparser.cc
 g++-mp-4.7 -c ../fpoptimizer.cc
 g++-mp-4.7 -c example.cc

 g++-mp-4.7 fparser.o fpoptimizer.o example.o -o example.out
 duplicate symbol
 FunctionParserBase<double>::FunctionWrapper::FunctionWrapper() in:
     fparser.o
     fpoptimizer.o
 duplicate symbol
 FunctionParserBase<double>::FunctionWrapper::FunctionWrapper() in:
     fparser.o
     fpoptimizer.o
 duplicate symbol
 FunctionParserBase<double>::FunctionWrapper::FunctionWrapper(FunctionParserBase<double>::FunctionWrapper
 const&) in:
     fparser.o
     fpoptimizer.o
 [...]
 }}}

 Anyway, I am not searching for what causes the error between fparser,
 fpoptimizer, example...

 Really I discovered the error in a completely different way..

 I was interfacing in Fortran 2003 the parser
 (http://warp.povusers.org/FunctionParser), and after interfacing the
 Optimize() member function, I got that error.

 So I searched for a simpler test case to flag to the parser peoples and I
 found that step 6 above gives the same error. I flagged this to the parser
 peoples which answered


 {{{
 Which version of gcc are you using? There's nothing in the constructor
 of FunctionWrapper that should cause this because it's an inline
 function (which, by definition, should cause no duplicated symbols.)

 I think some compilers have a bug where explicitly instantiating a
 templated class in different compilation units would cause even inline
 functions to cause duplicate symbol errors, but AFAIK that's a bug and
 a problem with the compiler itself.
 }}}

 and after I replayed it was gcc47 on Mac OSX Lion+Xcode 4.5.2+MacPorts the
 suggestion was


 {{{
 You should also try clang on the Mac. [...]

 Since this is a linker error, I'm wondering if the problem is with the
 linker in Mac OS X.
 }}}

 And indeed, with clang++, step 6 above works


 {{{
 clang++ example.cc ../fparser.cc ../fpoptimizer.cc -o example.out

 ./example.out
 [bla bla bla...]
 }}}

 After this, for curiosity, I tried the same on Cygwin and GN/Linux: all
 the GCC there works as expected.

 Only the MacPors gcc47, gcc46, gcc45 fails with that error! (Now I have
 tried also gcc45 and gcc46)


 However, you can test steps 1 - 6 above yourself. It take less tha 5
 minutes... :-)

 Ciao, Angelo.

-- 
Ticket URL: <https://trac.macports.org/ticket/36924#comment:4>
MacPorts <http://www.macports.org/>
Ports system for Mac OS


More information about the macports-tickets mailing list