You are here

Rosetta compilation error through newer gcc-g++ versions

6 posts / 0 new
Last post
Rosetta compilation error through newer gcc-g++ versions
#1

Dear fellows,

I have recently downloaded and untar new version of Rosetta - as a rosetta_src_2020.03.61102_bundle folder. When I tried to compile it via standart command "./scons.py -j6 mode=release bin" in /main/source/ directory, I got such error:

"g++: warning: switch '-ffor-scope' is no longer supported

g++ -o build/src/release/linux/5.5/64/x86/gcc/9/default/utility/string_util.os -c -std=c++0x -ffor-scope -isystem external/boost_1_55_0/ -isystem external/ -isystem external/include/ -isystem external/dbio/ -isystem external/libxml2/include -pipe -Wall -Wextra -pedantic -Wno-long-long -Wno-strict-aliasing -march=core2 -mtune=generic -O3 -ffast-math -fno-finite-math-only -funroll-loops -finline-functions -finline-limit=20000 -s -Wno-unused-variable -Wno-unused-parameter -fPIC -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS -DPTR_STD -DNDEBUG -Isrc -Iexternal/include -Isrc/platform/linux/64/gcc/9 -Isrc/platform/linux/64/gcc -Isrc/platform/linux/64 -Isrc/platform/linux src/utility/string_util.cc

...

collect2: error: ld returned 1 exit status

scons: *** [build/src/release/linux/5.5/64/x86/gcc/9/default/libObjexxFCL.so] Error 1

scons: building terminated because of errors."

I have also tried to do such command "./scons.py -j6 mode=release bin gcc_ver=4.8" and got the same error.

I would like to compile Rosetta through gcc-4.8, because of newer versions of gcc-g++ aren't suitable for Rosetta compiling.

Could you tell me, how can I compile Rosetta with a help of particular gcc-version, please?

I will be sincerely grateful for your responses, and I am looking forward to it.

Best regards,

Corvin.

Category: 
Post Situation: 
Thu, 2020-03-12 01:00
Corvin

I had the same problem with the newer versions of gcc/g++. After much frantic trial and error below was what worked for me ( mpi version of rosetta 2017.52.59948) :

1) Installing gcc , g++ (version -5 for me) though old debian sources or what ever works for you

 

2) getting mpicc and mpic++ wrappers to use gcc-5 and g++-5 by adding to .bashc

OMPI_CC=gcc-5 mpicc --showme:command
OMPI_CXX=g++-5 mpic++ --showme:command
export OMPI_CC=gcc-5
export OMPI_CXX=g++-5

 

3) Adding to under "overwrites" in site.settings (rosetta_src_2017.52.59948_bundle/main/source/tools.site.settings) as below (https://www.rosettacommons.org/docs/latest/build_documentation/Build-Documentation) :

import os
settings = {
    "site" : {
        "prepends" : {
# Allows detection of the default compiler on your normal path
            "program_path" : os.environ["PATH"].split(":") if "PATH" in os.environ else [],
# Allows finding system libraries in non-standard locations
            "library_path" : os.environ["LD_LIBRARY_PATH"].split(":") if "LD_LIBRARY_PATH" in os.environ else [],
## Uncomment the following line if you have non-standard include paths in your $INCLUDE environment variable
## (Commented out because $INCLUDE is not normally set
#            "include_path" : os.environ["INCLUDE"].split(":") if "INCLUDE" in os.environ else [],
        },
        "appends" : {
        },
        "overrides" : {
                    "cc" : "mpicc", #ADD THIS for mpicc ! or alternatively change to : "cc" : "<compiler you intend to use>"
                    "cxx" : "mpic++", #ADD THIS to get rosetta to use mpic++ ! or alternatively change to : "cc" : "<compiler you intend to use>"
        },
        "removes" : {
        },
    },
}

 

I belive you can skip (2) if you are not using mpi and if issuing g++-4/gcc-4 or g++-5/gcc-5 command in your terminal brings up g++/gcc then just simply enter change under overides (e.g. gcc-4 or g++-4)

 

4) compile accordingly.

Mon, 2020-04-13 21:23
free_radical

First the compiler version setting on the scons command line don't actually switch the compiler used - they're just for telling scons what the compiler version is, if it can't properly figure it out for itself. The way you change what the compiler is, is by adjusting the site.settings or user.settings file as free_radical mentioned. The overrides cc/cxx setting can take a full path to the compiler you want, which allows you to point to a particular compiler.

Also, I'm slightly doubtful that the -ffor-scope issue is the entirity of your problem with GCC-9. We should have the releases set up such that it will continue on through that warning. It looks like the error you're getting is an ld error, which wouldn't be an issue if the -ffor-scope is truely the issue. Often times if you restart the compilation, you'll get a clearer sense of the actual error, as a bunch of the "noise" will be omitted in the recompilation.

I'll also note that the -ffor-scope issue with GCC-9 should be resolved in recent weekly releases.

Thu, 2020-07-09 10:10
rmoretti

trying to compile the recent version of Rosetta (2020.37) on standard Ubuntu 20.04 i get following output:

 

g++ -o build/src/release/linux/5.4/64/x86/gcc/9/default/core/chemical/rotamers/BasicRotamerLibrarySpecification.os -c -std=c++0x -ffor-scope -isystem external/boost_submod/ -isystem external/ -isystem external/include/ -isystem external/dbio/ -isystem external/libxml2/include -pipe -Wall -Wextra -pedantic -Wno-long-long -Wno-strict-aliasing -march=core2 -mtune=generic -O3 -ffast-math -fno-finite-math-only -funroll-loops -finline-functions -finline-limit=20000 -s -Wno-unused-variable -Wno-unused-parameter -fPIC -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS -DPTR_STD -DNDEBUG -Isrc -Iexternal/include -Isrc/platform/linux/64/gcc/9 -Isrc/platform/linux/64/gcc -Isrc/platform/linux/64 -Isrc/platform/linux src/core/chemical/rotamers/BasicRotamerLibrarySpecification.cc
g++: warning: switch '-ffor-scope' is no longer supported
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
scons: *** [build/src/release/linux/5.4/64/x86/gcc/9/default/libObjexxFCL.so] Error 1
scons: building terminated because of errors.

 

Seems like the GCC-9 compiling problem is not yet solved within this version?

Mon, 2020-09-28 07:23
j.schmue

The warning you're getting is not what's causing your build to fail. Instead it's the `/usr/bin/ld: cannot find -lz` error. You need to install the zlib development package, which on Ubuntu is something like `sudo apt install zlib1g-dev` on the command line (administrator access needed).

Mon, 2020-09-28 08:38
rmoretti

Potential Solution but failed: I attempted to use an alternative version of clang to compile with. However, I still ran into the exact same error with clang v9 and clang v11. These are the steps I took below and received the exact same error as the initial post but with the alternative compiler being called.

My info:

MacOS: 12.1 (Monterey)

Default Clang with "xcode-select --install": 13.0

Rosetta Version: rosetta_src_2021.16.61629

Step 1:

brew install llvm@11

Step 2:

# Modify user.settings

cd rosetta_xx/main/source

cp /tools/build/user.settings.template /tools/build/user.settings

vim tools/build/user.settings

# Point to legacy clang under overrides

        "overrides" : {

            ## Uncomment the following line to import the full operating system environment.  Useful for

            ## compiling with scons on different systems.

            #"ENV" : os.environ,

                "cxx" : "/usr/local/opt/llvm@11/bin/clang++",

                "cc" : "/usr/local/opt/llvm@11/bin/clang",

        },

Step 3:

# Build without using cxx= or cxx_ver= | Here's mine but with mpi as extras

./scons.py bin mode=release extras=mpi -j8
Mon, 2022-01-24 13:23
Aseamann