Closed johncblacker closed 3 years ago
@johncblacker, look into this:
The first part shows you how to create a toolchain and what is its content. The second part, shows you how to use the toolchain together with buildroot to create a functioning image and a sysroot that can be used together with your toolchain to cross compile applications in bazel. There is also an example at the end how to use both manually to cross compile a simple main.
This split gives you the possibility to use one toolchain in different products (different images, sysroots, etc.).
So yes, this approach requires to have it split, but nothing prevents you from putting them together in one archive.
OK, thanks. Trying steps on "using-crosstool-ng-generate..." and ran into error executing ./bootstrap; specifically, line 821 : autoreconf: command not found. So, can't go further without resolving that error. Is autoreconf supposed to be a script? What to do?
Seems autoreconf is part of the autoconf package, at least on archlinux.
Yes, it seems I didn’t do my “homework” and install all the dependencies. Once I installed them as noted in the crosstool-NG doc, all was well except when I tried to perform the
build. In accordance with your tutorial I did a “git checkout 56559366b; however, doing so results in an error during build in retrieving the “isl” package. I decided to simply do a checkout of the “master” branch and all built fine and I was able to get through the whole process, down to compiling the simple hello program. I do, however, suggest that you change your document to change the git checkout to whatever commit is associated with the master branch. That way, you will not be bothered with people running into problems when they try to build an earlier commit and find that some of the package versions have changed and the old versions aren’t readily available (or at least not from the standard source as specified in the build files). I did start trying to find where the “isl” package resided, that was easy, but I couldn’t find where in the build configuration files the version number is specified. That’s what led me to simply checkout the master branch. I stopped trying to find where in the build/config files the download of the “isl” package existed. If I was able to find it I might have been able to modify it to specify the currently available version.
So, great work, I’ll continue my journey into the “BUILDROOT” phase of the process. I appreciate your patience in answering what probably seemed like “dump” questions and not following the “stackoverflow” approach of belittling the person posing the question. I will admit I do find some useful info on that site, but it is the absolutely last place I will go for answers.
Again, THANKS!
jb
From: Łukasz Tekieli @.> Sent: Tuesday, October 12, 2021 3:41 PM To: ltekieli/bazel_cross_compile @.> Cc: John Blacker @.>; Mention @.> Subject: Re: [ltekieli/bazel_cross_compile] A couple "usage" questions (#2)
Seems autoreconf is part of the autoconf package, at least on archlinux.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ltekieli/bazel_cross_compile/issues/2#issuecomment-941370243 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6WAAWG6AUZ3U5PCHRJXZTUGSFNLANCNFSM5F2T7KAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AB6WAARUZ4SGJZNUFXP6J4LUGSFNLA5CNFSM5F2T7KAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHAOCXAY.gif
Ran into another problem. Trying to do BUILDROOT make but getting an error:
Incorrect selection of kernel headers: expected 5.5.x, got 5.7.x
make[1]: *** [package/pkg-generic.mk:259: /home/jb/GitHub/buildroot/output/build/toolchain-external-custom/.stamp_configured] Error 1
make: *** [Makefile:84: _all] Error 2
When I do: “make menuconfig” I see that in kernel headers it says “5.5.x” but I get the above error anyway. Any ideas what’s wrong?
From: Łukasz Tekieli @.> Sent: Tuesday, October 12, 2021 10:53 AM To: ltekieli/bazel_cross_compile @.> Cc: John Blacker @.>; Mention @.> Subject: Re: [ltekieli/bazel_cross_compile] A couple "usage" questions (#2)
@johncblacker https://github.com/johncblacker , look into this:
The first part shows you how to create a toolchain and what is its content. The second part, shows you how to use the toolchain together with buildroot to create a functioning image and a sysroot that can be used together with your toolchain to cross compile applications in bazel. There is also an example at the end how to use both manually to cross compile a simple main.
This split gives you the possibility to use one toolchain in different products (different images, sysroots, etc.).
So yes, this approach requires to have it split, but nothing prevents you from putting them together in one archive.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ltekieli/bazel_cross_compile/issues/2#issuecomment-941087590 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6WAAXVVGRZBJ3MKBAPUB3UGRDTXANCNFSM5F2T7KAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AB6WAATEXZQNCMEUAMZUMY3UGRDTXA5CNFSM5F2T7KAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHAL5WZQ.gif
@johncblacker Regarding kernel version compatibility the rule of thumb is: in buildroot you should choose version equal or higher than the one in the toolchain. Or, you can leave it to buildroot to build a toolchain for you as well, so you don't have to care about the toolchain separately, it's your choice.
Regarding the crosstool-ng version, it was working at the time of writing the tutorial, I assume that one can adapt to whatever environment they have.
But Lukasz, what bothers me is that I specified 9.4.x in the config, yet it’s telling me it needs 9.4.x. I seem to be missing something here. Is it that the
version of g++ in the toolchain that I built isn’t version 9.4.x? Please help me understand.
From: Łukasz Tekieli @.> Sent: Thursday, October 14, 2021 11:42 AM To: ltekieli/bazel_cross_compile @.> Cc: John Blacker @.>; Mention @.> Subject: Re: [ltekieli/bazel_cross_compile] A couple "usage" questions (#2)
@johncblacker https://github.com/johncblacker Regarding kernel version compatibility the rule of thumb is: in buildroot you should choose version equal or higher than the one in the toolchain. Or, you can leave it to buildroot to build a toolchain for you as well, so you don't have to care about the toolchain separately, it's your choice.
Regarding the crosstool-ng version, it was working at the time of writing the tutorial, I assume that one can adapt to whatever environment they have.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ltekieli/bazel_cross_compile/issues/2#issuecomment-943480153 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6WAAR7NDEEWQO6U37D46TUG3225ANCNFSM5F2T7KAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AB6WAAWXBCGELDS3OMG2XI3UG3225A5CNFSM5F2T7KAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHA6F2WI.gif
Lukasz,
Here’s the output of the version check of g++ in my toolchain:
@.***:~/workspace/toolchains/armv8-rpi3-linux-gnueabihf/bin$ ./armv8-rpi3-linux-gnueabihf-g++ --version
armv8-rpi3-linux-gnueabihf-g++ (crosstool-NG 1.24.0.487_10ac846) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
You see it’s 9.4.0, so why is the build complaining about needing 9.4.x? If not in the toolchain, then where? The version of g++ on my Ubuntu 20.04 system is 9.3.0 – is that where the
problem is?
jb
From: Łukasz Tekieli @.> Sent: Tuesday, October 12, 2021 3:41 PM To: ltekieli/bazel_cross_compile @.> Cc: John Blacker @.>; Mention @.> Subject: Re: [ltekieli/bazel_cross_compile] A couple "usage" questions (#2)
Seems autoreconf is part of the autoconf package, at least on archlinux.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ltekieli/bazel_cross_compile/issues/2#issuecomment-941370243 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6WAAWG6AUZ3U5PCHRJXZTUGSFNLANCNFSM5F2T7KAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AB6WAARUZ4SGJZNUFXP6J4LUGSFNLA5CNFSM5F2T7KAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHAOCXAY.gif
Your initial problem:
Incorrect selection of kernel headers: expected 5.5.x, got 5.7.x
Is about kernel version, not gcc version.
I was finally able to complete a “make” of buldroot with my external toolchain. However, I’m in the
subject document at: “How it’s time to build an app that uses spdlog:” but for the life of me I can’t figure out
where you built the “$WORKPACE/buildroot_rpi3_64” directory. From my understanding of buildroot, that’s
where it puts the output of the build. However, in your documents (current on dated 5 AUG 2020 and 22 JUL 2020
I can’t find “buildroot_rpi3_64” anywhere else but on this compile of “example.cpp” so if I missed something
that was done earlier, please let me know as my compile is failing. Here’s the output.
@.***:~/GitHub/buildroot$ $WORKSPACE/toolchains/armv8-rpi3-linux-gnueabihf/bin/armv8-rpi3-linux-gnueabihf-g++ --sysroot=~/GitHub/buildroot/output/staging -DSPDLOG_FMT_EXTERNAL -lfmt -lpthread -o example example.cpp
In file included from /home/jb/workspace/toolchains/armv8-rpi3-linux-gnueabihf/armv8-rpi3-linux-gnueabihf/include/c++/11.2.0/armv8-rpi3-linux-gnueabihf/bits/c++config.h:586,
from /home/jb/workspace/toolchains/armv8-rpi3-linux-gnueabihf/armv8-rpi3-linux-gnueabihf/include/c++/11.2.0/cstdio:41,
from example.cpp:7:
/home/jb/workspace/toolchains/armv8-rpi3-linux-gnueabihf/armv8-rpi3-linux-gnueabihf/include/c++/11.2.0/armv8-rpi3-linux-gnueabihf/bits/os_defines.h:39:10: fatal error: features.h: No such file or directory
39 | #include
| ^~~~~~~~~~~~
compilation terminated.
I’ve found “features.h” in ….output/staging/usr/include but just using ……output/staging as –sysroot doesn’t seem to be
able to find that file.
Thanks
John
@johncblacker buildroot has this option to specify the output build directory:
make O=buildroot_rpi3_64 raspberrypi3_64_defconfig
make
@johncblacker I will close this issue, feel free to open new one, if you still have questions.
There are 4 files in your "toolchain" repo...are they each a separate toolchain or are they paired: meaning that aarch64-buildroot-linux-gnu-sysroot.tar.gz and aarch64-rpi3-linux.gnu.tar.gz together form a single toolchain (which appears to me to be the case) and arm-buildroot-linux-gnueabihf-sysroot.tar.gz and arm-cortex-a8-linux-gnueabihf.tar.gz also together form another toolchain for the bbb (which I'm guessing is the beagle-bone board)?
Now, if I'm to put in my own toolchain, as you suggest using crosstool-ng (RPi-Cpp-Toolchain), in this case there is a single file (or directory if you wish) so how would one integrate that into your approach?
Thank you for your great tutorial, but I'm still left with these questions.