[ell-i-developers] Re: Ellduino Emulator: Fixing issues for Linux (Ubuntu 12.04 LTS)

  • From: Eero Hakala <eero.k.hakala@xxxxxxxxx>
  • To: ell-i-developers@xxxxxxxxxxxxx
  • Date: Sun, 23 Feb 2014 17:42:03 +0200

Hi, after BIG hassle, I finally succeeded in getting same error messages as
Asif :)

some comments about upgrading gcc compilers and ubuntu...

Download and unpcack the source file,
and then changing to the directory created when unpacking (in my case

This might be needed...?
Install some additional libraries (sudo apt-get install libgmp-dev
libmpfr-dev libmpc-dev libc6-dev)

Installing the additional libraries was not enough for me, but running

Then compile the source:
./configure --prefix=/usr/bin/gcc-4.8.2
sudo make install

set the new compiler version as default:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8.2 50

Then I gitcloned the latest Runtime and ...

The cross compiler environment made its work without errors

but compiling the emulator I got these errors
In file included from ../emulator/inc/USART.h:28:0,
                 from ../emulator/src/USART.cpp:20:
../emulator/inc/stm32f0xx.h:69:19: fatal error: USART.H: No such file or
 #include <USART.H>
compilation terminated.
after correcting this one (with USART.h), I got the same error as Asif

g++ -m32 -march=i386 -m32 -demangle -o sketch  main.o sketch.o ellduino.o
"-L." "-L../variants/ellduino" "-lstm32f0" -lstdc++
../variants/ellduino/libstm32f0.a(system_init.o): In function
undefined reference to `__peripheral_start'
undefined reference to `__peripheral_end'
collect2: error: ld returned 1 exit status
make[1]: *** [sketch] Error 1


On Fri, Feb 21, 2014 at 8:16 AM, Pekka Nikander <pekka.nikander@xxxxxx>wrote:

> > using default linker and removing the emulator_pre.o & emulator_post.o
> from emulator.mk leaves errors which had to be solved:
> > system_init.c:111: undefined reference to `__peripheral_start'
> > system_init.c:111: undefined reference to `__peripheral_end'
> This is right, exactly as it should be.
> >> you have to create a new linker script, and either copy to it or
> include to it the default gcc 4.7 linker file for Linux.
> > I tried my best to find the default script file ... I couldn't ... the
> only way to see it was "ld --verbose".
> Well, contrary to what you sayd, you actually could, with ld --verbose :-)
>   I guess you used, with your native Linux 4.7 gcc, the command "gcc
> -Xlinker --verbose" or something like that.
> > I tried copying the default linker file content to emulator/ld/linux.ld
> and then tried making emulator which left me with following errors: Note
> here that, I have already installed g++-multilib, c++-multilib,
> build-essentials, ia32-lib, etc Also, I tired to put paths to
> LD_LIBRARY_PATH and LD_INCLUDE_PATH through export command. You may not
> know the Linux related problems, but ... you might give a general idea
> what's wrong now over here.
> >
> > g++ -m32 -L/usr/lib32 -march=i386 -m32
> -T/home/asif/Ell-i/Runtime/stm32/emulator/ld/linux.ld -o sketch  main.o
> sketch.o ellduino.o "-L." "-L../variants/ellduino" "-lstm32f0" -lstdc++
> That command line looks good to me.
> > /usr/bin/ld: skipping incompatible ../variants/ellduino/libstm32f0.a
> when searching for -lstm32f0
> > /usr/bin/ld: cannot find -lstm32f0
> > /usr/bin/ld: skipping incompatible
> /usr/lib/gcc/x86_64-linux-gnu/4.7/32/libstdc++.so when searching for
> -lstdc++
> > /usr/bin/ld: skipping incompatible
> /usr/lib/gcc/x86_64-linux-gnu/4.7/32/libstdc++.a when searching for -lstdc++
> > /usr/bin/ld: skipping incompatible
> /usr/lib/gcc/x86_64-linux-gnu/4.7/32/libstdc++.so when searching for
> -lstdc++
> > /usr/bin/ld: skipping incompatible
> /usr/lib/gcc/x86_64-linux-gnu/4.7/32/libstdc++.a when searching for -lstdc++
> > /usr/bin/ld: skipping incompatible /usr/lib32/libm.so when searching for
> -lm
> > /usr/bin/ld: skipping incompatible /usr/lib32/libm.a when searching for
> -lm
> etc.
> For some reason the linker is attempting to link for some other
> architecture but i386, as it is rejecting the i386 version of libm.so and
> libm.a   I get the feeling that it may be trying to link for arm, for some
> reason.
> Either you may be using an ARM version of the gcc, which doesn't seem to
> be the case, as the compiler is not complaining about -march=i386 flag,
> your main.o etc happened to be ARM binaries when you tried that, which I
> think is unlikely, or there is something wrong elsewhere.  Most likely
> there is something wrong with your linker script.
> Could you please post here the path to the default Linux linker script
> that you copied from, and a context diff (diff -c) from the default Linux
> linker script to your own, i.e.
>   diff -c <path-to-the-default-linux-linker-script>
> /home/asif/Ell-i/Runtime/stm32/emulator/ld/linux.ld
> --Pekka

Other related posts: