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

Potential issue with CMAKE_OBJECT_PATH_MAX #36358

Open
alexsven opened this issue Jun 17, 2021 · 12 comments
Open

Potential issue with CMAKE_OBJECT_PATH_MAX #36358

alexsven opened this issue Jun 17, 2021 · 12 comments
Assignees
Labels
area: Build System Enhancement Changes/Updates/Additions to existing features known issue Known issue priority: low Low impact/importance bug

Comments

@alexsven
Copy link
Collaborator

Since nrf5340_cpunet_reset.c is located in the boards folder (zephyr/boards/arm/nrf5340dk_nrf5340), the path for linking it in might quickly be too long, depending on where the project is stored on the local machine.

One easy fix is to make sure to place the project as close to root as possible, but this might not be an option for all users.

@alexsven alexsven added the bug The issue is a bug, or the PR is fixing a bug label Jun 17, 2021
@tejlmand
Copy link
Collaborator

Just a note: CMAKE_OBJECT_PATH_MAX has to do with the full path, it doesn't help regarding library names that are too long.

When using zephyr_library() without a name, then the lib name is constructed based on it's location:

macro(zephyr_library)
zephyr_library_get_current_dir_lib_name(${ZEPHYR_BASE} lib_name)
zephyr_library_named(${lib_name})
endmacro()
# Determines what the current directory's lib name would be according to the
# provided base and writes it to the argument "lib_name"
macro(zephyr_library_get_current_dir_lib_name base lib_name)
# Remove the prefix (/home/sebo/zephyr/driver/serial/CMakeLists.txt => driver/serial/CMakeLists.txt)
file(RELATIVE_PATH name ${base} ${CMAKE_CURRENT_LIST_FILE})
# Remove the filename (driver/serial/CMakeLists.txt => driver/serial)
get_filename_component(name ${name} DIRECTORY)
# Replace / with __ (driver/serial => driver__serial)
string(REGEX REPLACE "/" "__" name ${name})
set(${lib_name} ${name})
endmacro()

So best solution in this case would be to slowly deprecate zephyr_library() and instead use zephyr_library_named() (or even start a transistion towards plain CMake, see #8827 )

@nashif nashif added the priority: low Low impact/importance bug label Jun 22, 2021
@github-actions
Copy link

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label Aug 22, 2021
@koffes
Copy link
Collaborator

koffes commented Aug 23, 2021

This issue is still valid.

@github-actions github-actions bot removed the Stale label Aug 24, 2021
@carlescufi carlescufi added the known issue Known issue label Oct 6, 2021
@github-actions
Copy link

github-actions bot commented Dec 6, 2021

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label Dec 6, 2021
@alexsven alexsven removed the Stale label Dec 6, 2021
@github-actions
Copy link

github-actions bot commented Feb 5, 2022

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label Feb 5, 2022
@tejlmand tejlmand removed the Stale label Feb 8, 2022
@github-actions
Copy link

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label Apr 10, 2022
@alexsven alexsven removed the Stale label Apr 11, 2022
@github-actions
Copy link

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@tejlmand
Copy link
Collaborator

still valid, but we cannot change CMake.
What we can do is to raise awareness, for example by printing a warning together with information about using zephyr_library_named() instead if lib name becomes too long.

This is more an enhancement than a bug.
Bugs should be filed for specific libraries or a list of libraries that causes this to happen, else it is hard to know exactly what to fix.

@tejlmand tejlmand reopened this Jun 29, 2022
@tejlmand tejlmand added Enhancement Changes/Updates/Additions to existing features and removed bug The issue is a bug, or the PR is fixing a bug Stale labels Jun 29, 2022
@nordicjm
Copy link
Collaborator

nordicjm commented Sep 2, 2022

I asked on the cmake discussion forum and this should not be an issue, see https://discourse.cmake.org/t/object-file-names-use-absolute-path-to-sources-outside-source-tree/6383/6 and corresponding code at https://gitlab.kitware.com/cmake/cmake/-/blob/v3.24.1/Source/cmLocalGenerator.cxx#L3516-3560 which was last updated 7 months ago so should be in cmake version 3.23 onwards

@mithunpandey
Copy link

mithunpandey commented Dec 20, 2023

We are also facing the same issue
we are using twister to run test on out our HW
python zephyr/scripts/twister --device-testing --device-serial COM5 -p nucleo_h743zi -T app-to-build/examples
we are using GitHub, and a self hosted windows runner
And the cmake is getting failed with

CMake Warning in C:/actions-runner/_work/edge-rtos-github-workflows/edge-rtos-github-workflows/zephyr/arch/arm/core/aarch32/cortex_m/CMakeLists.txt:
The object file directory

C:/actions-runner/_work/edge-rtos-github-workflows/edge-rtos-github-workflows/twister-out/nucleo_h743zi/drivers/SPI/Async_SPI/examples.drivers.SPI.Async_SPI/zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/./

has 252 characters. The maximum full path to an object file is 250
characters (see CMAKE_OBJECT_PATH_MAX). Object file

fault.c.obj

cannot be safely placed under this directory. The build may not work
correctly.

@JPHutchins
Copy link
Contributor

This issue is quite prevalent when running twister from Windows.

@PerMac
Copy link
Member

PerMac commented Oct 3, 2024

We resolved the issue in twister on windows by using --no-detailed-test-id and --short-build-path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System Enhancement Changes/Updates/Additions to existing features known issue Known issue priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

9 participants