Shop OBEX P1 Docs P2 Docs Learn Events
Raspberry Pi compiling propgcc — Parallax Forums

Raspberry Pi compiling propgcc

Hi,

I am trying to compile propgcc on a Raspberry Pi 3 (Kano). Here is what I have done so far:
$ git clone https://github.com/parallaxinc/propgcc
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install mercurial
$ sudo apt-get install texinfo
$ sudo apt-get install bison
$ sudo apt-get install flex
$ sudo mkdir /opt/parallax/

I then ran the following code to resolve the issue discussed here: https://www.linuxquestions.org/questions/linux-from-scratch-13/make-error-in-compiling-binutils-4175476855/
$ cd propgcc/binutils/
$ sudo sed -i -e 's/@colophon/@@colophon/' \
       -e 's/doc@cygnus.com/doc@@cygnus.com/' bfd/doc/bfd.texinfo

I then ran make which resulted in the following errors:
Making all in po
make[5]: Entering directory '/home/swan/dev/build/binutils/bfd/po'
make[5]: Nothing to be done for 'all'.
make[5]: Leaving directory '/home/swan/dev/build/binutils/bfd/po'
make[5]: Entering directory '/home/swan/dev/build/binutils/bfd'
/bin/bash ./libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I/home/swan/dev/propgcc/binutils/bfd -I. -I/home/swan/dev/propgcc/binutils/bfd -I/home/swan/dev/propgcc/binutils/bfd/../include  -DHAVE_bfd_elf32_propeller_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec  -DBINDIR='"/opt/parallax/bin"'  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT opncls.lo -MD -MP -MF .deps/opncls.Tpo -c -o opncls.lo /home/swan/dev/propgcc/binutils/bfd/opncls.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I/home/swan/dev/propgcc/binutils/bfd -I. -I/home/swan/dev/propgcc/binutils/bfd -I/home/swan/dev/propgcc/binutils/bfd/../include -DHAVE_bfd_elf32_propeller_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec -DBINDIR=\"/opt/parallax/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT opncls.lo -MD -MP -MF .deps/opncls.Tpo -c /home/swan/dev/propgcc/binutils/bfd/opncls.c -o opncls.o
In file included from /home/swan/dev/propgcc/binutils/bfd/opncls.c:26:0:
/home/swan/dev/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/swan/dev/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
Makefile:1575: recipe for target 'opncls.lo' failed
make[5]: *** [opncls.lo] Error 1
make[5]: Leaving directory '/home/swan/dev/build/binutils/bfd'
Makefile:1617: recipe for target 'all-recursive' failed
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory '/home/swan/dev/build/binutils/bfd'
Makefile:1108: recipe for target 'all' failed
make[3]: *** [all] Error 2
make[3]: Leaving directory '/home/swan/dev/build/binutils/bfd'
Makefile:2505: recipe for target 'all-bfd' failed
make[2]: *** [all-bfd] Error 2
make[2]: Leaving directory '/home/swan/dev/build/binutils'
Makefile:837: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/swan/dev/build/binutils'
Makefile:162: recipe for target '/home/swan/dev/propgcc/../build/binutils/binutils-built' failed
make: *** [/home/swan/dev/propgcc/../build/binutils/binutils-built] Error 2

Then the first errors I see in ../build/binutils/config.log
Thread model: posix
gcc version 4.9.2 (Raspbian 4.9.2-10) 
configure:4047: $? = 0
configure:4036: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:4047: $? = 4
configure:4036: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.

I would really appreciate any insight on how to resolve or get around this issue.

Cheers!

dustfinger.

Comments

  • There are lots of warnings that need to be turned off to compile propgcc using recent versions of gcc. Take a look at the file "fix-xcode-warnings.sh" to see what I needed to do to get it to compile on the Mac. Similar things might be required for more modern versions of Linux.
  • JonMJonM Posts: 318
    edited 2017-12-29 21:39
    You might what to have a look-see at this thread since it appears this issue has been seen before:
    forums.parallax.com/discussion/160009/error-when-building-gcc


    Also, look here:
    https://sourceforge.net/p/sdcc/mailman/message/32589131/
  • Thank you David Betz and JonM.

    JonM,
    You might what to have a look-see at this thread since it appears this issue has been seen before:
    You are correct, I should have done more research on these forums before posting. Thank you kindly for those links.

    I added the following line to fix-xcode-warnings.sh.
    -Wno-error=unused-value \
    

    Then ran:
    $ sudo rm -rf ../build && sudo make clean && sudo ./fix-xcode-warnings.sh && sudo make
    

    But I am getting exactly the same complaint about:
    ./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)
    

    for some reason my cflags are not being applied to gcc or they are being overridden somewhere? Am I using the script incorrectly?
  • dgatelydgately Posts: 1,621
    edited 2017-12-30 17:05
    dustfinger wrote: »
    I added the following line to fix-xcode-warnings.sh.
    -Wno-error=unused-value \
    

    Then ran:
    $ sudo rm -rf ../build && sudo make clean && sudo ./fix-xcode-warnings.sh && sudo make
    

    But I am getting exactly the same complaint about:
    ./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)
    

    I think you will need to 'source' the fix-warnings file...
    $ source fix-xcode-warnings.sh
    
    Before sourcing the fix-warnings file & after running:
    $sudo ./fix-xcode-warnings.sh
    $ printing | grep "Wno"
    
    I got no response. But, when I sourced the fix-warnings file I get:
    $ source fix-xcode-warnings.sh 
    $ printenv | grep Wno
    CFLAGS=-Wno-string-plus-int -Wno-deprecated-declarations -Wno-empty-body -Wno-self-assign -Wno-sometimes-uninitialized -Wno-uninitialized -Wno-unknown-warning-option -Wno-shift-negative-value -Wn-unused-function
    
    export (which is in the fix-warnings) file, needs to be 'sourced'.

    Try:
    $ sudo rm -rf ../build && sudo make clean && source fix-xcode-warnings.sh && sudo make
    


    dgately
  • Thank you dgately,

    TIL;
    think you will need to 'source' the fix-warnings file...
    $ source fix-xcode-warnings.sh
    

    I have only ever used the source command for updating /etc/profile or ~/.profile, I never thought to use it targeting the fix-warnings.sh. Thank you. I realize that Bill Henning mentions that he sourced this file in this thread, but I did not understand at the time what he meant.

    So I got a lot farther, but have run into another issue. The following is what I did:

    Removed -Wno-string-plus-int and -Wno-sometimes-uninitialized from fix-xcode-warnings since they are not valid CFLAGS on my system. My fix-xcode-warnings.sh now contains:
    export CFLAGS="\                                                                                                                                                                      
    -Wno-deprecated-declarations \                                                                                                                                                        
    -Wno-empty-body \                                                                                                                                                                     
    -Wno-error=unused-value \                                                                                                                                                             
    -Wno-unused-value"
    

    I installed the following additional packages:
    sudo apt-get install build-essential
    sudo apt-get install libtool-bin
    

    I found I needed to source the CFLAGS as root since it will need to output the binary to the /opt/parallax folder.
    sudo -s
    rm -rf ../build && make clean && source fix-xcode-warnings.sh && make
    
    ... lots of output clipped for readability
    
    make[5]: Leaving directory '/home/swan/dev/build/binutils/bfd/doc'                                                                                                                    
    Making all in po                                                                                                                                                                      
    make[5]: Entering directory '/home/swan/dev/build/binutils/bfd/po'                                                                                                                    
    make[5]: Nothing to be done for 'all'.                                                                                                                                                
    make[5]: Leaving directory '/home/swan/dev/build/binutils/bfd/po'                                                                                                                     
    make[5]: Entering directory '/home/swan/dev/build/binutils/bfd'                                                                                                                       
    /bin/bash ./libtool --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -Wno-deprecated-declarations -Wno-empty-body -Wno-error=unused-valu
    e -Wno-unused-value -rpath /opt/parallax/armv7l-unknown-linux-gnueabihf/propeller-elf/lib -release `cat libtool-soversion`   -o libbfd.la  archive.lo archures.lo bfd.lo bfdio.lo bfd
    win.lo cache.lo coffgen.lo corefile.lo format.lo init.lo libbfd.lo opncls.lo reloc.lo section.lo syms.lo targets.lo hash.lo linker.lo srec.lo binary.lo tekhex.lo ihex.lo stabs.lo st
    ab-syms.lo merge.lo dwarf2.lo simple.lo compress.lo verilog.lo `cat ofiles`                                                                                                           
    cat: libtool-soversion: No such file or directory                                                                                                                                     
    libtool: link: you must specify an output file                                                                                                                                        
    libtool: link: Try `libtool --help --mode=link' for more information.                                                                                                                 
    Makefile:1211: recipe for target 'libbfd.la' failed                                                                                                                                   
    make[5]: *** [libbfd.la] Error 1                                                                                                                                                      
    make[5]: Leaving directory '/home/swan/dev/build/binutils/bfd'                                                                                                                        
    Makefile:1617: recipe for target 'all-recursive' failed                                                                                                                               
    make[4]: *** [all-recursive] Error 1                                                                                                                                                  
    make[4]: Leaving directory '/home/swan/dev/build/binutils/bfd'                                                                                                                        
    Makefile:1108: recipe for target 'all' failed                                                                                                                                         
    make[3]: *** [all] Error 2                                                                                                                                                            
    make[3]: Leaving directory '/home/swan/dev/build/binutils/bfd'                                                                                                                        
    Makefile:2505: recipe for target 'all-bfd' failed                                                                                                                                     
    make[2]: *** [all-bfd] Error 2                                                                                                                                                        
    make[2]: Leaving directory '/home/swan/dev/build/binutils'                                                                                                                            
    Makefile:837: recipe for target 'all' failed                                                                                                                                          
    make[1]: *** [all] Error 2                                                                                                                                                            
    make[1]: Leaving directory '/home/swan/dev/build/binutils'                                                                                                                            
    Makefile:162: recipe for target '/home/swan/dev/propgcc/../build/binutils/binutils-built' failed                                                                                      
    make: *** [/home/swan/dev/propgcc/../build/binutils/binutils-built] Error 2
    

    It seems to be complaining that there is no such file or directory named libtool-soversion. I found that file at binutils/bfd/libtool-soversion. Any idea what the problem is here? Do I need to make a sym link of that file in another directory so that it can be found maybe? It is weird because the last directory it enters before the failure is the same directory that libtool-soversion is in so I am thinking that I must be miss interpreting the error.
  • dustfinger,

    I'm not sure why you've got to 'sudo' in order to make propgcc. That may be a small part of the problems and may also cause problems once you do get propgcc to build. "/opt/parallax" & "/opt/parallax/bin" should not require root access, else you may not be able to execute "propeller-elf-gcc" from those directories. I am on a Mac OS system, but permissions should be the same as Linux/Unix. As the only user of my system, I set those directories (from /opt on down) to myUser:wheel, which gave me access and no longer needing to 'sudo' my commands.

    Also, when I had similar issue in building the entire propgcc from the top level, I cd'd down a few layers and ran configure & make to get a closer look at the issues. Maybe try:
    $ cd /home/swan/dev/build/binutils/bfd
    $ ./configure
    ...
    $ make
    

    This might make it a little easier to debug what's going on. Once you get bfd to build, move up to binutils & do the same.

    dgately
  • I've tried this myself with a Raspberry Pi running Stretch and I ran into the same issue. However, I believe the "gcc -V" errors/warnings are just warnings and are due to a change in gcc where '-V' or '-vqversion' is no longer supported.

    Result of running 'gcc -V on command line:
    $ gcc -V
    gcc: error: unrecognized command line option ‘-V’
    gcc: fatal error: no input files
    compilation terminated.
    [code]
    
    In my case, looking further down the config.log, there were other errors that seem to be the cause of the failed build.
    
    [code]configure:5096: result: .libs
    configure:5645: checking for PWL_handle_timeout in -lpwl
    configure:5670: gcc -o conftest -g -O2   conftest.c -lpwl    -lstdc++ -lm >&5
    /usr/bin/ld: cannot find -lpwl
    collect2: error: ld returned 1 exit status
    configure:5670: $? = 1
    configure: failed program was:
    | /* confdefs.h */
    | #define PACKAGE_NAME ""
    | #define PACKAGE_TARNAME ""
    | #define PACKAGE_VERSION ""
    | #define PACKAGE_STRING ""
    | #define PACKAGE_BUGREPORT ""
    | #define PACKAGE_URL ""
    | #define LT_OBJDIR ".libs/"
    | /* end confdefs.h.  */
    |
    | /* Override any GCC internal prototype to avoid an error.
    |    Use char because int might match the return type of a GCC
    |    builtin and then its argument prototype would still apply.  */
    | #ifdef __cplusplus
    | extern "C"
    | #endif
    | char PWL_handle_timeout ();
    | int
    | main ()
    | {
    | return PWL_handle_timeout ();
    |   ;
    |   return 0;
    | }
    configure:5679: result: no
    configure:5693: checking for version 0.11 (revision 0 or later) of PPL
    configure:5710: gcc -c -g -O2    conftest.c >&5
    conftest.c: In function 'main':
    conftest.c:16:5: error: unknown type name 'choke'
         choke me
         ^~~~~
    configure:5710: $? = 1
    configure: failed program was:
    | /* confdefs.h */
    | #define PACKAGE_NAME ""
    | #define PACKAGE_TARNAME ""
    | #define PACKAGE_VERSION ""
    | #define PACKAGE_STRING ""
    | #define PACKAGE_BUGREPORT ""
    | #define PACKAGE_URL ""
    | #define LT_OBJDIR ".libs/"
    | /* end confdefs.h.  */
    | #include "ppl_c.h"
    | int
    | main ()
    | {
    |
    |     #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 11
    |     choke me
    |     #endif
    |
    |   ;
    |   return 0;
    | }
    configure:5714: result: no
    configure:7012: checking for default BUILD_CONFIG
    configure:7044: result:
    

    I attempted to down rev texinfo from 6.3.0 that was installed to 4.13 as is listed on the Parallax GCC page, but did not change the results for me.
    https://github.com/parallaxinc/propgcc-docs/blob/master/doc/BuildPreReq.md

    -dgately
    There is no 'configure' file in the 'build/binutils/bfd' folder in my config.

    I'm still trying to track this down.
  • Thank you dgately and JonM. I am out on the road until Thur., but when I return back I will investigate this further and report back with my findings. Thank you both for your insights. JonM, if I am able to resolve the issue I will be post the details of the resolution.

    Thanks again!
  • From what I have gathered, the issue is that the '-lpwl' option is for "Parma Watchdog Library" which is missing from Raspbian. on something like an Ubuntu system, this could be resolved by installing 'libpwl-dev':
    apt-get install libpwl-dev
    

    However, there is no package for Raspian thus this will fail. Also, it appears that PWL was merged into PPL "Parma Polyhedra Library" and is no longer a separate download:
    cs.unipr.it/pipermail/ppl-devel/2012-February/017944.html

    I have installed "libppl-dev" but did not have any affect on resolving this.

    There is a Patch for 'configure.ac' that should lists adding '-lpwl' to PPL but I have not tried this and not sure if it is applicable in this situation. But then again this could be the source of the issue where '-lpwl' was added.
    https://patchwork.ozlabs.org/patch/83630/
Sign In or Register to comment.