pico_add_extra_outputs( ) puts map file in wrong directory for add_subdirectory( ) projects #1753
Labels
No labels
bazel
bluetooth
board settings
boot_stage2
bug
build
c++
can't reproduce
clang
clib-interface
cmsis
code cleanliness
code size
compiler version issues
cyw43_driver
debug
discussion
documentation
duplicate
dynamic_clock
elf2uf2
enhancement
errata
filesystem
flash layout
floating point
FreeRTOS
hardware_adc
hardware_claim
hardware_clocks
hardware_dma
hardware_exception
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_rcp
hardware_rtc
hardware_spi
hardware_sync
hardware_uart
hardware_vreg
hardware_watchdog
hardware_xosc
help wanted
host
IAR
installation
invalid
linker scripts
lto
lwip
mbedtls
missing API
needs reporter detail
networking
newlib
newlib-multicore
non-c
non-cmake
non-gcc
openocd
orphan PR
OS integration
pico_async_context
pico_base
pico_binary_info
pico_flash
picolibc
pico_lwip
pico_malloc
pico_multicore
pico_printf
pico_runtime
pico_stdio
pico_stdio_usb
pico_sync
pico_time
pico_util
pioasm
port
question
review
review2
rtos interop
runtime init
static library
svd
test
tinyusb
vscode
wifi integration
wontfix
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk#1753
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I am using Visual Studio with VisualGDB to make a complex project and my Cmakelists.txt was getting a bit out of hand. I then created a sub folder to split my project into pieces. I found that the .map file for my executable that was in the subfolder was found in the directory above where the other extra output files were.
I have recreated the issue by simply using the "Hello Serial" example, then adding another copy of "Hello Serial" called "Hello2 Serial".
The contents of my top level Cmakelists.txt is as so.
The subdirectory Hello2 contains an almost identical Cmakelists.txt with hello_serial replaced with Hello2_serial everywhere,... The outputs I get are as follows:
Does it do that when you build from the command line? It doesn't on Linux at least.
There is the added complication that the build tools are "Sysprogs" specific versions of CMake and Ninja, running on a Windows 10 Machine, however when I build manually using the same tools in a Command prompt the map file still ended up in the wrong place. I wouldn't have thought that the Build tools would affect things, but maybe the difference is between Linux and Windows.
I can post any debug/output logs if required, but I thought the example I gave was straightforward enough - can you try building on a Windows platform?
When I build on Windows using ninja I don't seem to get map files. Odd.
I tell a lie - they ALL go to the root of the build folder.
A quick look at the cmake and it doesn't look like pico_add_extra_outputs has anything to do with map files.
The map files seem to be added at https://github.com/raspberrypi/pico-sdk/blob/develop/src/CMakeLists.txt#L59 ?
Ahhh, looks like this might be related to https://github.com/raspberrypi/pico-sdk/pull/432#issuecomment-846449239 ?
I am not by any stretch of the imagination familiar with Cmakelists, Cmake or Ninja but I did come to the same conclusion as @lurch that it's dealt with seperately from the other additional output files - and I also think it's related to Line 59 in the CMakelists.txt file
I just don't have the knowledge to be able to figure out what might be a potential fix, so for now I will live with the file being in the "wrong" place. Thanks for looking.
This is due to the
.mapfile being added by a linker script argument, so it is generated when compiling/linking, which on Ninja (and probably other generators too) is done from the rootbuilddirectory before changing into the subdirectory for thePOST_BUILDcommands which generate the other output files. When using Makefiles, the compiling/linking is done from the subdirectory already, so the.mapfile appears in the correct place.I think the simple fix would be a CMake script that checks for the
.mapfile in the rootbuilddirectory, and if present moves it into the subdirectory. I will have a look at doing that - note that this will have similar limitations around generator expressions as #2504@smithps Would you like to test the fix in #2584 please?
Fix has been merged into
develop