Return-Path: X-Original-To: apmail-corinthia-dev-archive@minotaur.apache.org Delivered-To: apmail-corinthia-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6F0D8178A6 for ; Tue, 10 Mar 2015 12:28:26 +0000 (UTC) Received: (qmail 40842 invoked by uid 500); 10 Mar 2015 12:28:26 -0000 Delivered-To: apmail-corinthia-dev-archive@corinthia.apache.org Received: (qmail 40814 invoked by uid 500); 10 Mar 2015 12:28:26 -0000 Mailing-List: contact dev-help@corinthia.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@corinthia.incubator.apache.org Delivered-To: mailing list dev@corinthia.incubator.apache.org Received: (qmail 40803 invoked by uid 99); 10 Mar 2015 12:28:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Mar 2015 12:28:26 +0000 X-ASF-Spam-Status: No, hits=-1997.8 required=5.0 tests=ALL_TRUSTED,HTML_MESSAGE,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 10 Mar 2015 12:28:24 +0000 Received: (qmail 40563 invoked by uid 99); 10 Mar 2015 12:28:04 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Mar 2015 12:28:04 +0000 Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id D00E21A02E4 for ; Tue, 10 Mar 2015 12:28:03 +0000 (UTC) Received: by lbdu10 with SMTP id u10so1290666lbd.4 for ; Tue, 10 Mar 2015 05:28:02 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.112.119.229 with SMTP id kx5mr15314768lbb.78.1425990482414; Tue, 10 Mar 2015 05:28:02 -0700 (PDT) Received: by 10.112.124.105 with HTTP; Tue, 10 Mar 2015 05:28:02 -0700 (PDT) In-Reply-To: References: Date: Tue, 10 Mar 2015 13:28:02 +0100 Message-ID: Subject: Re: C99 mode error building in Cloud9 From: jan i To: jan i Cc: "dev@corinthia.incubator.apache.org" Content-Type: multipart/alternative; boundary=047d7bb0394828552c0510ee485a X-Virus-Checked: Checked by ClamAV on apache.org --047d7bb0394828552c0510ee485a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi again. I did a short search on google for the error you have. All entries mention (as I expected) that you need to set --std=3DC99 since this is set in the CMakeList.txt (the if you show), it seems very likely that you are using e.g. a freebsd system, which is another CMAKE_SYSTEM_NAME and therefore the --std=3DC99 is not activated. To make a proof of that, put the "if" and the "endif" under comments and rerun cmake, if the error disapears you need to correct the "if". If you mail a patch, then I will review it and apply it. There are a couple of other places where we ask if "linux" they need to be adapted as well, but that is not for compiling but for linking. rgds jan On 10 March 2015 at 08:02, jan i wrote: > > > 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 wit= h >> C99 mode in for loops. I have verified that CMakeList.txt file contains >> -std=3Dc99 in this if block >> >> if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") >> set(CMAKE_C_FLAGS "-std=3Dc99 -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.gi= t >> incubator-corinthia >> cd incubator-corinthia/ >> sudo apt-get install -y cmake >> mkdir build >> cd build/ >> export DOCFORMATS_DIR=3D../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=3D../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/DF= BDT.c: >> In function =E2=80=98BDTContainerGet=E2=80=99: >> /home/ubuntu/workspace/incubator-corinthia/DocFormats/core/src/common/DF= BDT.c:36:9: >> error: =E2=80=98for=E2=80=99 loop initial declarations are only allowed = in C99 mode >> for (DFNode *child =3D concrete->first; child !=3D NULL; child = =3D >> 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 >> > > > --047d7bb0394828552c0510ee485a--