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

  • From: Pekka Nikander <pekka.nikander@xxxxxx>
  • To: ell-i-developers@xxxxxxxxxxxxx
  • Date: Fri, 21 Feb 2014 08:16:09 +0200

> 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: