Shop OBEX P1 Docs P2 Docs Learn Events
error when building gcc — Parallax Forums

error when building gcc

Bill HenningBill Henning Posts: 6,445
edited 2015-02-09 19:17 in Propeller 1
/home/odroid/buildgcc/propgcc/binutils/bfd/opncls.c: In function ‘bfd_fopen’:
./bfd.h:529:65: error: right-hand operand of comma expression has no effect [-Werror=unused-value]
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
^
/home/odroid/buildgcc/propgcc/binutils/bfd/opncls.c:257:5: note: in expansion of macro ‘bfd_set_cacheable’
bfd_set_cacheable (nbfd, TRUE);
^
cc1: all warnings being treated as errors
make[5]: *** [opncls.lo] Error 1

I agree with the compiler, that looks like an error.

Comments

  • David BetzDavid Betz Posts: 14,511
    edited 2015-02-06 14:41
    I agree with the compiler, that looks like an error.
    You're going to have to turn off a bunch of warnings to get propgcc to build. Check the file whose name begins with "fix" in the root directory.
  • Bill HenningBill Henning Posts: 6,445
    edited 2015-02-06 15:17
    Thanks - sourced it, I am currently running a 'make -j 6' :)
  • Bill HenningBill Henning Posts: 6,445
    edited 2015-02-06 15:28
    the fix script helped, but I still had to fix bad definitions for that macro on two files.

    Basically,

    #define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)

    is bad code, first bool is a reserved keyword, second there is no place for the TRUE to go.

    Needs to be fixed in bfd-in.h and bfd-in2.h located in /home/odroid/buildgcc/propgcc/binutils/bfd

    This should be fixed in the mainline branch.
  • Bill HenningBill Henning Posts: 6,445
    edited 2015-02-06 15:36
    Another bad macro definition:

    bfd_set_section_vma() generates illegal code, does not even reference first argument, part of libtool.

    I even tried adding -Wno-unused-value to the fixit script, no joy.

    Looks like some multi-legged creatures creeped into the macro definitions in mainline.
  • David BetzDavid Betz Posts: 14,511
    edited 2015-02-06 18:22
    Yes, this is all very frustrating. I hate to have to turn off warnings but we probably also don't want to hack the official GCC code too much either. Eric was working on moving us to the latest release of GCC but I'm not sure how far he's gotten so far. It might be better to finish that effort than to try to patch up the version we have.
  • David BetzDavid Betz Posts: 14,511
    edited 2015-02-06 18:24
    the fix script helped, but I still had to fix bad definitions for that macro on two files.

    Basically,

    #define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)

    is bad code, first bool is a reserved keyword, second there is no place for the TRUE to go.

    Needs to be fixed in bfd-in.h and bfd-in2.h located in /home/odroid/buildgcc/propgcc/binutils/bfd

    This should be fixed in the mainline branch.
    I don't think bool is a C keyword is it? It's only in C++ as far as I know.
  • David BetzDavid Betz Posts: 14,511
    edited 2015-02-06 18:26
    By the way, are you getting these errors while trying to compile on a RaspberryPi? I haven't tried that yet. I'm tempted to order one of the new model 2 boards but they don't seem to be available anywhere right now.
  • Bill HenningBill Henning Posts: 6,445
    edited 2015-02-06 20:17
    I was compiling on an ODROID-C1 (review should be posted late Sunday) and I was also planning to compile on a Pi2B and try to get it running on a MIPS CI20.

    UPS dropped off my Pi2B's a couple of hours ago :) and I've got one running right now on another port of my KVM.

    Unlike the older Pi's it is actually very usable for browsing the web (except videos).. Pi2 review will follow ODROID review.

    PM Leon, he bought a few extra Pi 2's when he heard Heater and I could not source any here, meanwhile I found a couple, so you could get the one earmarked for me from him if you like, as I don't really need one more yet.

    I understand about unfinished code, I just wish the last full release was forked for a test branch, because it is very frustrating not to be able to build it.

    Based on the errors I found while trying to compile, the same errors would show up when compiling on X86.
    David Betz wrote: »
    By the way, are you getting these errors while trying to compile on a RaspberryPi? I haven't tried that yet. I'm tempted to order one of the new model 2 boards but they don't seem to be available anywhere right now.
  • SRLMSRLM Posts: 5,045
    edited 2015-02-06 22:21
    I just tried building PropGCC for Ubuntu, and it works for me with no errors.

    Building the CROSS=rpi, I got an error because I didn't have the binutils-arm-linux-gnueabihf prerequisite installed. Then I got this error:
    mv -f .deps/filemode.Tpo .deps/filemode.Po
    /bin/bash ./libtool --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2   -o size size.o bucomm.o version.o filemode.o ../bfd/libbfd.la ../libiberty/libiberty.a  -lz 
    libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -o size size.o bucomm.o version.o filemode.o  ../bfd/.libs/libbfd.a ../libiberty/libiberty.a -lz
    ../bfd/.libs/libbfd.a: error adding symbols: Archive has no index; run ranlib to add one
    collect2: error: ld returned 1 exit status
    make[5]: *** [size] Error 1
    make[5]: Leaving directory `/home/clewis/Downloads/propgcc/build-rpi/binutils/binutils'
    make[4]: *** [all-recursive] Error 1
    make[4]: Leaving directory `/home/clewis/Downloads/propgcc/build-rpi/binutils/binutils'
    make[3]: *** [all] Error 2
    make[3]: Leaving directory `/home/clewis/Downloads/propgcc/build-rpi/binutils/binutils'
    make[2]: *** [all-binutils] Error 2
    make[2]: Leaving directory `/home/clewis/Downloads/propgcc/build-rpi/binutils'
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/home/clewis/Downloads/propgcc/build-rpi/binutils'
    make: *** [/home/user/Downloads/propgcc/propgcc/../build-rpi/binutils/binutils-built] Error 2
    Command exited with non-zero status 2
    0:21.75 85284 92%
    

    Then it was time for bed...
  • David BetzDavid Betz Posts: 14,511
    edited 2015-02-07 05:11
    I was compiling on an ODROID-C1 (review should be posted late Sunday) and I was also planning to compile on a Pi2B and try to get it running on a MIPS CI20.

    UPS dropped off my Pi2B's a couple of hours ago :) and I've got one running right now on another port of my KVM.

    Unlike the older Pi's it is actually very usable for browsing the web (except videos).. Pi2 review will follow ODROID review.

    PM Leon, he bought a few extra Pi 2's when he heard Heater and I could not source any here, meanwhile I found a couple, so you could get the one earmarked for me from him if you like, as I don't really need one more yet.

    I understand about unfinished code, I just wish the last full release was forked for a test branch, because it is very frustrating not to be able to build it.

    Based on the errors I found while trying to compile, the same errors would show up when compiling on X86.
    I don't understand what you mean by the last release being forked. There is a branch called "release_1_0" that corresponds to the version of PropGCC that is distributed with SimpleIDE. Also, what is in the default branch is not incomplete code. It just isn't based on the latest version of GCC. It builds on other platforms so I think the warnings you're seeing are not fatal errors. They could, of course, be real bugs but they aren't preventing propgcc from running on other platforms.
  • Bill HenningBill Henning Posts: 6,445
    edited 2015-02-07 08:30
    That was my frustrated side posting... what I meant is that I would expect that the default branch would be able to compile without errors on all supported platforms.

    Today I am benchmarking my Pi2B, and editing the ODROID-C1 photos and review. Then I'll be trying RoboPi on the Pi2B, editing photos etc for the Pi2B review.

    I'll try to get back to compiling propgcc soon.

    Pi2B first impression: A world of difference in usability from the single core Pi's. It is actually a usable desktop, with fast enough web browsing.
    David Betz wrote: »
    I don't understand what you mean by the last release being forked. There is a branch called "release_1_0" that corresponds to the version of PropGCC that is distributed with SimpleIDE. Also, what is in the default branch is not incomplete code. It just isn't based on the latest version of GCC. It builds on other platforms so I think the warnings you're seeing are not fatal errors. They could, of course, be real bugs but they aren't preventing propgcc from running on other platforms.
  • David BetzDavid Betz Posts: 14,511
    edited 2015-02-07 08:34
    That was my frustrated side posting... what I meant is that I would expect that the default branch would be able to compile without errors on all supported platforms.

    Today I am benchmarking my Pi2B, and editing the ODROID-C1 photos and review. Then I'll be trying RoboPi on the Pi2B, editing photos etc for the Pi2B review.

    I'll try to get back to compiling propgcc soon.

    Pi2B first impression: A world of difference in usability from the single core Pi's. It is actually a usable desktop, with fast enough web browsing.
    It compiles for Windows, Mac, and Linux. I'm not sure anyone ever promised that it would be supported for the RaspberryPi although that is obviously also Linux. I certainly don't have the time to compile it for every platform on every change. Maybe Parallax will assign someone to do this.
  • RsadeikaRsadeika Posts: 3,824
    edited 2015-02-07 09:08
    I thought I would give building gcc a try, did not succeed. I installed Ubuntu 14.10, got a clone of the gcc, and then after that did the make stuff. Everything seemed to go OK, but I do not see where the build ended up, this is very frustrating.

    Ray
  • Bill HenningBill Henning Posts: 6,445
    edited 2015-02-07 09:18
    Exactly my point. I don't have the time to chase down and fix incorrect macro definitions either, I just want to be able to use propgcc on multiple platforms.

    I'll try to compile it for Ubuntu, as C1 runs Ubuntu, hopefully that will produce a usable compiler.

    As RPi, C1, Banana, CI20 all run Linux, I think it is reasonable to expect that propgcc would compile - heck, that is exactly what a non-propellerhead would expect :)

    I agree with you - and also hope that Parallax assigns someone to fix this.
    David Betz wrote: »
    It compiles for Windows, Mac, and Linux. I'm not sure anyone ever promised that it would be supported for the RaspberryPi although that is obviously also Linux. I certainly don't have the time to compile it for every platform on every change. Maybe Parallax will assign someone to do this.
  • Heater.Heater. Posts: 21,230
    edited 2015-02-07 11:42
    Bill,
    I agree with you - and also hope that Parallax assigns someone to fix this
    Oh boy,

    No, it's not reasonable to expect any particular open source project to build and run easily on any open source platform. Despite the tremendous efforts many people put into making this possible.

    I don't think Parallax, or anybody has the resources to make this so.

    prop-gcc has compiled for me fine on Debian Wheezy on the PC and on the Rasperry Pi.

    It has failed, eventually worked around, on Debian Jessie and Ubuntu.

    In this open source world we are subject to upgrades of libs and other dependencies that tend to brake things. Not to mention the difference between different Linux distributions.

    prop-gcc is no doubt falling behind the current versions because the Propeller target is not integrated back into the upstream GCC. Which may or may not ever happen.

    Often posting such error messages into google will uncover somebody on Stackoverflow who has had the same issue a hopefully received answers as to how to get around it.
  • Bill HenningBill Henning Posts: 6,445
    edited 2015-02-07 12:15
    Not for any platform - but a Parallax supported platform at least... learn.parallax.com has a SimpleIDE install based on propgcc, so propgcc used to build on the Pi. (FYI - SimpleIDE installed and ran, I'll be trying to program RoboPi with it on Pi2B later today once other tests, photography and editing is done)

    As nearly as I could tell, the errors are due to changes made in the sources used for libtool that were not completed, ie incorrect new macro definitions that do not compile correctly when built. I fixed one, as the error was pretty obvious, however the second was not obvious to me - and until I get past that one, there is no way to know how many more are lurking in there.

    I had hoped to use the time required to build gcc (with various number of parallel compiles) as a real-world benchmark between multicore SBC's, but that is not likely to happen for this round of new reviews (ODROID-C1 and Pi2B).
  • David BetzDavid Betz Posts: 14,511
    edited 2015-02-07 12:28
    Not for any platform - but a Parallax supported platform at least... learn.parallax.com has a SimpleIDE install based on propgcc, so propgcc used to build on the Pi. (FYI - SimpleIDE installed and ran, I'll be trying to program RoboPi with it on Pi2B later today once other tests, photography and editing is done)

    As nearly as I could tell, the errors are due to changes made in the sources used for libtool that were not completed, ie incorrect new macro definitions that do not compile correctly when built. I fixed one, as the error was pretty obvious, however the second was not obvious to me - and until I get past that one, there is no way to know how many more are lurking in there.

    I had hoped to use the time required to build gcc (with various number of parallel compiles) as a real-world benchmark between multicore SBC's, but that is not likely to happen for this round of new reviews (ODROID-C1 and Pi2B).
    This is very odd since other people are able to build the default branch of propgcc. If what you say is true that there are unfinished changes committed, wouldn't that break every build?
  • Bill HenningBill Henning Posts: 6,445
    edited 2015-02-07 12:33
    Now you see why I am scratching my head.

    I was following the instructions precisely, and got those errors. I'll try again as I did do one thing differently - I was compiling on an ODROID-C1.

    The problem is, the errors I was running into were defines being incorrectly ... defined, and were generating errors not warnings.

    I was following the instructions from the propgcc wiki exactly, and made sure I had all the prerequisites.
    David Betz wrote: »
    This is very odd since other people are able to build the default branch of propgcc. If what you say is true that there are unfinished changes committed, wouldn't that break every build?
  • David BetzDavid Betz Posts: 14,511
    edited 2015-02-07 12:38
    the fix script helped, but I still had to fix bad definitions for that macro on two files.

    Basically,

    #define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)

    is bad code, first bool is a reserved keyword, second there is no place for the TRUE to go.

    Needs to be fixed in bfd-in.h and bfd-in2.h located in /home/odroid/buildgcc/propgcc/binutils/bfd

    This should be fixed in the mainline branch.
    Comma is a valid C operator so TRUE is just the right hand size of that operator. This code just guarantees that no matter what the value of bool is, the value of the expression is TRUE. Now, in the example you give that value is being ignored but that is also legal in C. I think this is only being reported as an error because it is being compiled with -Werror which treats all warnings as errors. You can probably fix this by just turning off this warning. It's being overly picky. :-)
  • Bill HenningBill Henning Posts: 6,445
    edited 2015-02-07 13:16
    Ok, I'll try that later.

    I thought the error was valid, as after the preprocessor it would be equivalent to:

    a = b, TRUE

    which could leave a value dangling on the stack.

    On the other hand, gcc is pretty smart... and I might have been a bit paranoid.
    David Betz wrote: »
    Comma is a valid C operator so TRUE is just the right hand size of that operator. This code just guarantees that no matter what the value of bool is, the value of the expression is TRUE. Now, in the example you give that value is being ignored but that is also legal in C. I think this is only being reported as an error because it is being compiled with -Werror which treats all warnings as errors. You can probably fix this by just turning off this warning. It's being overly picky. :-)
  • David BetzDavid Betz Posts: 14,511
    edited 2015-02-07 14:15
    Ok, I'll try that later.

    I thought the error was valid, as after the preprocessor it would be equivalent to:

    a = b, TRUE

    which could leave a value dangling on the stack.

    On the other hand, gcc is pretty smart... and I might have been a bit paranoid.
    GCC computes the values of expressions using registers not the stack. In any case, this is done all the time in C code. How often have you seen a statement like this:
        fclose(fp);
    

    This is exactly the same thing. The fclose function returns a value which is being ignored.
  • SRLMSRLM Posts: 5,045
    edited 2015-02-07 15:19
    Rsadeika wrote: »
    I thought I would give building gcc a try, did not succeed. I installed Ubuntu 14.10, got a clone of the gcc, and then after that did the make stuff. Everything seemed to go OK, but I do not see where the build ended up, this is very frustrating.

    Ray


    From the instructions, it installs in /opt/parallax/bin on Linux machines and C:\propeller-gcc\bin on Windows.

    And if you've followed all the steps you should have PropGCC available on your path, so `propeller-elf-gcc --version` should give you a helpful output.
  • ersmithersmith Posts: 5,940
    edited 2015-02-09 13:28
    Just a general note: the errors you've run into are in the binutils project (containing the assembler, linker, etc.). I've been working on porting the most recent binutils (the one in git) to the propeller. It seems to work OK for me, but fair warning: it hasn't been tested extensively. The sources for the Propeller version are in the git repo:

    https://github.com/totalspectrum/binutils-propeller

    I've been building this on Ubuntu 12.04 LTS, which doesn't have the compile warning issues that others have run into, but presumably the most recent binutils sources will build well on more recent versions of Ubuntu.
  • Bill HenningBill Henning Posts: 6,445
    edited 2015-02-09 19:17
    Thanks for the link Eric! I'll give it a try right after I finish the review I am working on.
    ersmith wrote: »
    Just a general note: the errors you've run into are in the binutils project (containing the assembler, linker, etc.). I've been working on porting the most recent binutils (the one in git) to the propeller. It seems to work OK for me, but fair warning: it hasn't been tested extensively. The sources for the Propeller version are in the git repo:

    https://github.com/totalspectrum/binutils-propeller

    I've been building this on Ubuntu 12.04 LTS, which doesn't have the compile warning issues that others have run into, but presumably the most recent binutils sources will build well on more recent versions of Ubuntu.
Sign In or Register to comment.