Menu

compilation on ubuntu

Benno
2019-09-18
2022-04-29
  • Benno

    Benno - 2019-09-18

    The compilation of stm8-binutils is not working for me on ubuntu.
    The patching and configuring step seem to work just fine, but the compilation with make fails.
    I tried it with different gcc versions (4.8 and 7).
    The compilation process with gcc7 runs considerably longer but eventually fails too (but with
    a different error).
    The error I obtain with gcc7: ser-tcp.c:64:13: error: conflicting declaration ‘typedef int socklen_t’

     

    Last edit: Benno 2019-09-18
    • akre

      akre - 2019-09-18

      What is the rest of the error message saying?

       
  • Benno

    Benno - 2019-09-18
    ser-tcp.c:64:13: error: conflicting declarationtypedef int socklen_ttypedef int socklen_t;
                 ^~~~~~~~~
    In file included from build-gnulib/import/unistd.h:40:0,
                     from ./gnulib/import/pathmax.h:42,
                     from ./common/common-defs.h:73,
                     from defs.h:28,
                     from ser-tcp.c:20:
    /usr/include/unistd.h:277:21: note: previous declaration astypedef __socklen_t socklen_ttypedef __socklen_t socklen_t;
    
     
  • Benno

    Benno - 2019-09-18

    Yes, but i could not make much sense of it. It seems that configure assumes a different compiler version?

     
    • akre

      akre - 2019-09-18

      Stupid question but did you "make distclean" after changing compiler?

       
  • Benno

    Benno - 2019-09-18

    I removed the entire directory and run ran patch_binutils.sh and configure_binutils.sh again before i called make with another compiler

     
  • Benno

    Benno - 2019-09-18

    Update: I have the exact same problem on a centos machine (gcc 7.2)

     
    • akre

      akre - 2019-09-18

      Just compiled everything in ubutu gcc 5.4.0 without any problems.

      I am not sure why compilation fails for you. Looking in /usr/include/unistd.h:

      #if defined __USE_MISC || defined __USE_XOPEN
      # ifndef __socklen_t_defined
      typedef __socklen_t socklen_t;
      #  define __socklen_t_defined
      # endif
      #endif
      

      and __USE_MISC is defined in /usr/include/features.h:

      #if defined _DEFAULT_SOURCE
      # define __USE_MISC     1
      #endif
      
        The `-ansi' switch to the GNU C compiler, and standards conformance
         options such as `-std=c99', define __STRICT_ANSI__.  If none of
         these are defined, or if _DEFAULT_SOURCE is defined, the default is
         to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
         200809L, as well as enabling miscellaneous functions from BSD and
         SVID.  If more than one of these are defined, they accumulate.  For
         example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together
         give you ISO C, 1003.1, and 1003.2, but nothing else.
      

      I think it could have something to do with what C++ standard is used. Check what standard your compiler is using or try supply CXX="g++ -std=gnu+11" to configure in "configure_binutils.sh"

       
  • Benno

    Benno - 2019-09-19

    Neither specifiying CXX="g++ -std=gnu++1" nor using gcc-5-5 helped

     
    • akre

      akre - 2019-09-19

      I am out of ideas. You must have something funky going on with your build environment.

      Could you post the command line for the failing ser-tcp.c source e.i "g++ .... ser-tcp.c" ?

       
  • Benno

    Benno - 2019-09-19
    g++ -x c++ -std=gnu++11 -g -O2   -I. -I. -I./common -I./config -DLOCALEDIR="\"/home/benno/Programs/stm8_binutils/build/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/.. -I./../readline/.. -I./../zlib -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber  -I./gnulib/import -Ibuild-gnulib/import    -I/usr/include/python2.7 -I/usr/include/python2.7 -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized -Wformat-nonliteral  -c -o ser-tcp.o -MT ser-tcp.o -MMD -MP -MF ./.deps/ser-tcp.Tpo ser-tcp.c
    

    I manually commented the typdef of socklen_t in the ser-tcp.c file which fixed this error but then the next error popped up

     

    Last edit: Benno 2019-09-19
  • akre

    akre - 2019-09-23

    FYI I just recompiled everyting with gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 without any problems.

     
  • Benno

    Benno - 2019-11-13

    I gave it another try today. Somehow I had prevent my shell from reading my bashrc when compiling. After that it worked.

     
  • Maxim

    Maxim - 2020-07-23

    upd: sorry for disturb. Everything works. I just though it was incomplete or broken istallation due to such log :-)

    Hi, @arehnman, I faild to compile the latest version of stm8-binutils-gdb (stm8-binutils-gdb-sources-2020-03-22) on Ubuntu 18 (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) ) . I tried it on 2 macines with Ubuntu version I mentioned about and on a machine with Xubuntu with gcc 5.4.
    The tail of the make step log:

    config.status: creating po/Makefile.in
    config.status: executing depfiles commands
    config.status: executing libtool commands
    config.status: executing default-1 commands
    config.status: executing bfd_stdint.h commands
    config.status: executing default commands
    make[3]: Nothing to be done for 'info'.
    make[3]: Leaving directory '/home/m/stm8-binutils-gdb-sources/binutils-2.30/bfd/po'
    make[3]: Entering directory '/home/m/stm8-binutils-gdb-sources/binutils-2.30/bfd'
    make[3]: Nothing to be done for 'info-am'.
    make[3]: Leaving directory '/home/m/stm8-binutils-gdb-sources/binutils-2.30/bfd'
    Makefile:1754: recipe for target 'info-recursive' failed
    make[2]: *** [info-recursive] Error 1
    make[2]: Leaving directory '/home/m/stm8-binutils-gdb-sources/binutils-2.30/bfd'
    Makefile:2691: recipe for target 'all-bfd' failed
    make[1]: *** [all-bfd] Error 2
    make[1]: Leaving directory '/home/m/stm8-binutils-gdb-sources/binutils-2.30'
    Makefile:848: recipe for target 'all' failed
    make: *** [all] Error 2
    

    The intallation of the following didn't help:

    $ sudo apt install libisl-0.18-dev # Seems it's not needed
    $ sudo apt install texinfo
    $ sudo apt install binutils-dev
    $ sudo apt install libbfd-dev # Already installed
    

    I also tried the previous versions and the compilation failed as well, but with slightly different log.
    What direction should I move to succeed?
    Thank you!

     

    Last edit: Maxim 2020-07-23
    • akre

      akre - 2020-07-23

      Was the problem resolved and what was the issue?

       
      • Maxim

        Maxim - 2020-07-23

        Yes, the problem was resolved (there was no a problem actually). I considered that the log of make I posted above is an error, but it's actually not.

         
  • Allan Macdonald

    Allan Macdonald - 2022-04-29

    I don't like seeing errors during make either.
    I'm running Ubuntu 20.04 and to get the package to complile without errors, I had to:

    sudo apt install libncursesw5-dev
    sudo apt install texinfo
    

    I haven't run make install yet or actually tried to run anything so wish me luck!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.