View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014414CMakeCMakepublic2013-09-16 03:152016-06-10 14:31
ReporterDamian Kaczmarek 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformLinuxOSopenSUSEOS Version12.3
Product VersionCMake 2.8.11.2 
Target VersionFixed in Version 
Summary0014414: Ninja: Running compiler from build dir makes it being run from bad relative directory
DescriptionDuring my build setup I am creating "build/bin/ccache-arm-none-eabi-gcc"
My toolchain setup sets this binary:
set(CMAKE_C_COMPILER "${CCACHE_GCC_BINARY}" CACHE FORCE "")

Everything is fine when using "make", however when using "ninja" the following problem arose:
[6/1347] Building ASM object Project/CMakeFiles/Project_startup.dir/startup.s.obj
FAILED: ../bin/ccache-arm-none-eabi-gcc ... rest of command ...
/bin/sh: ../bin/ccache-arm-none-eabi-gcc: No such file or directory

I may try to provide a small test project setup if requested.
TagsNo tags attached.
Attached Files

 Relationships
related to 0015216closedKitware Robot Ninja makes bad phony targets with parallel "sub" directory and custom CMAKE_LIBRARY_OUTPUT_DIRECTORY 

  Notes
(0034110)
Peter Kuemmel (developer)
2013-10-12 11:02

Setting CMAKE_C_COMPILER by hand is very hairy. Try to set it before you call "project()" for the first time.
(0034114)
Damian Kaczmarek (reporter)
2013-10-13 11:11

I am setting it with a toolchain configuration in CMAKE_TOOLCHAIN_FILE. It has always been valid.
(0035681)
Peter Kuemmel (developer)
2014-04-13 04:57

I assume it works when you use an absolute path for CCACHE_GCC_BINARY.
(0037037)
Henry Miller (reporter)
2014-10-16 14:56

I have confirmed this with 2.8.12-2.

Even when I set an absolute path in my toolchain file, ninja is still using a relative path to the compiler, which breaks the build since the path is relative to the top of the build directory, not the subdirectory the build itself is run in.
(0037038)
Henry Miller (reporter)
2014-10-16 16:53

Problem still exists with cmake 3.0.2.
(0037039)
Peter Kuemmel (developer)
2014-10-17 05:10

Could you please have a look at the Makefile and check if absolute paths are used?
(0037041)
Henry Miller (reporter)
2014-10-17 09:52

The Makefile uses relative paths, even when a absolute path is given in the toolchain file.
(0037042)
Henry Miller (reporter)
2014-10-17 10:37

Manually editing the generated rules.ninja file I was able to get a build, in all cases I change the relative to path to start with one .. instead of more than one.

rule CXX_COMPILER
   - remove one .. from the path
rule CXX_SHARED_LIBRARY_LINKER
   - remove one .. from the path
rule CXX_EXECUTABLE_LINKER
   - remove two .. (../..) from the path
rule CXX_MODULE_LIBRARY_LINKER
   - remove four .. (../../../..) from the path

I was able to complete my build without editing, but I suspect this is only because my build doesn't happen to use them - they all look wrong.
rule CXX_SHARED_LIBRARY_LINKER_RSP_FILE
rule CXX_EXECUTABLE_LINKER_RSP_FILE
rule CXX_STATIC_LIBRARY_LINKER
rule CXX_STATIC_LIBRARY_LINKER_RSP_FILE
rule CXX_MODULE_LIBRARY_LINKER_RSP_FILE

note, for the above my build tree looks like
   <source_root>/cross_build/<architecture>/toolchain_root
   <source_root>/cross_build/<architecture>/sysroot
   <source_root>/cross_build/<architecture>/buildDirectory
which is to say from my build directory the path to the compiler is ../toolchain_root/path/to/compiler
(0037045)
Peter Kuemmel (developer)
2014-10-18 08:05

I only see absolute paths in my rules.ninja.
Your compiler is within the source directory. Maybe this is the problem, or that the compiler is "created" at configure/build time.
Does it work with such a tree:
<source_root>
<cross_build>?
(0037056)
Henry Miller (reporter)
2014-10-20 09:41

If I move my compiler outside of my source tree everything works.

Unfortunately my CI system is setup to clone to the root of the only writable directory and then run build scripts from that clone. (the same CI setup is used for many unrelated projects) Since the only place I can write is the build directory I have to install my compiler there.
(0042365)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2013-09-16 03:15 Damian Kaczmarek New Issue
2013-10-12 11:02 Peter Kuemmel Note Added: 0034110
2013-10-13 11:11 Damian Kaczmarek Note Added: 0034114
2014-04-13 04:57 Peter Kuemmel Note Added: 0035681
2014-04-13 05:27 Peter Kuemmel Severity block => minor
2014-10-16 14:56 Henry Miller Note Added: 0037037
2014-10-16 16:53 Henry Miller Note Added: 0037038
2014-10-17 05:10 Peter Kuemmel Note Added: 0037039
2014-10-17 09:52 Henry Miller Note Added: 0037041
2014-10-17 10:37 Henry Miller Note Added: 0037042
2014-10-18 08:05 Peter Kuemmel Note Added: 0037045
2014-10-20 09:41 Henry Miller Note Added: 0037056
2014-10-22 10:24 Brad King Relationship added related to 0015216
2016-06-10 14:29 Kitware Robot Note Added: 0042365
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team