View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002114 | ThirdParty | Patch | public | 2016-06-08 18:43 | 2016-06-09 14:39 |
Reporter | wyldckat | Assigned To | henry | ||
Priority | normal | Severity | minor | Reproducibility | sometimes |
Status | resolved | Resolution | fixed | ||
Product Version | dev | ||||
Fixed in Version | dev | ||||
Summary | 0002114: Recent compatibility upgrade to GCC 6.1 in bashrc/cshrc affected building CGAL | ||||
Description | This is in reference to the commit c9bfcc665ae0d6e91 in OpenFOAM-dev: https://github.com/OpenFOAM/OpenFOAM-dev/commit/c9bfcc665ae0d6e911bf7a1b27bf3726571e59db The attached files aim to solve the problem that happens when using a custom build of GCC 4.8.5 + GMP 5.1.2 + MPFR 3.1.2 + MPC 1.0.1 on CentOS 6.6 x86_64. The problem is related to the new library paths for GMP, MPFR and MPC, as set-up in OpenFOAM's "etc/config.*/settings": _foamAddLib $gmpDir/lib$WM_COMPILER_LIB_ARCH _foamAddLib $mpfrDir/lib$WM_COMPILER_LIB_ARCH _foamAddLib $mpcDir/lib$WM_COMPILER_LIB_ARCH which results in the following problems: 1- The custom built GCC 4.8.5 is unable to compile OpenFOAM, because it can't find GMP, given it's installed in "lib" instead of "lib64". This might not happen in more recent Linux Distributions (I still have to check which ones), but it happens in older Linux Distributions such as CentOS 6. 2- Once this issue is fixed in "makeGcc", then CGAL has problems in not finding the custom built libraries for GMP and MPFR. Description of the fixes implemented in each one of the attached files: - makeGcc - for "ThirdParty-dev" - enforces the "lib$WM_COMPILER_LIB_ARCH" library paths for GMP, MPFR and MPC in each call to "configure", for both building each library and for the others to use the correct dependent library paths. Hopefully this works all the way from GCC 4.5 to 6.1, as I only checked with 4.8. - makeCGAL - for "ThirdParty-dev" - Updated the defined paths for GMP and MPFR to use the new "lib$WM_COMPILER_LIB_ARCH" convention. - wmake_rules_General_CGAL - for replacing "wmake/rules/General/CGAL" in OpenFOAM-dev - Use the GMP and MPFR library paths with "lib$WM_COMPILER_LIB_ARCH" I have not updated Boost and CGAL's own "lib" installation paths, since that would make it even harder to ensure that everything builds properly, at least for now. | ||||
Tags | No tags attached. | ||||
|
makeGcc (7,652 bytes)
#!/bin/sh #------------------------------------------------------------------------------ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. # # OpenFOAM is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. # # Script # makeGcc # # Description # Build script for gmp, mpfr and gcc-[4-9].?.? # #------------------------------------------------------------------------------ # get default GCC, mpfr, gmp and mpc versions . $WM_PROJECT_DIR/etc/config.sh/functions _foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/compiler) gmpPACKAGE=${gmp_version:-gmp-5.1.2} mpfrPACKAGE=${mpfr_version:-mpfr-3.1.2} mpcPACKAGE=${mpc_version:-mpc-1.0.1} gccPACKAGE=$gcc_version #------------------------------------------------------------------------------ # Run from third-party directory only wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || { echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR" echo " The environment variables are inconsistent with the installation." echo " Check the OpenFOAM entries in your dot-files and source them." exit 1 } . etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ usage() { exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<<USAGE usage: ${0##*/} [option] [gmp-VERSION] [mpfr-VERSION] [mpc-VERSION] <gcc-VERSION> options: -no-multilib for 64-bit systems that don't have 32-bit support -help * build combinations of gmp, mpfr, mpc and gcc $gmpPACKAGE $mpfrPACKAGE $mpcPACKAGE $gccPACKAGE USAGE exit 1 } GCC_BUILD_OPTIONS="" # Parse options while [ "$#" -gt 0 ] do case "$1" in -h | -help) usage ;; -no-multilib) GCC_BUILD_OPTIONS="--disable-multilib" shift ;; gmp-[4-9]*) gmpPACKAGE="${1%%/}" shift ;; mpfr-[2-9]*) mpfrPACKAGE="${1%%/}" shift ;; mpc-[0-9]*) mpcPACKAGE="${1%%/}" shift ;; gcc-[4-9]*) gccPACKAGE="${1%%/}" shift ;; *) usage "unknown option/argument: '$*'" ;; esac done if [ -z "$gccPACKAGE" ] then usage "Please specify gcc-VERSION" exit 1 fi # Set 32 or 64 bit ABI case "$WM_ARCH_OPTION" in 32 | 64) ABI=$WM_ARCH_OPTION ;; *) usage "Please set WM_ARCH_OPTION to either 32 or 64'$*'" ;; esac #------------------------------------------------------------------------------ # Build/install without compiler name buildBASE=$WM_THIRD_PARTY_DIR/build/$WM_ARCH$WM_COMPILER_ARCH installBASE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH GCC_ARCH_PATH=$installBASE/$gccPACKAGE GMP_ARCH_PATH=$installBASE/$gmpPACKAGE MPFR_ARCH_PATH=$installBASE/$mpfrPACKAGE MPC_ARCH_PATH=$installBASE/$mpcPACKAGE # # Build GMP # echo "---------------" if [ -d $GMP_ARCH_PATH ] then echo "Already built: $gmpPACKAGE" else echo "Starting build: $gmpPACKAGE" echo ( sourceDIR=$WM_THIRD_PARTY_DIR/$gmpPACKAGE buildDIR=$buildBASE/$gmpPACKAGE cd $sourceDIR || exit 1 make distclean 2>/dev/null rm -rf $buildDIR mkdir -p $buildDIR cd $buildDIR set -x $sourceDIR/configure ABI=$ABI \ --prefix=$GMP_ARCH_PATH \ --libdir=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ --enable-cxx \ && make -j $WM_NCOMPPROCS \ && make install \ && echo "Built: $gmpPACKAGE" ) || { echo "Error building: $gmpPACKAGE" exit 1 } fi export LD_LIBRARY_PATH="$GMP_ARCH_PATH/lib:$LD_LIBRARY_PATH" # # Build MPFR # echo "---------------" if [ -d $MPFR_ARCH_PATH ] then echo "Already built: $mpfrPACKAGE" else echo "Starting build: $mpfrPACKAGE" echo ( sourceDIR=$WM_THIRD_PARTY_DIR/$mpfrPACKAGE buildDIR=$buildBASE/$mpfrPACKAGE cd $sourceDIR || exit 1 make distclean 2>/dev/null rm -rf $buildDIR mkdir -p $buildDIR cd $buildDIR set -x $sourceDIR/configure ABI=$ABI \ --prefix=$MPFR_ARCH_PATH \ --libdir=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ --with-gmp-include=$GMP_ARCH_PATH/include \ --with-gmp-lib=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ && make -j $WM_NCOMPPROCS \ && make install \ && echo "Built: $mpfrPACKAGE" ) || { echo "Error building: $mpfrPACKAGE" exit 1 } fi export LD_LIBRARY_PATH="$MPFR_ARCH_PATH/lib:$LD_LIBRARY_PATH" # # Build mpc # echo "---------------" if [ -d $MPC_ARCH_PATH ] then echo "Already built: $mpcPACKAGE" else echo "Starting build: $mpcPACKAGE" echo ( sourceDIR=$WM_THIRD_PARTY_DIR/$mpcPACKAGE buildDIR=$buildBASE/$mpcPACKAGE cd $sourceDIR || exit 1 make distclean 2>/dev/null rm -rf $buildDIR mkdir -p $buildDIR cd $buildDIR set -x $sourceDIR/configure ABI=$ABI \ --prefix=$MPC_ARCH_PATH \ --libdir=$MPC_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ --with-gmp-include=$GMP_ARCH_PATH/include \ --with-gmp-lib=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ --with-mpfr-include=$MPFR_ARCH_PATH/include \ --with-mpfr-lib=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ && make -j $WM_NCOMPPROCS \ && make install \ && echo "Built: $mpcPACKAGE" ) || { echo "Error building: $mpcPACKAGE" exit 1 } fi if [ -d "$MPC_ARCH_PATH" ] then export LD_LIBRARY_PATH="$MPC_ARCH_PATH/lib:$LD_LIBRARY_PATH" fi # # Build GCC # might need 32-bit glibc-devel headers to compile # E.g. on ubuntu install g++-multilib # echo "---------------" if [ -d $GCC_ARCH_PATH ] then echo "Already built: $gccPACKAGE" else echo "Starting build: $gccPACKAGE" echo ( sourceDIR=$WM_THIRD_PARTY_DIR/$gccPACKAGE buildDIR=$buildBASE/$gccPACKAGE cd $sourceDIR || exit 1 make distclean 2>/dev/null rm -rf $buildDIR mkdir -p $buildDIR cd $buildDIR set -x $sourceDIR/configure \ --prefix=$GCC_ARCH_PATH \ --with-gmp-include=$GMP_ARCH_PATH/include \ --with-gmp-lib=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ --with-mpfr-include=$MPFR_ARCH_PATH/include \ --with-mpfr-lib=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ --with-mpc-include=$MPC_ARCH_PATH/include \ --with-mpc-lib=$MPC_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ --with-pkgversion=OpenFOAM \ --enable-languages=c,c++ \ --enable-__cxa_atexit \ --enable-libstdcxx-allocator=new \ --with-system-zlib \ $GCC_BUILD_OPTIONS \ MAKEINFO=missing \ && make -j $WM_NCOMPPROCS \ && make install \ && echo "Built: $gccPACKAGE" ) || { echo "Error building: $gccPACKAGE" exit 1 } fi #------------------------------------------------------------------------------ |
|
makeCGAL (8,576 bytes)
#!/bin/sh #------------------------------------------------------------------------------ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. # # OpenFOAM is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. # # Script # makeCGAL # # Description # Build script for CGAL # # Note # Normally builds against ThirdParty boost and gmp/mpfr when possible. # To override this behaviour (and use the system boost and/or gmp/mpfr), # simply specify a 'system' version. For example, # makeCGAL boost-system gmp-system # # Mixing system and ThirdParty for gmp/mpfr is not supported. # #------------------------------------------------------------------------------ # Get CGAL, boost and gmp/mpfr versions . $WM_PROJECT_DIR/etc/config.sh/functions _foamEval SOURCE_CGAL_VERSIONS_ONLY=yes \ $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/CGAL) _foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/compiler) set -x cgalPACKAGE=${cgal_version:-CGAL-4.8} boostPACKAGE=${boost_version:-boost-system} gmpPACKAGE=${gmp_version:-gmp-system} mpfrPACKAGE=${mpfr_version:-mpfr-system} #------------------------------------------------------------------------------ # Run from third-party directory only wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || { echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR" echo " The environment variables are inconsistent with the installation." echo " Check the OpenFOAM entries in your dot-files and source them." exit 1 } . etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ usage() { exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<<USAGE usage: ${0##*/} [OPTION] [CGAL-VERSION] [boost-VERSION] [gmp-VERSION] [mpfr-VERSION] options: -gcc force g++ instead of the value from \$WM_CXX -help * build CGAL with $cgalPACKAGE $boostPACKAGE $gmpPACKAGE $mpfrPACKAGE Normally builds against ThirdParty boost and gmp/mpfr when possible. To override this behaviour (and use the system boost and/o gmp/mpfr), simply specify a 'system' version. For example, ${0##*/} boost-system gmp-system Note: mixing system and ThirdParty for gmp/mpfr is not supported. USAGE exit 1 } # Ensure CMake gets the correct C++ compiler [ -n "$WM_CXX" ] && export CXX="$WM_CXX" # Parse options while [ "$#" -gt 0 ] do case "$1" in -h | -help) usage ;; -gcc) export CXX=g++ # use g++ shift ;; gmp-[4-9]* | gmp-sys*) gmpPACKAGE="${1%%/}" shift ;; mpfr-[2-9]* | mpfr-sys*) mpfrPACKAGE="${1%%/}" shift ;; CGAL-[0-9]*) cgalPACKAGE="${1%%/}" shift ;; boost-[0-9]* | boost_[0-9]* | boost-sys* ) boostPACKAGE="${1%%/}" shift ;; *) usage "unknown option/argument: '$*'" ;; esac done #------------------------------------------------------------------------------ # # Build Boost # # BOOST_SOURCE_DIR : location of the original sources BOOST_ARCH_PATH=$installBASE/$boostPACKAGE BOOST_SOURCE_DIR=$WM_THIRD_PARTY_DIR/$boostPACKAGE if [ -d "$BOOST_ARCH_PATH" ] then boostInc="$BOOST_ARCH_PATH/include" boostLib="$BOOST_ARCH_PATH/lib" elif [ -d "$BOOST_SOURCE_DIR" ] then boostInc="$BOOST_ARCH_PATH/include" boostLib="$BOOST_ARCH_PATH/lib" echo "Starting build: boost" ( cd $BOOST_SOURCE_DIR || exit 1 rm -rf $BOOST_ARCH_PATH ./bootstrap.sh \ --prefix=$BOOST_ARCH_PATH \ --with-libraries=thread \ --with-libraries=system \ && ./bjam toolset=$WM_CC -j $WM_NCOMPPROCS install \ && echo "Built: boost" ) || { echo "Error building: boost" exit 1 } else boostInc="/usr/include" # For completeness: # 64-bit needs lib64, but 32-bit needs lib (not lib32) if [ "$WM_ARCH_OPTION" = 64 ] then boostLib="/usr/lib$WM_ARCH_OPTION" else boostLib="/usr/lib" fi fi # Retrieve boost version: if [ -f "$boostInc/boost/version.hpp" ] then BOOST_VERSION_NO=`sed -ne 's/^#define *BOOST_VERSION *\([0-9][0-9]*\).*$/\1/p' $boostInc/boost/version.hpp` else echo "Boost does not appear to be installed" echo "stopping build" exit 1 fi if [ "$cgal_version" = "cgal-system" ] then echo "Using system installation of CGAL" exit 0 fi # # Build CGAL # # CGAL_SOURCE_DIR : location of the original sources # CGAL_BINARY_DIR : location of the build # CGAL_DIR : location of the installed program CGAL_SOURCE_DIR=$WM_THIRD_PARTY_DIR/$cgalPACKAGE CGAL_BINARY_DIR=$buildBASE/$cgalPACKAGE CGAL_ARCH_PATH=$installBASE/$cgalPACKAGE CGAL_DIR=$CGAL_ARCH_PATH # # gmp/mpfr installed without compiler name installBASE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH GMP_ARCH_PATH=$installBASE/$gmpPACKAGE MPFR_ARCH_PATH=$installBASE/$mpfrPACKAGE ( # Remove any existing build folder and recreate if [ -d $CGAL_BINARY_DIR ] then echo "removing old build directory" echo " $CGAL_BINARY_DIR" rm -rf $CGAL_BINARY_DIR fi mkdir -p $CGAL_BINARY_DIR cd $CGAL_BINARY_DIR || exit 1 unset configBoost configGmpMpfr echo "----" echo "Configuring $cgalPACKAGE with boost $BOOST_VERSION_NO" echo " Source : $CGAL_SOURCE_DIR" echo " Build : $CGAL_BINARY_DIR" echo " Target : $CGAL_DIR" if [ -d "$BOOST_ARCH_PATH" ] then echo " ThirdParty : boost" configBoost=$(cat <<CMAKE_OPTIONS -DBoost_INCLUDE_DIR=$boostInc -DBoost_LIBRARY_DIRS=$boostLib -DBoost_THREAD_LIBRARY=$boostLib/libboost_thread.so -DBoost_THREAD_LIBRARY_RELEASE=$boostLib/libboost_thread.so -DBoost_SYSTEM_LIBRARY=$boostLib/libboost_system.so -DBoost_SYSTEM_LIBRARY_RELEASE=$boostLib/libboost_system.so -DBoost_VERSION=$BOOST_VERSION_NO CMAKE_OPTIONS ) else echo " system : boost" configBoost=$(cat <<CMAKE_OPTIONS -DBOOST_LIBRARYDIR=$boostLib CMAKE_OPTIONS ) fi if [ -d "$GMP_ARCH_PATH" -a -d "$MPFR_ARCH_PATH" ] then echo " ThirdParty : gmp/mpfr" configGmpMpfr=$(cat <<CMAKE_OPTIONS -DGMP_INCLUDE_DIR=$GMP_ARCH_PATH/include -DGMP_LIBRARIES_DIR=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH -DGMP_LIBRARIES=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libgmp.so -DGMPXX_INCLUDE_DIR=$GMP_ARCH_PATH/include -DGMPXX_LIBRARIES=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libgmpxx.so -DMPFR_INCLUDE_DIR=$MPFR_ARCH_PATH/include -DMPFR_LIBRARIES_DIR=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH -DMPFR_LIBRARIES=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpfr.so CMAKE_OPTIONS ) else echo " system : gmp/mpfr" fi echo "----" set -x cmake \ -DCMAKE_INSTALL_PREFIX=$CGAL_ARCH_PATH \ -DCMAKE_BUILD_TYPE=Release \ $configBoost $configGmpMpfr \ $CGAL_SOURCE_DIR \ && make -j $WM_NCOMPPROCS \ && make install || exit 1 echo "----" echo "create '\$CGAL_ARCH_PATH/share/files'" echo "----" mkdir -p $CGAL_ARCH_PATH/share/src rm -f $CGAL_ARCH_PATH/share/files for i in assertions.cpp io.cpp MP_Float.cpp Random.cpp do if [ -e "$CGAL_SOURCE_DIR/src/CGAL/$i" ] then \cp $CGAL_SOURCE_DIR/src/CGAL/$i $CGAL_ARCH_PATH/share/src/ echo "\${CGAL_ARCH_PATH}/share/src/$i" >> $CGAL_ARCH_PATH/share/files fi done echo "Done CGAL" ) #------------------------------------------------------------------------------ |
|
wmake_rules_General_CGAL (352 bytes)
CGAL_INC = \ -I$(CGAL_ARCH_PATH)/include \ -I$(MPFR_ARCH_PATH)/include \ -I$(GMP_ARCH_PATH)/include \ -I$(BOOST_ARCH_PATH)/include CGAL_LIBS = \ -L$(MPFR_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \ -L$(GMP_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \ -L$(BOOST_ARCH_PATH)/lib \ -L$(CGAL_ARCH_PATH)/lib \ -lCGAL \ -lmpfr |
|
Forgot to mention that I tested this today on a clean build of OpenFOAM-dev + ThirdParty-dev with most of today's commits already checked out. |
|
I am testing these changes which a range of gcc versions on OpenSuSE Tumbleweed. |
|
Thanks Bruno, the changes look fine at least for OpenSuSE Tumbleweed Resolved in ThirdParty-dev by commit 17cafd35812493f9a39e56c7355f49c1d3eef2d0 Resolved in OpenFOAM-dev by commit 95b0f41c0f14d026740e52cc1203b89ba69ed2aa |
Date Modified | Username | Field | Change |
---|---|---|---|
2016-06-08 18:43 | wyldckat | New Issue | |
2016-06-08 18:43 | wyldckat | Status | new => assigned |
2016-06-08 18:43 | wyldckat | Assigned To | => henry |
2016-06-08 18:43 | wyldckat | File Added: makeGcc | |
2016-06-08 18:44 | wyldckat | File Added: makeCGAL | |
2016-06-08 18:44 | wyldckat | File Added: wmake_rules_General_CGAL | |
2016-06-08 18:45 | wyldckat | Note Added: 0006411 | |
2016-06-08 20:21 | henry | Note Added: 0006413 | |
2016-06-09 14:38 | henry | Note Added: 0006418 | |
2016-06-09 14:38 | henry | Status | assigned => resolved |
2016-06-09 14:38 | henry | Fixed in Version | => dev |
2016-06-09 14:38 | henry | Resolution | open => fixed |