Build error when project path contains symbolic link
See original GitHub issueBrief Issue Summary
If project path contains a symbolic link, the project will build error when using CMake Tools to configure the project. If I use cmake in terminal, everything works well.
Expected:
- Create cmake project at:
/path/to/project
- Create symbolic link with
ln -s /path/to/project /path/to/symbolic_link
- VSCode open directory:
/path/to/symbolic_link
- Use Cmake Tools to configure and build project
- Build successful
Apparent Behavior:
- Create cmake project at:
/path/to/project
- Create symbolic link with
ln -s /path/to/project /path/to/symbolic_link
- VSCode open directory:
/path/to/symbolic_link
- Use Cmake Tools to configure and build project
- Build error
[build] make[1]: *** No rule to make target '/path/to/symbolic_link/build/all'. Stop.
[build] make: *** [Makefile:84: all] Error 2
[build] Build finished with exit code 2
- Open terminal, cd to
/path/to/symbolic_link/build
, runcmake .. && make
, everything works well.
CMake Tools Log
[cmake] The C compiler identification is GNU 7.3.1
[cmake] The CXX compiler identification is GNU 7.3.1
[cmake] Check for working C compiler: /bin/gcc
[cmake] Check for working C compiler: /bin/gcc -- works
[cmake] Detecting C compiler ABI info
[cmake] Detecting C compiler ABI info - done
[cmake] Detecting C compile features
[cmake] Detecting C compile features - done
[cmake] Check for working CXX compiler: /bin/g++
[cmake] Check for working CXX compiler: /bin/g++ -- works
[cmake] Detecting CXX compiler ABI info
[cmake] Detecting CXX compiler ABI info - done
[cmake] Detecting CXX compile features
[cmake] Detecting CXX compile features - done
[cmake] Looking for pthread.h
[cmake] Looking for pthread.h - found
[cmake] Looking for pthread_create
[cmake] Looking for pthread_create - not found
[cmake] Check if compiler accepts -pthread
[cmake] Check if compiler accepts -pthread - yes
[cmake] Found Threads: TRUE
[cmake] Configuring done
[cmake] Generating done
Build:
[build] Starting build
[proc] Executing command: /usr/bin/cmake --build /path/to/project/build --config Debug --target all -- -j 6
[build] make[1]: *** No rule to make target '/path/to/symbolic_link/build/all'. Stop.
[build] make: *** [Makefile:84: all] Error 2
[build] Build finished with exit code 2
Developer Tools Log
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:55.254Z [debug] [extension] [7000] cmake.setVariant started
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:56.757Z [debug] [main] Active build variant changed
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:56.758Z [debug] [driver] Setting new variant , Emit debug information without performing optimizations
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:56.759Z [debug] [driver] Runnnig pre-configure checks and steps
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:56.760Z [debug] [driver] Saving open files before configure/build
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:56.776Z [debug] [driver] Using compilerKit GCC 7.3.1 for usage
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:56.831Z [info] [cmake] The C compiler identification is GNU 7.3.1
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:56.901Z [info] [cmake] The CXX compiler identification is GNU 7.3.1
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:56.904Z [info] [cmake] Check for working C compiler: /bin/gcc
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:56.978Z [info] [cmake] Check for working C compiler: /bin/gcc -- works
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:56.979Z [info] [cmake] Detecting C compiler ABI info
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:57.053Z [info] [cmake] Detecting C compiler ABI info - done
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:57.059Z [info] [cmake] Detecting C compile features
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:57.280Z [info] [cmake] Detecting C compile features - done
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:57.282Z [info] [cmake] Check for working CXX compiler: /bin/g++
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:57.377Z [info] [cmake] Check for working CXX compiler: /bin/g++ -- works
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:57.378Z [info] [cmake] Detecting CXX compiler ABI info
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:57.484Z [info] [cmake] Detecting CXX compiler ABI info - done
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:57.489Z [info] [cmake] Detecting CXX compile features
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:57.941Z [info] [cmake] Detecting CXX compile features - done
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:57.943Z [info] [cmake] Looking for pthread.h
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:58.015Z [info] [cmake] Looking for pthread.h - found
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:58.015Z [info] [cmake] Looking for pthread_create
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:58.089Z [info] [cmake] Looking for pthread_create - not found
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:58.089Z [info] [cmake] Check if compiler accepts -pthread
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:58.173Z [info] [cmake] Check if compiler accepts -pthread - yes
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:58.175Z [info] [cmake] Found Threads: TRUE
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:58.175Z [info] [cmake] Configuring done
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:58.182Z [info] [cmake] Generating done
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:34:58.186Z [debug] [extension] [7000] cmake.setVariant finished (returned true)
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:35:01.750Z [debug] [extension] [1574] cmake.build started
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:35:01.751Z [info] [build] Starting build
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:35:01.752Z [debug] [driver] Runnnig pre-configure checks and steps
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:35:01.753Z [debug] [driver] Saving open files before configure/build
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:35:01.779Z [info] [proc] Executing command: /usr/bin/cmake --build /path/to/project/build --config Debug --target all -- -j 6
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:35:01.815Z [error] [build] make[1]: *** No rule to make target '/path/to/symbolic_link/build/all'. Stop.
t.log @ workbench.main.js:sourcemap:260
t._logExtensionHostMessage @ workbench.main.js:sourcemap:2779
(anonymous) @ workbench.main.js:sourcemap:2775
emitTwo @ events.js:106
emit @ events.js:194
process.nextTick @ internal/child_process.js:766
_combinedTickCallback @ internal/process/next_tick.js:73
_tickCallback @ internal/process/next_tick.js:104
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:35:01.815Z [error] [build] make: *** [Makefile:84: all] Error 2
t.log @ workbench.main.js:sourcemap:260
t._logExtensionHostMessage @ workbench.main.js:sourcemap:2779
(anonymous) @ workbench.main.js:sourcemap:2775
emitTwo @ events.js:106
emit @ events.js:194
process.nextTick @ internal/child_process.js:766
_combinedTickCallback @ internal/process/next_tick.js:73
_tickCallback @ internal/process/next_tick.js:104
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:35:01.821Z [info] [build] Build finished with exit code 2
workbench.main.js:sourcemap:260 [Extension Host] [CMakeTools] 2018-04-17T12:35:01.821Z [debug] [extension] [1574] cmake.build finished (returned 2)
Platform and Versions
- Operating System: ArchLinux
- CMake Version: 3.10.3
- VSCode Version: 1.22.2
- CMake Tools Extension Version: 0.11.0
- Compiler/Toolchain: GCC 7.3.1
Other Notes/Information
I notice CMake Tools modify “Makefile” generated by CMake to add some “cd /absolube_path/”, but I think sometimes CMake Tools add wrong absolube_path when project path contains symbolic link.
When I open project from /path/to/symbolic_link
, CMake Tools should add cd /path/to/symbolic_link/build
instead of /path/to/project/build
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Build fails if the paths contain symlinks : IDEA-202775
I tried to rebuild the project in 2018.02 and it still works. So this looks like a regression. Problem: If there is a...
Read more >Xcode build fails if build directory involves a symbolic link
In some cases a Xcode project created via cmake does not compile properly if the build directory involves a symbolic link.
Read more >VS project does not load when a symbolic link is in the ...
- Visual Studio will show "load failed" on a project when a symbolic link is present in it's Solution Explorer. I excluded the...
Read more >Fortran: Ninja fails when build tree path has a symlink - GitLab
I am building a project (ParaView) on Linux in a build named build folder which happens to be a symbolic link pointing to...
Read more >Solving the “Too many levels of symbolic links” Error - Baeldung
The reason for this error is that symbolic links with relative sources are always relative to the symlink directory, not the directory from ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is fixed in the next version.
ok, in that case PR #398 should work.