Switching to cross compiling

Sysprogs forums Forums VisualGDB Switching to cross compiling

This topic contains 9 replies, has 2 voices, and was last updated by  support 2 days, 10 hours ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #10642

    Brian Beuken
    Participant

    For education purposes I’ve been forcing my students to compile on their target systems (raspberry pi). This was to allow them to understand the benefits of wrapping and to increase awareness of compile times which are far more obvious on the targets.

    I am about to introduce cross compiling but wonder if there is a simple way to convert a VGDB project from target based to cross compile?

     

    #10644

    support
    Keymaster

    Hi,

    You can try adding a new cross-compiler-based Linux configuration to an existing project as shown in this tutorial: https://visualgdb.com/tutorials/porting/linux/

    #10650

    Brian Beuken
    Participant

    That sounds like an excellent solution, I’ll try that this week and update you.

     

    #10720

    Brian Beuken
    Participant

    Im having a few problems I wonder if you can advise

    I sent up a cross compiling configuration and Synced sysroot to include all my relevent directories

    The compiler builds ok but the linker fails as its unable to find the 1st 3 of these libs GLESv2 EGL bcm_host pthread openal alut

    The directory (/usr/lib/arm-linux-gnueabihf) containing libGLESv2_static.a  and .so have been copied to my dev PC ok

    but the toolchain test fails with

    Tool arguments: -Wl,–start-group “C:\Users\Brian Beuken\AppData\Local\Temp\/VisualGDB_ToolchainTestProgram.o” -o “C:\Users\Brian Beuken\AppData\Local\Temp\/VisualGDB_ToolchainTestProgram” -Wl,-gc-sections -L/opt/vc/lib -L/usr/lib/arm-linux-gnueabihf -lGLESv2 -lEGL -lbcm_host -lpthread -lopenal -lalut -Wl,–end-group
    d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/bin/ld.exe: cannot find -lGLESv2
    d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/bin/ld.exe: cannot find -lEGL
    d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/bin/ld.exe: cannot find -lbcm_host
    collect2.exe: error: ld returned 1 exit sta

    Im not sure why it fails to find the files, any ideas?

    • This reply was modified 4 days, 14 hours ago by  Brian Beuken.
    #10726

    support
    Keymaster

    Please try enabling the verbose mode for the linker (add -Wl,-verbose to the LDFLAGS) to see a detailed log on the paths checked by the linker when it attempts to locate those files. This should explain why they are not found.

    #10736

    Brian Beuken
    Participant

    It provides a very long list of directories it attempt so find the missing files in .a and .so formats, and then reports a fail

     

    attempt to open failed
    attempt to open /opt/vc/lib/libGLESv2.so failed
    attempt to open /opt/vc/lib\libGLESv2.a failed
    attempt to open /usr/lib/arm-linux-gnueabihf/libGLESv2.so failed
    attempt to open /usr/lib/arm-linux-gnueabihf\libGLESv2.a failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/libGLESv2.so failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9\libGLESv2.a failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/libGLESv2.so failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf\libGLESv2.a failed
    attempt to open d:/sysprogs/bin/../lib/gcc/libGLESv2.so failed
    attempt to open d:/sysprogs/bin/../lib/gcc\libGLESv2.a failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/lib/libGLESv2.so failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/lib\libGLESv2.a failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/lib/arm-linux-gnueabihf/libGLESv2.so failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/lib/arm-linux-gnueabihf\libGLESv2.a failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/lib/libGLESv2.so failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/lib\libGLESv2.a failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/usr/lib/arm-linux-gnueabihf/libGLESv2.so failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/usr/lib/arm-linux-gnueabihf\libGLESv2.a failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/usr/lib/libGLESv2.so failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/usr/lib\libGLESv2.a failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/q/gnu/linux/raspberry-jessie/out/arm-linux-gnueabihf/lib/libGLESv2.so failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/q/gnu/linux/raspberry-jessie/out/arm-linux-gnueabihf/lib\libGLESv2.a failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/usr/local/lib/libGLESv2.so failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/usr/local/lib\libGLESv2.a failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/lib/libGLESv2.so failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/lib\libGLESv2.a failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/usr/lib/libGLESv2.so failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/usr/lib\libGLESv2.a failed
    attempt to open /opt/vc/lib/libEGL.so failed
    attempt to open /opt/vc/lib\libEGL.a failed
    attempt to open /usr/lib/arm-linux-gnueabihf/libEGL.so failed
    attempt to open /usr/lib/arm-linux-gnueabihf\libEGL.a failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/libEGL.so failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9\libEGL.a failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/libEGL.so failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf\libEGL.a failed
    attempt to open d:/sysprogs/bin/../lib/gcc/libEGL.so failed
    attempt to open d:/sysprogs/bin/../lib/gcc\libEGL.a failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/lib/libEGL.so failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/lib\libEGL.a failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/lib/arm-linux-gnueabihf/libEGL.so failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/lib/arm-linux-gnueabihf\libEGL.a failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/lib/libEGL.so failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/lib\libEGL.a failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/usr/lib/arm-linux-gnueabihf/libEGL.so failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/usr/lib/arm-linux-gnueabihf\libEGL.a failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/usr/lib/libEGL.so failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/usr/lib\libEGL.a failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/q/gnu/linux/raspberry-jessie/out/arm-linux-gnueabihf/lib/libEGL.so failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/q/gnu/linux/raspberry-jessie/out/arm-linux-gnueabihf/lib\libEGL.a failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/usr/local/lib/libEGL.so failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/usr/local/lib\libEGL.a failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/lib/libEGL.so failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/lib\libEGL.a failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/usr/lib/libEGL.so failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/usr/lib\libEGL.a failed
    attempt to open /opt/vc/lib/libbcm_host.so failed
    attempt to open /opt/vc/lib\libbcm_host.a failed
    attempt to open /usr/lib/arm-linux-gnueabihf/libbcm_host.so failed
    attempt to open /usr/lib/arm-linux-gnueabihf\libbcm_host.a failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/libbcm_host.so failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9\libbcm_host.a failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/libbcm_host.so failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf\libbcm_host.a failed
    attempt to open d:/sysprogs/bin/../lib/gcc/libbcm_host.so failed
    attempt to open d:/sysprogs/bin/../lib/gcc\libbcm_host.a failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/lib/libbcm_host.so failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/lib\libbcm_host.a failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/lib/arm-linux-gnueabihf/libbcm_host.so failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/lib/arm-linux-gnueabihf\libbcm_host.a failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/lib/libbcm_host.so failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/lib\libbcm_host.a failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/usr/lib/arm-linux-gnueabihf/libbcm_host.so failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/usr/lib/arm-linux-gnueabihf\libbcm_host.a failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/usr/lib/libbcm_host.so failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/usr/lib\libbcm_host.a failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/q/gnu/linux/raspberry-jessie/out/arm-linux-gnueabihf/lib/libbcm_host.so failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/q/gnu/linux/raspberry-jessie/out/arm-linux-gnueabihf/lib\libbcm_host.a failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/usr/local/lib/libbcm_host.so failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/usr/local/lib\libbcm_host.a failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/lib/libbcm_host.so failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/lib\libbcm_host.a failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/usr/lib/libbcm_host.so failed
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/usr/lib\libbcm_host.a failed
    attempt to open /opt/vc/lib/libpthread.so failed
    attempt to open /opt/vc/lib\libpthread.a failed
    attempt to open /usr/lib/arm-linux-gnueabihf/libpthread.so failed
    attempt to open /usr/lib/arm-linux-gnueabihf\libpthread.a failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/libpthread.so failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9\libpthread.a failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/libpthread.so failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf\libpthread.a failed
    attempt to open d:/sysprogs/bin/../lib/gcc/libpthread.so failed
    attempt to open d:/sysprogs/bin/../lib/gcc\libpthread.a failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/lib/libpthread.so failed
    attempt to open d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/lib\libpthread.a failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/lib/arm-linux-gnueabihf/libpthread.so failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/lib/arm-linux-gnueabihf\libpthread.a failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/lib/libpthread.so failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/lib\libpthread.a failed
    attempt to open d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/usr/lib/arm-linux-gnueabihf/libpthread.so succeeded
    opened script file d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/usr/lib/arm-linux-gnueabihf/libpthread.so
    opened script file d:/sysprogs/bin/../arm-linux-gnueabihf/sysroot/usr/lib/arm-linux-gnueabihf/libpthread.so
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/lib/arm-linux-gnueabihf/libpthread.so.0 succeeded
    /lib/arm-linux-gnueabihf/libpthread.so.0 (d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/lib/arm-linux-gnueabihf/libpthread.so.0)
    attempt to open d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/usr/lib/arm-linux-gnueabihf/libpthread_nonshared.a succeeded
    d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/bin/ld.exe: cannot find : Invalid argument
    d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/bin/ld.exe: cannot find -lGLESv2
    d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/bin/ld.exe: cannot find -lEGL
    d:/sysprogs/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/bin/ld.exe: cannot find -lbcm_host
    collect2.exe: error: ld returned 1 exit status

     

    But, the files are indeed in place on my laptop in D:\SYSProgs\arm-linux-gnueabihf\sysroot\opt\vc\lib

    which is where the synchronisze sysroot put the directories, the list of failed directies does not include

    d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/opt/vc/lib  int its searches. Am I missing something obvious here?

     

     

    • This reply was modified 3 days, 21 hours ago by  Brian Beuken.
    #10738

    Brian Beuken
    Participant

    hard coding the directories and removing the short names does allow it to compile, but the linker then reports a issue  related to an unresolved reference to

    vchiq_release_message in bcm_host

     

    Im going to attempt a complete upload of the Pi’s directories to see if that resolves this but it is confusing, that I cannot simply use synchronise sysroot, and have it look at the library directories and produce the correct settings?

     

    edit, a full sync of the entrie dir structure, short lib names still not found

    adding full path names, allows compile but link throws up countless undefined references

    So still unablet to successfully link or deploy to target.

     

     

    • This reply was modified 3 days, 21 hours ago by  Brian Beuken.
    #10740

    Brian Beuken
    Participant

    I made some progress which may help others.

    I decided to update my Raspberry pi toolchain (do this without a project loaded) and clean my PC side directories, then allow the suggested directories on sync sysroot to download to my PC

    at the end of the sync, I was informed some functions were not compatible with windows and was offered a fix, which I accepted.
    But sadly on 1st attempt to build, with short file names it still was unable to locate GLESv2 EGL and bcm_host, it just ffailed to find the ..\opt\vc\lib dir.

    I removed the short names and provided full directory names in the additional linker options and that passed the tool change test, but an attempt to compile for deploy, only provides a large list of DSO missing errors mostly coming from bcm_host.so but I was able to locate and add so it now looks like this

    D:\SYSProgs\arm-linux-gnueabihf\sysroot\opt\vc\lib\libGLESv2.so D:\SYSProgs\arm-linux-gnueabihf\sysroot\opt\vc\lib\libbcm_host.so D:\SYSProgs\arm-linux-gnueabihf\sysroot\opt\vc\lib\libEGL.so D:\SYSProgs\arm-linux-gnueabihf\sysroot\opt\vc\lib\libvchiq_arm.so d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/opt/vc/lib/libvcos.so

     

    I then realised that perhaps linking the static.a files was a mistake  and switched to .so file

    Finally, this worked, my project now does indeed compile and deploy, and run.

    It turns out with all .so files I didn’t need to add the 2 apparently missing DSO’s D:\SYSProgs\arm-linux-gnueabihf\sysroot\opt\vc\lib\libvchiq_arm.so d:\sysprogs\bin\../arm-linux-gnueabihf/sysroot/opt/vc/lib/libvcos.so

    it does deploy and run now, though I have not worked out how to send my projects assets to the target? There seems to be no auto synchronization process for that as exists on the build on target options?

     

     

     

     

     

    • This reply was modified 3 days, 20 hours ago by  Brian Beuken.
    • This reply was modified 3 days, 19 hours ago by  Brian Beuken.
    #10743

    Brian Beuken
    Participant

    A final comment, which I hope will help others

    Sending assets is done via the Custom build step settings, actually quite painless once I found it. You can do it before the build

    Also setting up an MSbuild config, rather than a GCC config is way easier, GCC is just too fussy,  MSbuild, allows use of short lib filenames and had little issues getting it set up, though do be aware if where you deploy it, on the target, it defaults to /tmp  I changed it to /tmp/obj and then let my assets transfer  into /tmp
    this is more compatible with  an on target built  file structures which assumes your obj is running in a debug folder allowing you to do a step ../ back then into your Resource directories.

    I can now easily swap between on target build  and cross compile configurations as needed.

    MSbuild is also blindingly fast compared to gcc
    Sorry if this has been a strange incoherent set of posts 😀

    It would be nice if Sysprogs could provide some automation of converting an on target build to cross compile build, any chance we might see that or is it there and I missed it?

    #10754

    support
    Keymaster

    Hi,

    Just wanted to let you know that instead of hardcoding the library paths, we would recommend adding “=/opt/vc/lib” to the “library search path” field.

    Regarding the project conversion, the easiest way to do that is to add another configuration and copy the settings there. As switching large projects between direct and cross-build looks like a relatively rare scenario, we don’t want to add a specific fully-automatic command for it. That said, if we get more requests for this feature, we will reconsider this.

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.