corinthia-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jan i <j...@apache.org>
Subject Re: C99 mode error building in Cloud9
Date Tue, 10 Mar 2015 07:02:53 GMT
On 10 March 2015 at 05:19, Franz de Copenhague <
franzdecopenhague@outlook.com> wrote:

> 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?
>

I just had a look at the code, and that works with C99.

I think the problem might be the CMAKE_SYSTEM_NAME, it might not be "Linux"
as you expect

Try to:
1) clean your build directory
2) add the line:   MESSAGE( ${CMAKE_SYSTEM_NAME} ) in front of the IF
3) Rerun cmake
4) check if Linux is the output, my quess is it will say something
different.

rgds
jan i.


> Thanks,
> JD
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message