gcc configure for hardware
-
Leon, I have added -mcpu as suggested and got this error. I did put it in both g and g++ compiler options, it shudl be benn in g== only , right ? But it did not "fixed" the error. So it is not there anymore. I think I am looking at the result - no TCF Debug Process Terminal output , but I should be looking at WHY the app really does not start.
19:25:19 **** Build of configuration Debug for project Zero ****
make all
Building file: ../src/Zero.cpp
Invoking: Cross G++ Compiler
arm-linux-gnueabihf-g++ -O0 -g3 -Wall -c -fmessage-length=0 -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -v -MMD -MP -MF"src/Zero.d" -MT"src/Zero.o" -o "src/Zero.o" "../src/Zero.cpp"
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-g++
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-armhf-cross/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-armhf-cross --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-armhf-cross --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libgcj --enable-objc-gc --enable-multiarch --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-multilib --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabihf --program-prefix=arm-linux-gnueabihf- --includedir=/usr/arm-linux-gnueabihf/include
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9)
COLLECT_GCC_OPTIONS='-O0' '-g3' '-Wall' '-c' '-fmessage-length=0' '-mcpu=arm1176jzf-s' '-mfpu=vfp' '-mfloat-abi=hard' '-v' '-MMD' '-MP' '-MF' 'src/Zero.d' '-MT' 'src/Zero.o' '-o' 'src/Zero.o' '-shared-libgcc' '-mthumb' '-mtls-dialect=gnu'
/usr/lib/gcc-cross/arm-linux-gnueabihf/5/cc1plus -quiet -v -imultiaI just found this It is more complicated than I thought: -mtune, -march in GCC – Daniel Lemire's blog[^] I am not done reading - but I am crosscompiling - from IDE on PC and executable on RPi so -march should identify RPi processor - right? In "G++ crosscompiler" settings? This is giving me a headache...
-
I just found this It is more complicated than I thought: -mtune, -march in GCC – Daniel Lemire's blog[^] I am not done reading - but I am crosscompiling - from IDE on PC and executable on RPi so -march should identify RPi processor - right? In "G++ crosscompiler" settings? This is giving me a headache...
I think what it is complaining about is you are obviously on ubuntu linux and the float and ABI setup is different because it's a different flavour of linux. What would be fastest just to see if we are right is copy the code onto a SD media and try compiling it on the Pi, GCC is pre-installed. If it is sudo apt-get gcc. Just want to confirm it is the cross compiling that is causing the problem. It should compile without any complaining on the Pi itself. If that works I will sort out the issue on ubuntu and I just need version and 32 or 64 bit?
In vino veritas
-
I think what it is complaining about is you are obviously on ubuntu linux and the float and ABI setup is different because it's a different flavour of linux. What would be fastest just to see if we are right is copy the code onto a SD media and try compiling it on the Pi, GCC is pre-installed. If it is sudo apt-get gcc. Just want to confirm it is the cross compiling that is causing the problem. It should compile without any complaining on the Pi itself. If that works I will sort out the issue on ubuntu and I just need version and 32 or 64 bit?
In vino veritas
-
Short reply - same code runs on RPi 3B , perhaps swapping SD between 3B an Zero is not a good idea. But in theory the OS should be smart enough to know what hardware it is running on. I'll try clean OS install on Zero next.
Would you take the boot drive out of a PC and expect it to be able to run inside a different model PC without problems? I don't think so.
The difficult we do right away... ...the impossible takes slightly longer.
-
Would you take the boot drive out of a PC and expect it to be able to run inside a different model PC without problems? I don't think so.
The difficult we do right away... ...the impossible takes slightly longer.
Too simplified reasoning. I am pass evaluating OS , I believe the issue is how GCC interacts with TCF in ARM6. It has been established that RPi 0 an 1 are using ARM6 and RPi 2 and up are using ARM 7. ARM6 "code" will run on ARM7, but ARM7 will not run on ARM6. My code runs fine on ARM7, but not on ARM6. Exactly opposite expectations. I did verify that TCF was build for ARM6 , but it is failing on ARM6 processor- where is should be "native". The whole point of this troubleshooting is to find out - at lest in theory, what is happening. I am in process of comparing compilation outputs on ARM6 versus ARM7. I have not figured out how to verify / debug the running TCF code on either processor. It is little time consuming process keep switching between RPi's. But I do appreciate any input to help solve this.
-
Would you take the boot drive out of a PC and expect it to be able to run inside a different model PC without problems? I don't think so.
The difficult we do right away... ...the impossible takes slightly longer.
Richard .. It is trivial I do it all the time even in baremetal. That is a bit like saying 386 code should not run on 486, 586, 686 etc Val I do the change SD card from Pi1,Pi2, Pi3, Pi ZeroW every day of week it is not an issue. My zero's for example don't have a screen I have to put the SD card into a 2 or 3 to edit configs. I would also add the Raspbian install image doesn't ask you what model you are on or have different installs :-) Throw what you are doing up on Github or a website Val and I will have a look and sort it out. Anything you compile for ARM6 should definitely work on any ARM7/ARM8 model Pi so long as you deal with the couple of small differences if you start poking registers.
In vino veritas
-
Richard .. It is trivial I do it all the time even in baremetal. That is a bit like saying 386 code should not run on 486, 586, 686 etc Val I do the change SD card from Pi1,Pi2, Pi3, Pi ZeroW every day of week it is not an issue. My zero's for example don't have a screen I have to put the SD card into a 2 or 3 to edit configs. I would also add the Raspbian install image doesn't ask you what model you are on or have different installs :-) Throw what you are doing up on Github or a website Val and I will have a look and sort it out. Anything you compile for ARM6 should definitely work on any ARM7/ARM8 model Pi so long as you deal with the couple of small differences if you start poking registers.
In vino veritas
Leon, sorry for late reply. Here is (another) short update . I may have already said that the only option for crosscompliing is the "prefix"
arm-linux-gnueabihf
so this may be dupe. With that "prefix" the crosscompiler comes up with -march=arm7... So I added -march=armv6 ( for Zero) and got this
/usr/arm-linux-gnueabihf/include/c++/5/exception:63:39: sorry, unimplemented: Thumb-1 hard-float VFP ABI
exception() _GLIBCXX_USE_NOEXCEPT { }
^
src/subdir.mk:18: recipe for target 'src/Zero.o' failedAdding -marm gets rid of the problem. I did briefly check what -marm option does and it is related to some switching between things. Unimportant at this time - I just wanted clean compile. The "bottom line" _ I can actually run Eclipse and in "debug" perspective I get "TCF Agent disconnected ' Permission denied. " I have seen this error long time ago when I started with TCF - turned out to be related to running "TCF Agent " as root. BUT TCF Agent runs in root as default while using RPi 3B - so the problem MUST be somewhere else. BTW I am having heck of time using " newest and greatest Eclipse " I would like to try some other C++ IDE to run in crosscompile / TCF mode instead of Eclipse. Cheers and thanks.
-
Leon, sorry for late reply. Here is (another) short update . I may have already said that the only option for crosscompliing is the "prefix"
arm-linux-gnueabihf
so this may be dupe. With that "prefix" the crosscompiler comes up with -march=arm7... So I added -march=armv6 ( for Zero) and got this
/usr/arm-linux-gnueabihf/include/c++/5/exception:63:39: sorry, unimplemented: Thumb-1 hard-float VFP ABI
exception() _GLIBCXX_USE_NOEXCEPT { }
^
src/subdir.mk:18: recipe for target 'src/Zero.o' failedAdding -marm gets rid of the problem. I did briefly check what -marm option does and it is related to some switching between things. Unimportant at this time - I just wanted clean compile. The "bottom line" _ I can actually run Eclipse and in "debug" perspective I get "TCF Agent disconnected ' Permission denied. " I have seen this error long time ago when I started with TCF - turned out to be related to running "TCF Agent " as root. BUT TCF Agent runs in root as default while using RPi 3B - so the problem MUST be somewhere else. BTW I am having heck of time using " newest and greatest Eclipse " I would like to try some other C++ IDE to run in crosscompile / TCF mode instead of Eclipse. Cheers and thanks.
OK, here is the latest. I compile C++ code for armv6 and run ( identical ) TCF Agent software ( the latest) on Raspberry Pi 3B and it works. Produce “hello word” output. Same setup fails on Raspberry Pi Zero. No output whatsoever. The ONLY difference is - I select appropriate WiFI connection for each hardware - on Eclipse TCF configuration - swapping Agent IP ! Same WiFi configuration ! ( Yes, I have BOTH RPi powered and running ) At this point I have exhausted pretty much all software options. I am open to suggestions - one being "ditch Zero"
-
OK, here is the latest. I compile C++ code for armv6 and run ( identical ) TCF Agent software ( the latest) on Raspberry Pi 3B and it works. Produce “hello word” output. Same setup fails on Raspberry Pi Zero. No output whatsoever. The ONLY difference is - I select appropriate WiFI connection for each hardware - on Eclipse TCF configuration - swapping Agent IP ! Same WiFi configuration ! ( Yes, I have BOTH RPi powered and running ) At this point I have exhausted pretty much all software options. I am open to suggestions - one being "ditch Zero"
One more to discuss. To crosscompile C++ code I specify this "prefix"
arm-linux-gnueabihf
Already beaten to death. The output from both "cross" compiler and linker only reference to hardware is "arm7". After reading up on how crosscomplier works - there shoudl be "--host","--build" and " --target" options to specify (what ? OS / hardware ?) somewhere. There are none! The only one is - as mentioned - the "magical " arm7.
-
One more to discuss. To crosscompile C++ code I specify this "prefix"
arm-linux-gnueabihf
Already beaten to death. The output from both "cross" compiler and linker only reference to hardware is "arm7". After reading up on how crosscomplier works - there shoudl be "--host","--build" and " --target" options to specify (what ? OS / hardware ?) somewhere. There are none! The only one is - as mentioned - the "magical " arm7.
OK, I was wrong Here is what is in output - both compiler and linker
--build=x86_64-linux-gnu --host=x86_64-linux-gnu –target=arm-linux-gnueabihf
This is what I am reading ( into it) - in English "build" C++ code ( on OS (?)
x86_64-linux-gnu
) "host" is OS(?)
x86_64-linux-gnu
and "host" does what ? and the code will run on "target "
arm-linux-gnueabihf
So where is the "target" (armv6l) (?) specification - hardware , OS , etc . ? Am I finally asking right questions? Do I need better terminology ? Would it help to post the entire output?