Uploaded image for project: 'CLHEP'
  1. CLHEP
  2. CLHEP-103

Build/linking failure with clang 3.4: Undefined symbols

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.4.x
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • External issue ID:
      bugs104110
    • Savannah Fields Container:
      Hide
      Item Group: None
      Operating System: other (please specify compiler version as well)
      Show
      Item Group: None Operating System: other (please specify compiler version as well)

      Description

      Building CLHEP fails when using clang version 3.4:

      Linking CXX shared library ../../lib/libCLHEP-RandomObjects-2.1.4.1.dylib
      
      /opt/local/bin/clang++-mp-3.4  -O2 -g -DNDEBUG -dynamiclib -Wl,-headerpad_max_install_names   -o ../../lib/libCLHEP-RandomObjects-2.1.4.1.dylib -install_name /path/to/clhep-build/lib/libCLHEP-RandomObjects-2.1.4.1.dylib CMakeFiles/RandomObjects.dir/RandMultiGauss.cc.o CMakeFiles/RandomObjects.dir/RandomVector.cc.o ../../lib/libCLHEP-Random-2.1.4.1.dylib ../../lib/libCLHEP-Matrix-2.1.4.1.dylib ../../lib/libCLHEP-Vector-2.1.4.1.dylib ../../lib/libCLHEP-Random-2.1.4.1.dylib 
      Undefined symbols for architecture x86_64:
        "CLHEP::HepVector::num_row() const", referenced from:
            CLHEP::HepRandomVector::operator()() in RandomVector.cc.o
      ld: symbol(s) not found for architecture x86_64
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      make[2]: *** [lib/libCLHEP-RandomObjects-2.1.4.1.dylib] Error 1
      make[1]: *** [RandomObjects/src/CMakeFiles/RandomObjects.dir/all] Error 2
      make: *** [all] Error 2
      

      This has been tested and confirmed on Mac OS X 10.9 with Xcode 5.1 (Apple just switched to clang 3.4 as the default compiler) as well as on Mac OS X 10.7 where CC/CXX has explicitly been set to clang version 3.4. Compiling with clang version 3.3 works ok. There is a fair chance that the same problem can be reproduced on linux, but I didn't try it.

      I'm unable to figure out if this is an actual compiler bug or if the compiler just became more "picky" about the code. In case it's a compiler bug, it would be very desirable to find a minimum example reproducing the problem and submitting an upstream bug report. In case the compiler is being "picky", it would be great to fix this.

        Attachments

          Activity

            People

            • Assignee:
              garren Lynn Garren
              Reporter:
              mojca Mojca Miklavec (Inactive)
              Component Watchers:
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: