Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. gcc configure for hardware

gcc configure for hardware

Scheduled Pinned Locked Moved C / C++ / MFC
questionlinuxhardwareworkspace
17 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L leon de boer

    Yes Hello.C just uses all linux calls what may be problematic is if you use floats. GCC still defaults to some standard hard float and they are different on each model. So the very minimum I would specify the flags for the model. What I forgot to tell you is if you use the flags for the Pi1 the produced code will work on all other models. The models are supersets of each other. It a bit like intel processors if we lined i386, i486, i586 code written for i386 runs on i486 and i586 however i586 code wont always run on i386 because it has extra instructions. Same with arm ARM6 < ARM7 < ARM8 so ARM6 code runs on any model but ARM8 code has extra codes and may not run on ARM. So I would start with Pi1 flags which should work on all models

    -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard

    In vino veritas

    V Offline
    V Offline
    Vaclav_
    wrote on last edited by
    #7

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

    V 1 Reply Last reply
    0
    • V Vaclav_

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

      V Offline
      V Offline
      Vaclav_
      wrote on last edited by
      #8

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

      L 1 Reply Last reply
      0
      • V Vaclav_

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

        L Offline
        L Offline
        leon de boer
        wrote on last edited by
        #9

        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

        V 1 Reply Last reply
        0
        • L leon de boer

          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

          V Offline
          V Offline
          Vaclav_
          wrote on last edited by
          #10

          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.

          Richard Andrew x64R 1 Reply Last reply
          0
          • V Vaclav_

            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.

            Richard Andrew x64R Offline
            Richard Andrew x64R Offline
            Richard Andrew x64
            wrote on last edited by
            #11

            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.

            V L 2 Replies Last reply
            0
            • Richard Andrew x64R Richard Andrew x64

              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.

              V Offline
              V Offline
              Vaclav_
              wrote on last edited by
              #12

              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.

              1 Reply Last reply
              0
              • Richard Andrew x64R Richard Andrew x64

                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.

                L Offline
                L Offline
                leon de boer
                wrote on last edited by
                #13

                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

                V 1 Reply Last reply
                0
                • L leon de boer

                  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

                  V Offline
                  V Offline
                  Vaclav_
                  wrote on last edited by
                  #14

                  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' failed

                  Adding -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.

                  V 1 Reply Last reply
                  0
                  • V Vaclav_

                    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' failed

                    Adding -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.

                    V Offline
                    V Offline
                    Vaclav_
                    wrote on last edited by
                    #15

                    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"

                    V 1 Reply Last reply
                    0
                    • V Vaclav_

                      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"

                      V Offline
                      V Offline
                      Vaclav_
                      wrote on last edited by
                      #16

                      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.

                      V 1 Reply Last reply
                      0
                      • V Vaclav_

                        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.

                        V Offline
                        V Offline
                        Vaclav_
                        wrote on last edited by
                        #17

                        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?

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups