You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2019/10/30 22:35:53 UTC

[GitHub] [mynewt-core] brainstorm opened a new issue #2076: multiple definition of `fflush'

brainstorm opened a new issue #2076: multiple definition of `fflush'
URL: https://github.com/apache/mynewt-core/issues/2076
 
 
   While compiling this mynewt project: https://github.com/chris-zen/mdp-link-mynewt/ using the HEAD version of mynewt:
   
   ```shell
   $ newt version
   Apache Newt
      Version: 1.8.0-dev
     Git Hash: d703a10-dirty
   Build Date: 2019-10-30_23:28
   ```
   
   Running OSX Catalina 10.15, but the system's compiler is not cross-compiling this anyway (see further below for the affected GCC)
   
   ```
   $ gcc --version
   Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
   Apple clang version 11.0.0 (clang-1100.0.33.8)
   Target: x86_64-apple-darwin19.0.0
   Thread model: posix
   InstalledDir: /Library/Developer/CommandLineTools/usr/bin
   ```
   
   Anyway, the core of the issue is that I'm faced with this:
   
   ```shell
   (...)
   Archiving @tinyusb_tinyusb.a
   Archiving @apache-mynewt-core_util_mem.a
   Archiving @apache-mynewt-core_util_rwlock.a
   Linking /Users/romanvg/dev/mdp/mdp-link-mynewt/bin/targets/nrf52_mdp_link/app/apps/mdp-link/mdp-link.elf
   Error: /usr/local/Cellar/arm-none-eabi-gcc/20160926/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv7e-m/libg.a(lib_a-fflush.o): In function `fflush':
   fflush.c:(.text.fflush+0x0): multiple definition of `fflush'
   /Users/romanvg/dev/mdp/mdp-link-mynewt/bin/targets/nrf52_mdp_link/app/@apache-mynewt-core/libc/baselibc/@apache-mynewt-core_libc_baselibc.a(inline.o):/Users/romanvg/dev/mdp/mdp-link-mynewt/repos/apache-mynewt-core/libc/baselibc/include/stdio.h:99: first defined here
   collect2: error: ld returned 1 exit status
   ```
   
   Which I temporarily solve modifying the `stdio.h` header under `repos/apache-mynewt-core/libc/baselibc/include/stdio.h`:
   
   ```diff
   $ git diff stdio.h.orig stdio.h
   diff --git a/libc/baselibc/include/stdio.h b/libc/baselibc/include/stdio.h
   index fa7103fd0..8ec0d27e1 100644
   --- a/libc/baselibc/include/stdio.h
   +++ b/libc/baselibc/include/stdio.h
   @@ -93,10 +93,12 @@ __extern_inline char *strerror(int errnum)
    #define getc(f) fgetc(f)
    #define getchar() fgetc(stdin)
   
   +/*
    __extern_inline int fflush(FILE *stream)
    {
           return 0;
    }
   +*/
   
    __extern int printf(const char *, ...);
    __extern int vprintf(const char *, va_list);
   ```
   
   And then it compiles/links successfully:
   
   ```
   $ newt build nrf52_mdp_link
   Building target targets/nrf52_mdp_link
   Target successfully built: targets/nrf52_mdp_link
   ```
   
   I guess I should get rid of my relatively old gcc homebrew dependency with proxmark3?:
   
   ```
   $ brew info arm-none-eabi-gcc
   proxmark/proxmark3/arm-none-eabi-gcc: stable 20160926
   GCC for embedded ARM processors
   https://launchpad.net/gcc-arm-embedded
   /usr/local/Cellar/arm-none-eabi-gcc/20160926 (5,502 files, 447.0MB) *
     Built from source on 2017-12-09 at 00:02:56
   From: https://github.com/proxmark/homebrew-proxmark3/blob/master/arm-none-eabi-gcc.rb
   ```
   
   Any suggestions on which brew formula to pull a newer compiler from are welcome since there seems to only be one `arm-none-eabi-gcc` on my Homebrew:
   
   ```shell
   $ brew search arm-none-eabi
   ==> Formulae
   proxmark/proxmark3/arm-none-eabi-gcc
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services