Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking issues between Linux and Windows built binaries #26

Open
develteau opened this issue Nov 21, 2019 · 5 comments
Open

Linking issues between Linux and Windows built binaries #26

develteau opened this issue Nov 21, 2019 · 5 comments

Comments

@develteau
Copy link

We have in our project stumbled on an linking issue when trying to link an locally (Windows) compiled arm target application with an library built on a CI server (linux). The linker error is:
lto1.exe: fatal error: LTO_tags out of range: Range is 0 to 420, value is 0

The linux server compiles the library using the toolchain built with the build-bleeding-edge-toolchain.sh script. On Windows we use the readily available binaries for the bleeding edge gcc.

This issue seems to only persist when the library and the application are compiled on separate machines. Building both the library and the application on the server works without any error. Same on Windows. Presumably this problem is somehow related to the gcc toolchain. Perhaps it might even be some sort of bug in the toolchain..

We spent some time trying to compile the Windows gcc version with the build-bleeding-edge-toolchain.sh script (in mingw64) but there seemed to be quite a lot of issues with the toolchain dependencies. Also trying to cross compile the bleeding edge gcc on MacOS for Windows seemed problematic.

Any suggestions for how to tackle this issue?
Our aim was to compile the bleeding edge gcc with some minor modifications to try and poke at the linking issue.

@Trass3r
Copy link

Trass3r commented Nov 21, 2019

Make sure it's the very same gcc revision for lto to work.
On Windows I suggest using WSL to build gcc.
Also I'm playing around with Github CI. You may try one of those builds: https://github.com/Trass3r/bleeding-edge-toolchain/actions
Or set it up in your fork: https://github.com/Trass3r/bleeding-edge-toolchain/blob/master/.github/workflows/CI.yml

@develteau
Copy link
Author

Make sure it's the very same gcc revision for lto to work.
On Windows I suggest using WSL to build gcc.
Also I'm playing around with Github CI. You may try one of those builds: https://github.com/Trass3r/bleeding-edge-toolchain/actions
Or set it up in your fork: https://github.com/Trass3r/bleeding-edge-toolchain/blob/master/.github/workflows/CI.yml

Thanks! That was quick :)

Good point, the Windows binaries we had appear to be few months old. I will check out your builds first.

@Trass3r
Copy link

Trass3r commented Nov 22, 2019

Note that I will rebase and squash all those test commits once I'm done.
Here's the last build that produced output: https://github.com/Trass3r/bleeding-edge-toolchain/runs/315655966

@develteau
Copy link
Author

Note that I will rebase and squash all those test commits once I'm done.
Here's the last build that produced output: https://github.com/Trass3r/bleeding-edge-toolchain/runs/315655966

Thanks. Last week I did grab the binaries from your earlier successful builds for testing with our codebase. Only then I noticed that you're using the gcc tip/master which currently appears to be version 10.0.0. I think officially we need to be using the 9.2.0 version since we're also making releases of our software. I forked from your master branch to try and switch to v 9.2.0 but I haven't yet had time to figure out what needs to be done for the github CI settings in order to successfully build the artifacts. Appears that some action settings are required for my account.

I did try using the 10.0.0 version in our builds but that yielded a different problem when compiling the app against the library. It says that a struct in Nordic's nRF5_SDK violates the C++ One Definition Rule. At quick glance there seems to be no redefinition. That problem does not exist for 9.2.0.

@Trass3r
Copy link

Trass3r commented Nov 26, 2019

You need to activate the actions first but then it should build.

you're using the gcc tip/master

Yes arm-gcc 8 and 9 had a few issues with objdump and LTO with debug info. Just change the versions at the top of the script from master to a release branch or tag.
Btw please refork, it's all rebased now.

If there's a bug please open a ticket in my repo or directly at the official bug tracker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants