fix missing gnu-elf.ld cp when generating export#16976
Conversation
|
@trns1997 @acassis Thanks for your detailed analysis!
On current architectures, I have 2 suggestions for fixing this issue:
I prefer option 2 : ) . If you agree with either solution, please update the current PR. |
|
@anchao i prefere option 2 as well but doesn't this already do the trick: But maybe for clarity sake its better to check for the |
|
When running: with set -e enabled, the build stops with: Verbose output shows the actual failure: it’s because the startup/ directory inside the export tree is never created, and the script exits when it tries to copy crt0.o there. This looks to be the same root cause seen here in #16970 (comment) . Hopefully solving this will resolve both problems :) |
|
What about adding a CI test linking a C++ helloworld with CMake to avoid regression in the future? (At least from a compile POV). |
Totally agree, lets fix up all this get it functional, update the doc and then lets add a basic out of tree build test |
|
@leducp was right in comment: #16970 (comment). This commit is caused the issue. The commit moved/centralized |
@xiaoxiang781216 could we get your input on this? |
|
@anjiahao1 please take a look. |
This wasn’t the actual root cause. The real issue was the use of |
|
Good work! |
7531c21 to
4fcd0d7
Compare
Fix missing `gnu-elf.ld` file copy during export generation and update `toolchain.cmake` script to ensure proper toolchain detection and configuration. * Prevents build failures when exporting projects. * Improves reproducibility of generated exports. Signed-off-by: trns1997 <trns1997@gmail.com>
976d3c0 to
648919c
Compare


Note: Please adhere to Contributing Guidelines.
Closes #16973
Summary
make exportcurrently fails with the warning:This happens because the file
gnu-elf.ldwas removed and replaced withgnu-elf.ld.in. The realgnu-elf.ldis now only generated whenCONFIG_LIBC_MODLIB=y(via modlib).However,
tools/mkexport.shstill assumes thatgnu-elf.ldalways exists and tries to copy it unconditionally, leading to the error.Impact
CONFIG_LIBC_MODLIB=y(the generated gnu-elf.ld is still copied).No impact on runtime behavior, build outputs, or compatibility.
Testing
Host: Ubuntu 22.04, gcc 11.4.0.
Target: stm32f4discovery:nsh.
Export no error with
CONFIG_LIBC_MODLIB=nExport no error with
CONFIG_LIBC_MODLIB=y