Migrating to the gcc 4.3 compiler

Accessing the compiler

gcc4.3 is not installed by default in either slc4 or slc5. To access it, source the script /afs/cern.ch/sw/lcg/contrib/gcc/4.3/slc4_amd64_gcc34/setup.csh, which modifies LD_LIBRARY_PATH and PATH as follows:
  • Add to the front of LD_LIBRARY_PATH: /afs/cern.ch/sw/lcg/contrib/gcc/4.3/slc4_amd64_gcc34/lib64:/afs/cern.ch/sw/lcg/contrib/mpfr/2.3.1/slc4_amd64_gcc34/lib:/afs/cern.ch/sw/lcg/contrib/gmp/4.2.2/slc4_amd64_gcc34/lib
  • Add to the front of PATH: /afs/cern.ch/sw/lcg/contrib/gcc/4.3/slc4_amd64_gcc34/bin

Accessing gcc43 builds

Currently we are building the LHCb software with gcc43 in the lhcb3 slot of the LHCb nightlies. To compile against these nightlies with gcc43:
setenv CMTCONFIG slc4_amd64_gcc43_dbg
SetupProject LHCb HEAD --build-env --nightly lhcb3

Common compilation errors

You should first look in the excellent migration guide provided by gnu. Below are hints on solving other common errors or warnings.

Errors

error: specialization of someNamespace::ClassA::ClassA() [with PBASE = ClassB] in different namespace

Comes from code like:
template <>
someNamespace::ClassA<ClassB>::ClassA()
  : ClassB ( ) {}
It is fixed by putting the template definition explicitly inside the namespace:
namespace someNamespace {
  template<>
  ClassA<ClassB>::ClassA()
    : ClassB ( ) {}
}

error: extra qualification 'someClass::' on member 'someMember'

Comes from code like:
class someClass {
  void someClass::someMember();
}
Simply remove the extra qualification:
class someClass {
  void someMember();
}

Warnings

warning: type qualifiers ignored on function return type

Comes from code like:
inline const unsigned int aNumber() const { return aVector.size() ; }
This is a warning because the first const keyword does not make sense, when you return by value you make a copy. To fix, remove the const:
inline unsigned int aNumber() const { return aVector.size() ; }
Of course, if the function is not inlined, you will also have to modify the implementation. Similarly if the function is virtual and some derived class over-rides it.

warning: 'someEnum::someEnumValue' defined but not used

We can get hundreds of such warnings, one for any enum value defined in any included header file. Such warnings are annoying because they make finding other warnings and errors more difficult, but they magically disappear when all other warnings and errors are fixed! I have no idea why!

warnings from Boost and/or Xerces

We can get hundreds of warnings from Boost and/or Xerces header files, unfortunately for the time being there is no workaround. The following warnings are known:
boost-1_37/boost/lambda/detail/lambda_functors.hpp:137: warning: type qualifiers ignored on function return type
boost-1_37/boost/lambda/detail/select_functions.hpp:55: warning: type qualifiers ignored on function return type
boost-1_37/boost/lambda/detail/select_functions.hpp:60: warning: type qualifiers ignored on function return type
boost-1_37/boost/lambda/detail/select_functions.hpp:65: warning: type qualifiers ignored on function return type
boost-1_37/boost/iterator/iterator_facade.hpp:652: warning: type qualifiers ignored on function return type
XercesC/2.8.0/slc4_amd64_gcc43/include/xercesc/framework/XMLBuffer.hpp:140: warning: suggest a space before ';' or explicit braces around empty body in 'for' statement

-- MarcoCattaneo - 17 Dec 2008

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r5 - 2009-02-11 - MarcoCattaneo
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LHCb All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback