libelektra icon indicating copy to clipboard operation
libelektra copied to clipboard

cross compile Rust

Open markus2330 opened this issue 4 years ago • 10 comments

It seems like the cross compilation of the Rust binding caused problems in OpenWRT:

https://github.com/openwrt/packages/commit/49ed96f309f9abfefa46890f5d44b771af1f2708

@haraldg Do you happen to know a link to the build log?

@PhilippGackstatter Do you want to take a look at this?

markus2330 avatar Jun 28 '21 14:06 markus2330

@haraldg Do you happen to know a link to the build log?

Sorry, I don't.

haraldg avatar Jun 28 '21 21:06 haraldg

I can take a look, though I am not sure where to begin. A build log would certainly help. Also, I don't know how quickly I'll be able to work on it.

PhilippGackstatter avatar Jun 29 '21 21:06 PhilippGackstatter

Thank you for looking into it! :sparkling_heart:

I think the best way to find the problem is to actually cross-compile. You can use either openwrt (and enable the rust bindings) or also CMake's cross compile functionality (probably easier if your distribution has a cross-compiling toolchain but might not trigger the problem).

markus2330 avatar Jun 30 '21 04:06 markus2330

Any particular target that fails when cross-compiling? And any particular package? I've never worked with openwrt before. Do I have to start by compiling https://github.com/openwrt/openwrt?

PhilippGackstatter avatar Jul 01 '21 15:07 PhilippGackstatter

You don't need to compile openwrt yourself. You can install the precompiled openwrt sdk for any of the targets. Ie for mxs: https://downloads.openwrt.org/releases/19.07.7/targets/mxs/generic/openwrt-sdk-19.07.7-mxs_gcc-7.5.0_musl_eabi.Linux-x86_64.tar.xz https://downloads.openwrt.org/releases/21.02.0-rc3/targets/mxs/generic/openwrt-sdk-21.02.0-rc3-mxs_gcc-8.4.0_musl_eabi.Linux-x86_64.tar.xz

haraldg avatar Jul 01 '21 17:07 haraldg

I've tried to look into it, and I'm not sure I understand what the actual problem is. It seems none of the packages in openwrt/packages actually use Rust (according to GitHub's language statistics). So is the problem that the Rust bindings fail to compile when compiling elektra, even though they aren't needed? In that case, it seems the cited commit 49ed96f fixed that by disabling cargo, right?

Otherwise, I've downloaded the sdk and tried installing packages, following the instructions from here. However after executing

./scripts/feeds update -a
./scripts/feeds install -a
make

I got a lot of WARNING: Makefile 'package/kernel/linux/Makefile' has a dependency on 'eip197-mini-firmware', which does not exist warnings with different firmware names, and I'm not sure if I should fix those or what to do in that case.

The make process ends with

make[2]: *** [package/Makefile:86: package/index] Error 1
make[2]: Leaving directory '/openwrtsdk/openwrt-sdk-21.02.0-rc3-mxs_gcc-8.4.0_musl_eabi.Linux-x86_64'
make[1]: *** [Makefile:56: world] Error 2
make[1]: Leaving directory '/openwrtsdk/openwrt-sdk-21.02.0-rc3-mxs_gcc-8.4.0_musl_eabi.Linux-x86_64'
make: *** [/openwrtsdk/openwrt-sdk-21.02.0-rc3-mxs_gcc-8.4.0_musl_eabi.Linux-x86_64/include/toplevel.mk:223: world] Error 2

which isn't all that helpful, unfortunately. So, I'm not sure I'm of big help here... :confused:

PhilippGackstatter avatar Jul 11 '21 16:07 PhilippGackstatter

Yes, you are right in that there is no actual problem as nobody actually needs the rust bindings on OpenWRT. Probably ATM nobody is using elektra with OpenWRT at all.

The idea is more that compiling elektra with a cross compile for a non-libc target tends to unearth many subtle standard violations and such. Each time we disable a feature, because there is some issue, it reduces this build coverage. (Aside from covering up the original issue of course.)

The warnings you are seeing are pretty usual. I guess that's about some non-free firmware not available. You can ignore those.

The actual error should be just above the lines you quoted from your build log. Maybe you find the following invocation helpful: make -j1 V=s package/elektra/compile

This

  • forces a single build process, so that errors always end up at the end of the build log
  • enables verbose logging
  • only builds the elektra package (and its dependencies if necessary) to speed things up a bit.

haraldg avatar Jul 11 '21 17:07 haraldg

I mark this issue stale as it did not have any activity for one year. I'll close it in two weeks if no further activity occurs. If you want it to be alive again, ping the issue by writing a message here or create a new issue with the remainder of this issue. Thank you for your contributions :sparkling_heart:

stale[bot] avatar Jul 12 '22 04:07 stale[bot]

I closed this issue now because it has been inactive for more than one year. If I closed it by mistake, please do not hesitate to reopen it or create a new issue with the remainder of this issue. Thank you for your contributions :sparkling_heart:

stale[bot] avatar Jul 31 '22 11:07 stale[bot]

A few lines how to do the cross-compilation manually (without OpenWRT) would be useful here. (To be added in the docu.)

markus2330 avatar Aug 01 '22 09:08 markus2330

I mark this stale as it did not have any activity for one year. I'll close it in two weeks if no further activity occurs. If you want it to be alive again, ping by writing a message here or create a new issue with the remainder of this issue. Thank you for your contributions :sparkling_heart:

github-actions[bot] avatar Dec 31 '23 01:12 github-actions[bot]

I closed this now because it has been inactive for more than one year. If I closed it by mistake, please do not hesitate to reopen it or create a new issue with the remainder of this issue. Thank you for your contributions :sparkling_heart:

github-actions[bot] avatar Jan 14 '24 01:01 github-actions[bot]