ROSE Compiler Framework/cmake
overview
[edit | edit source]EDG 4.x-based ROSE also supports cmake build system.
Here is the CMake command to configure ROSE:
Needs
- boost
- jdk: export JAVA_HOME=/home/demo/opt/jdk1.8.0_25/
- libxml2
$ CC=gcc CXX=g++ cmake ../rose/ -DBOOST_ROOT="$BOOST_HOME" -Denable-cuda:BOOL=off -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:PATH="$(pwd)/../install"
Afterward, simply run "make" and then "ctest".
A real example:
- mkdir cmakebuild; cd cmakebuild
- CC=gcc CXX=g++ cmake ../rose-edg4x.git/ -DBOOST_ROOT=/home/demo/opt/boost_1.45.0_inst -Denable-cuda:BOOL=off -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:PATH="$(pwd)/../rose-install"
general impression
[edit | edit source]Very hard to read screen output to find what went wrong.
- Some are internal error messages happening as part of detecting environments
- real error messages are buried in the middle. The process went on and printed out lots of other info. after the first error occurs.
- when checking /home/demo/cmakebuild/CMakeFiles/CMakeError.log, there content are polluted with error messages for expected compilation failures (cpp files which cannot be compiled ).
It confuses users to find the real errors blocking the configuration process.
One example:
Generating /home/demo/cmakebuild/include-staging/gcc_HEADERS/rose_edg_required_macros_and_functions.h processing header file directory /usr/lib/gcc/x86_64-linux-gnu/4.8/include to be mapped to /home/demo/cmakebuild/include-staging/gcc_HEADERS/hdrs1 /usr/lib/gcc/x86_64-linux-gnu/4.8/include needs 0 change(s) /usr/lib/gcc/x86_64-linux-gnu/4.8/include does not need any changes processing header file directory /usr/local/include to be mapped to /home/demo/cmakebuild/include-staging/gcc_HEADERS/hdrs2 /usr/local/include needs 0 change(s) /usr/local/include does not need any changes processing header file directory /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed to be mapped to /home/demo/cmakebuild/include-staging/gcc_HEADERS/hdrs3 /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed needs 0 change(s) /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed does not need any changes processing header file directory /usr/include/x86_64-linux-gnu to be mapped to /home/demo/cmakebuild/include-staging/gcc_HEADERS/hdrs4 /usr/include/x86_64-linux-gnu needs 1 change(s) /usr/include/x86_64-linux-gnu needs to be copied and modified Done copying Processing c++config header file (removing use of visibility attribute) at /home/demo/cmakebuild/include-staging/gcc_HEADERS/hdrs4/./c++/4.8/bits/c++config.h Verified "/usr/include/sys/cdefs.h" exists ... (referenced by ROSE specific "sys/cdefs.h" header file) system_headers_directory = /home/demo/cmakebuild/include-staging/gcc_HEADERS/hdrs should be used instead of target_parent_dir = Copying /home/demo/rose-edg4x.git/config/rose_specific_cdefs.h to /home/demo/cmakebuild/include-staging/gcc_HEADERS/hdrs/sys to fix __gconv_info incomplete definition problem ... StatusRunning tests ... -- checking for module 'libxml-2.0' -- found libxml-2.0, version 2.9.1 -- xmllint program not found. Install it if you want validate generated doc file. -- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so -- META_EXE_LOC = /home/demo/cmakebuild/bin/CxxGrammarMetaProgram -- Smaller Generated Files Disabled -- >>>>>>>>>>>>>>>>>>>>>> smallerGeneratedFiles : OFF Commented out use of OpenAnalysis in Windows. -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") -- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.2.50") -- Found Perl: /usr/bin/perl (found version "5.18.2") StatusFinished ... -- Configuring incomplete, errors occurred! See also "/home/demo/cmakebuild/CMakeFiles/CMakeOutput.log". See also "/home/demo/cmakebuild/CMakeFiles/CMakeError.log".
build on Ubuntu 14.04 Trusty: not working
[edit | edit source]check CMakeFiles/CMakeError.log for details. The screen output is not helpful sometimes.
boost iostreams and thread
[edit | edit source]More at ROSE Compiler Framework/boost
may not be installed by default due to missing dependencies
solution
- boost iostreams: install libbz2
- boost_thread copy dummy files to workaround this
Expected complete list
-- Boost version: 1.45.0
-- Found the following Boost libraries:
-- date_time -- filesystem -- iostreams -- program_options -- regex -- system -- wave -- thread
http://www.boost.org/doc/libs/ lists 113 libraries as 1/24/2015
file system:
412795ae (Stanislav Negara 2011-07-15 15:13:34 -0700 16) #include <boost/filesystem.hpp> 412795ae (Stanislav Negara 2011-07-15 15:13:34 -0700 17) 412795ae (Stanislav Negara 2011-07-15 15:13:34 -0700 18) #include <string>
gcc version mismatch
[edit | edit source]CMake Error at cmake/DownloadEDG.cmake:32 (message):
ROSE only supports GCC versions 4.0 to 4.4.
<gcc -dumpversion> reported 4.8
Call Stack (most recent call first):
CMakeLists.txt:352 (include)
This does not help!!
CC="gcc-4.4" CXX="g++-4.4" cmake ../rose-edg4x.git/ -DBOOST_ROOT=/home/demo/opt/boost_1.45.0_inst -Denable-cuda:BOOL=off -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:PATH="$(pwd)/../rose-install"
cmake/DownloadEDG.cmake
set(min_supported "4.4") set(max_supported "4.8")
--- a/cmake/DownloadEDG.cmake +++ b/cmake/DownloadEDG.cmake @@ -20,8 +20,8 @@ endif() # Detect compiler by asking GCC what version it is set(compiler "") -set(min_supported "4.0") -set(max_supported "4.4") +set(min_supported "4.4") +set(max_supported "4.8") execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_version) # strip patch version; we only care about major & minor @@ -33,16 +33,16 @@ if(GCC_version VERSION_GREATER max_supported OR "ROSE only supports GCC versions ${min_supported} to ${max_supported}.\n" "<gcc -dumpversion> reported ${GCC_version}") endif() -if(GCC_version VERSION_EQUAL 4.4) +if(GCC_version VERSION_EQUAL 4.8) + set(compiler "GNU-4.8") +elseif(GCC_version VERSION_EQUAL 4.7) + set(compiler "GNU-4.7") +elseif(GCC_version VERSION_EQUAL 4.6) + set(compiler "GNU-4.6") +elseif(GCC_version VERSION_EQUAL 4.5) + set(compiler "GNU-4.5") +elseif(GCC_version VERSION_EQUAL 4.4) set(compiler "GNU-4.4") -elseif(GCC_version VERSION_EQUAL 4.3) - set(compiler "GNU-4.3") -elseif(GCC_version VERSION_EQUAL 4.2) - set(compiler "GNU-4.2") -elseif(GCC_version VERSION_EQUAL 4.1) - set(compiler "GNU-4.1") -elseif(GCC_version VERSION_EQUAL 4.0) - set(compiler "GNU-4.0") endif() if(compiler STREQUAL "") message(FATAL_ERROR
java
[edit | edit source]CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: JAVA_JVM_LIBRARY (ADVANCED) linked by target "ROSE_DLL" in directory /home/demo/rose-edg4x.git/src linked by target "roseFortran" in directory /home/demo/rose-edg4x.git/src/frontend/OpenFortranParser_SAGE_Connection
solution export JAVA_HOME=/home/demo/opt/jdk1.8.0_25/
zlib
[edit | edit source]sudo apt-get install zlib1g-dev
libxml2
[edit | edit source]LIBXML2_INCLUDE_DIR (ADVANCED)
sudo apt-get install libxml2-dev
mysql.h //
/home/demo/cmakebuild/CMakeFiles/CMakeTmp/src.cxx:1:19: fatal error: mysql.h: No such file or directory #include <mysql.h> ^ compilation terminated. make[1]: *** [CMakeFiles/cmTryCompileExec47651848.dir/src.cxx.o] Error 1 make[1]: Leaving directory `/home/demo/cmakebuild/CMakeFiles/CMakeTmp' make: *** [cmTryCompileExec47651848/fast] Error 2
mysql_config --include -I/usr/include/mysql demo@ubuntu:~/opt/boost_1.45.0_inst/lib$ ls /usr/include/mysql decimal.h my_attribute.h my_global.h mysqld_ername.h my_sys.h
/usr/include/sys/cdefs.h
[edit | edit source]ERROR: Could not find "/usr/include/sys/cdefs.h" system header file ... (referenced by ROSE specific "sys/cdefs.h" header file)
config/create_system_headers
# DQ (6/27/2006): We really should verify that "/usr/include/sys/cdefs.h" exists since we reference it explicitly # in the ROSE specific generated "sys/cdefs.h" header file. if [ -f /usr/include/sys/cdefs.h ] then echo "Verified \"/usr/include/sys/cdefs.h\" exists ... (referenced by ROSE specific \"sys/cdefs.h\" header file)" else echo "ERROR: Could not find \"/usr/include/sys/cdefs.h\" system header file ... (referenced by ROSE specific \"sys/cdefs.h\" header file)" exit 5 fi
demo@ubuntu:~/cmakebuild$ locate cdefs.h ...
/usr/include/x86_64-linux-gnu/sys/cdefs.h
workaround
- sudo ln -s /usr/include/x86_64-linux-gnu/sys /usr/include/sys
png lib
[edit | edit source]sudo apt-get install zlib1g-dev
c++ source tests
[edit | edit source]Are these errors something errors users should concerned? Or just internal probes to detect things?
Shown up in /home/demo/cmakebuild/CMakeFiles/CMakeError.log and confuse the hell out of users.
Performing C++ SOURCE FILE Test SIZEOF_WCHAR_T_IS_2 failed with the following output: Change Dir: /home/demo/cmakebuild/CMakeFiles/CMakeTmp Run Build Command:/usr/bin/make "cmTryCompileExec3342910900/fast" /usr/bin/make -f CMakeFiles/cmTryCompileExec3342910900.dir/build.make CMakeFiles/cmTryCompileExec3342910900.dir/build make[IPX8 under IEC standard 60529.]: Entering directory `/home/demo/cmakebuild/CMakeFiles/CMakeTmp' /usr/bin/cmake -E cmake_progress_report /home/demo/cmakebuild/CMakeFiles/CMakeTmp/CMakeFiles 1 Building CXX object CMakeFiles/cmTryCompileExec3342910900.dir/src.cxx.o /usr/bin/g++ -fexceptions -DHAVE_CONFIG_H -fPIC -DSIZEOF_WCHAR_T_IS_2 -o CMakeFiles/cmTryCompileExec3342910900.dir/src.cxx.o -c /home/demo/cmakebuild/CMakeFiles/CMakeTmp/src.cxx /home/demo/cmakebuild/CMakeFiles/CMakeTmp/src.cxx:2:41: error: size of array ‘i’ is negative int i[ ( sizeof(wchar_t)==2 ? 1 : -1 ) ]; ^ make[1]: Leaving directory `/home/demo/cmakebuild/CMakeFiles/CMakeTmp' make[1]: *** [CMakeFiles/cmTryCompileExec3342910900.dir/src.cxx.o] Error 1 make: *** [cmTryCompileExec3342910900/fast] Error 2 Source file was: int i[ ( sizeof(wchar_t)==2 ? 1 : -1 ) ]; int main(){return 0;}
- //Ivan Cabral°
2603:8080:b005:e996:4f0:bbc8:a101:cb49