I am trying to build DocFormats in Cloud9 and the make command fails with C99
mode in for loops. I have verified that CMakeList.txt file contains -std=c99 in
this if block
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CMAKE_C_FLAGS "-std=c99 -D_GNU_SOURCE -g")
set(LIBS ${LIBS} m pthread xml2 z SDL2 SDL2_image)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
I am doing this:
git clone https://git-wip-us.apache.org/repos/asf/incubator-corinthia.git
incubator-corinthia
cd incubator-corinthia/
sudo apt-get install -y cmake
mkdir build
cd build/
export DOCFORMATS_DIR=../DocFormats/
cmake -G "Unix Makefiles" $DOCFORMATS_DIR
make
Below you can see the commands that I have executed and their outputs
franzdecopenhague@demo-project:~/workspace (master) $ git clone
https://git-wip-us.apache.org/repos/asf/incubator-corinthia.git
incubator-corinthia
Cloning into 'incubator-corinthia'...
remote: Counting objects: 11946, done.
remote: Compressing objects: 100% (6404/6404), done.
remote: Total 11946 (delta 6633), reused 10066 (delta 5264)
Receiving objects: 100% (11946/11946), 3.72 MiB | 3.65 MiB/s, done.
Resolving deltas: 48% (3184/6633)
Resolving deltas: 100% (6633/6633), done.
Checking connectivity... done.
franzdecopenhague@demo-project:~/workspace (master) $ cd incubator-corinthia/
franzdecopenhague@demo-project:~/workspace/incubator-corinthia (master) $ sudo
apt-get install -y cmake
Reading package lists... Done
Building dependency tree
Reading state information... Done
cmake is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.
franzdecopenhague@demo-project:~/workspace/incubator-corinthia (master) $ mkdir
build
franzdecopenhague@demo-project:~/workspace/incubator-corinthia (master) $ cd
build/
franzdecopenhague@demo-project:~/workspace/incubator-corinthia/build (master) $
export DOCFORMATS_DIR=../DocFormats/
franzdecopenhague@demo-project:~/workspace/incubator-corinthia/build (master) $
cmake -G "Unix Makefiles" $DOCFORMATS_DIR
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to:
/home/ubuntu/workspace/incubator-corinthia/build
franzdecopenhague@demo-project:~/workspace/incubator-corinthia/build (master) $
make
Scanning dependencies of target api
[ 1%] Building C object api/CMakeFiles/api.dir/src/Formats.c.o
[ 2%] Building C object api/CMakeFiles/api.dir/src/Operations.c.o
[ 3%] Building C object api/CMakeFiles/api.dir/tests/APITests.c.o
[ 3%] Built target api
Scanning dependencies of target core
[ 3%] Building C object core/CMakeFiles/core.dir/src/common/DFBDT.c.o
/home/ubuntu/workspace/incubator-corinthia/DocFormats/core/src/common/DFBDT.c:
In function ‘BDTContainerGet’:
/home/ubuntu/workspace/incubator-corinthia/DocFormats/core/src/common/DFBDT.c:36:9:
error: ‘for’ loop initial declarations are only allowed in C99 mode
for (DFNode *child = concrete->first; child != NULL; child =
child->next) {
^
Any idea how to fix it?
Thanks,
JD