-
Notifications
You must be signed in to change notification settings - Fork 73
Description
Brief Issue Summary
This issue is closely related to #263 (or may be identical). That issue was closed prematurely - there are still problems building with vscode-makefile under Cygwin.
ms-vscode.makefile-tools version: 0.12.17
VSCode version: 1.101.0 (2025-06-11)
Goals: build a C/C++ project under Cygwin using the makefile-tools extension, and have correct choices for the build-configuration option.
Description:
Upon first start of makefile-tools, the default makePath setting (make) does not populate the build targets choices. In other words, the only build target option is all - there should all options such as debug, release, install, etc. based on the targets provided in the makefile.
If you configure makePath to point to the Cygwin64 make program (e.g. C:\cygwin64\bin\make.exe), the build target options are populated after the 'dry-run' or 'configure' step. However, the build button then fails to build. The error is:
* Executing task: 'C:\cygwin64\bin\make.exe' 'debug' '-f' 'c:\Users\path\to\Makefile' '-j4'
bash: C:\cygwin64\bin\make.exe: command not found
* The terminal process "C:\cygwin64\bin\bash.exe '--login', '-i', '-c', ''C:\cygwin64\bin\make.exe' 'debug' '-f' 'c:\Users\path\to\Makefile' '-j4''" terminated with exit code: 127.
* Terminal will be reused by tasks, press any key to close it.
This seems to be an issue caused by selecting Cygwin's Bash as the default terminal:
"terminal.integrated.defaultProfile.windows": "Cygwin64",
"terminal.integrated.profiles.windows": {
"Cygwin64": {
"path": "C:\\cygwin64\\bin\\bash.exe",
"args": [ "--login", "-i" ],
"env": {"CHERE_INVOKING": "1" },
}, ...
}
Attempting to set makePath to /usr/bin/make (the Linux-like path to make) yields a similar error:
* Executing task: '\usr\bin\make' 'debug' '-f' 'c:\Users\e438179\git\star\Makefile' '-j4'
bash: \usr\bin\make: command not found
* The terminal process "C:\cygwin64\bin\bash.exe '--login', '-i', '-c', ''\usr\bin\make' 'debug' '-f' 'c:\Users\path\to\Makefile' '-j4''" terminated with exit code: 127.
* Terminal will be reused by tasks, press any key to close it.
Note the direction of the slashes! Either the extension or VSCode changes /usr/bin/make to \usr\bin\make.
The relevant settings.json config:
"makefile.configurations": [
{
"makeArgs": [
"-j4"
],
"name": "parallel make",
"makefile.makePath": "/usr/bin/make", // slashes are reversed
// "makePath": "/cygdrive/c/cygwin64/bin/make.exe", // also fails due to slashes
// "makePath": "C:\\cygwin64\\bin\\make.exe", // works for configure; not build.
// "makePath": "make" // works for build; not configure
}
After setting makePath with the C:\\cygwin... version, the build targets will populate and can be selected at will. However, the build will not complete due to the above-mentioned error. The makePath setting must be changed back to make (no path given) before the build will run successfully. This would be a valid workaround, but the build-target option resets after VSCode is restarted.
It seems that the Cygwin environment/terminal config is not being activated before the configure stage in the same way it is activated for the build stage.
Maybe there should be a settings.json override for buildTarget.
Debug Log
targets.log output (excerpt):
C:\cygwin64\bin\make.exe all -f c:\Users\user\git\star\Makefile -j4 --print-data-base --no-builtin-variables --no-builtin-rules --question
./mkversion.sh: line 21: perl: command not found
make: env: No such file or directory
make: uname: No such file or directory
/bin/sh: line 1: cut: command not found
/bin/sh: line 1: pkg-config: command not found
# GNU Make 4.4.1
# Built for x86_64-pc-cygwin
# Copyright (C) 1988-2023 Free Software Foundation, Inc.
# License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.
# Make data base, printed on Tue Jun 24 10:40:59 2025
# Variables
# environment
FPS_BROWSER_APP_PROFILE_STRING = Internet Explorer
# environment
SYSTEMDRIVE = C:
# environment
JAVA_HOME = C:\Program Files\Java\jre8\
# environment
LC_ALL = C
# environment
USERPROFILE = C:\Users\user
...
[end targets.log]
dryrun.log output (excerpt):
C:\cygwin64\bin\make.exe debug -f c:\Users\path\to\project\Makefile -j4 --dry-run --keep-going --print-directory
make: Entering directory '/cygdrive/c/Users/path/to/project'
./mkversion.sh: line 21: perl: command not found
./mkversion.sh: line 33: cat: command not found
make: env: No such file or directory
make: uname: No such file or directory
/bin/sh: line 1: cut: command not found
/bin/sh: line 1: pkg-config: command not found
mkdir -p lib
true
for d in doc etc libmyproject tools test; do \
(cd $d && /usr/bin/make BUILD_DEBUG=1 BUILD_DEBUG=1 all) || exit 1; \
done
make[1]: Entering directory '/cygdrive/c/Users/path/to/project/doc'
make[1]: env: No such file or directory
make[1]: uname: No such file or directory
/bin/sh: line 1: cut: command not found
/bin/sh: line 1: pkg-config: command not found
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/cygdrive/c/Users/path/to/project/doc'
make[1]: Entering directory '/cygdrive/c/Users/path/to/project/etc'
make[1]: env: No such file or directory
make[1]: uname: No such file or directory
/bin/sh: line 1: cut: command not found
/bin/sh: line 1: pkg-config: command not found
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/cygdrive/c/Users/path/to/project/etc'
make[1]: Entering directory '/cygdrive/c/Users/path/to/project/libmyproject'
make[1]: env: No such file or directory
make[1]: uname: No such file or directory
/bin/sh: line 1: cut: command not found
/bin/sh: line 1: pkg-config: command not found
mkdir -p .deps
g++ -std=gnu++11 -fno-strict-aliasing -ggdb -v -I. -L/lib -D_ISOC99_SOURCE -D__STDC_FORMAT_MACROS -D_GLIBCXX_USE_CXX11_ABI=0 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DUSE_SYSLOG -DHAVE_POPT -c testMeta.cc -o testMeta.o -MMD -MF .deps/testMeta.d
g++ -fpic -std=gnu++11 -fno-strict-aliasing -ggdb -v -I. -L/lib -D_ISOC99_SOURCE -D__STDC_FORMAT_MACROS -D_GLIBCXX_USE_CXX11_ABI=0 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DUSE_SYSLOG -DHAVE_POPT -c testMeta.cc -o testMeta.po
g++ -shared -Wl,-soname,libmyproject.so -o ../lib/libmyproject.so myproject.po file1.po fileN.po -lpopt -L/lib -lstdc++ -lpthread
make[1]: Leaving directory '/cygdrive/c/Users/path/to/project/libmyproject'
make[1]: Entering directory '/cygdrive/c/Users/path/to/project/tools'
make[1]: env: No such file or directory
make[1]: uname: No such file or directory
/bin/sh: line 1: cut: command not found
/bin/sh: line 1: pkg-config: command not found
...
[end dryrun.log]
Makefile tools output panel:
Saving opened files before build.
The project needs to configure in order to build properly the current target.
Saving opened files before build.
Loading configurations from cache is not necessary.
Generating configuration cache with command: 'C:\cygwin64\bin\make.exe debug -f c:\Users\path\to\project\Makefile -j4 --dry-run --keep-going --print-directory'
Writing the dry-run output: c:\Users\path\to\project\make_logs\dryrun.log
Spawning child process with:
process name: C:\cygwin64\bin\make.exe
process args: debug,-f,c:\Users\path\to\project\Makefile,-j4,--dry-run,--keep-going,--print-directory
working directory: c:\Users\path\to\project
shell type: default
Generating dry-run elapsed time: 78.439
Preprocessing: "c:\Users\path\to\project\make_logs\dryrun.log"
Preprocess elapsed time: 0
Parsing for IntelliSense.
Updating the CppTools IntelliSense Configuration Provider.
Parsing dry-run output for CppTools Custom Configuration Provider.
Analyzing line: make: Entering directory '/cygdrive/c/Users/path/to/project'
MAKE -C: entering directory c:\Users\path\to\project
Analyzing line: make[1]: Entering directory '/cygdrive/c/Users/path/to/project/doc'
MAKE -C: entering directory c:\Users\path\to\project\doc
Analyzing line: make[1]: Leaving directory '/cygdrive/c/Users/path/to/project/doc'
POPD command or end of MAKE -C: leaving directory c:\Users\path\to\project\doc and entering directory c:\Users\path\to\project
Analyzing line: make[1]: Entering directory '/cygdrive/c/Users/path/to/project/etc'
MAKE -C: entering directory c:\Users\path\to\project\etc
Analyzing line: make[1]: Leaving directory '/cygdrive/c/Users/path/to/project/etc'
POPD command or end of MAKE -C: leaving directory c:\Users\path\to\project\etc and entering directory c:\Users\path\to\project
Analyzing line: make[1]: Entering directory '/cygdrive/c/Users/path/to/project/libmyproject'
MAKE -C: entering directory c:\Users\path\to\project\libmyproject
Found compiler command: g++ -std=gnu++11 -fno-strict-aliasing -ggdb -v -I. -L/lib -D_ISOC99_SOURCE -D__STDC_FORMAT_MACROS -D_GLIBCXX_USE_CXX11_ABI=0 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DUSE_SYSLOG -DHAVE_POPT -c testMeta.cc -o testMeta.o -MMD -MF .deps/testMeta.d
Sending configuration for file c:\Users\path\to\project\libmyproject\testMeta.cc -----------------------------------
Defines: _ISOC99_SOURCE;__STDC_FORMAT_MACROS;_GLIBCXX_USE_CXX11_ABI=0;_LARGEFILE64_SOURCE;_GNU_SOURCE;USE_SYSLOG;HAVE_POPT
Includes: c:\Users\path\to\project\libmyproject
Force Includes:
Standard: gnu++11
IntelliSense Mode: undefined
Compiler Path: g++.exe
Compiler Arguments: -fno-strict-aliasing;-ggdb;-v;-L/lib;-c;testMeta.cc;-o;testMeta.o;-MMD
---------------------------------------------------------------------------------------------------
Found compiler command: g++ -fpic -std=gnu++11 -fno-strict-aliasing -ggdb -v -I. -L/lib -D_ISOC99_SOURCE -D__STDC_FORMAT_MACROS -D_GLIBCXX_USE_CXX11_ABI=0 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DUSE_SYSLOG -DHAVE_POPT -c testMeta.cc -o testMeta.po
Sending configuration for file c:\Users\path\to\project\libmyproject\testMeta.cc -----------------------------------
Defines: _ISOC99_SOURCE;__STDC_FORMAT_MACROS;_GLIBCXX_USE_CXX11_ABI=0;_LARGEFILE64_SOURCE;_GNU_SOURCE;USE_SYSLOG;HAVE_POPT
Includes: c:\Users\path\to\project\libmyproject
Force Includes:
Standard: gnu++11
IntelliSense Mode: undefined
Compiler Path: g++.exe
Compiler Arguments: -fpic;-fno-strict-aliasing;-ggdb;-v;-L/lib;-c;testMeta.cc;-o;testMeta.po
---------------------------------------------------------------------------------------------------
Found compiler command: g++ -shared -Wl,-soname,libmyproject.so -o ../lib/libmyproject.so myproject.po file1.po fileN.po -lpopt -L/lib -lstdc++ -lpthread
Analyzing line: make[1]: Leaving directory '/cygdrive/c/Users/path/to/project/libmyproject'
POPD command or end of MAKE -C: leaving directory c:\Users\path\to\project\libmyproject and entering directory c:\Users\path\to\project
Analyzing line: make[1]: Entering directory '/cygdrive/c/Users/path/to/project/tools'
MAKE -C: entering directory c:\Users\path\to\project\tools
Analyzing line: make[1]: Leaving directory '/cygdrive/c/Users/path/to/project/tools'
POPD command or end of MAKE -C: leaving directory c:\Users\path\to\project\tools and entering directory c:\Users\path\to\project
Analyzing line: make[1]: Entering directory '/cygdrive/c/Users/path/to/project/test'
MAKE -C: entering directory c:\Users\path\to\project\test
Analyzing line: make[1]: Leaving directory '/cygdrive/c/Users/path/to/project/test'
POPD command or end of MAKE -C: leaving directory c:\Users\path\to\project\test and entering directory c:\Users\path\to\project
Analyzing line: make: Leaving directory '/cygdrive/c/Users/path/to/project'
POPD command or end of MAKE -C: leaving directory c:\Users\path\to\project and entering directory c:\Users\path\to\project
Sending Workspace Browse Configuration: -----------------------------------
Browse Path: c:\Users\path\to\project\libmyproject;c:\Users\path\to\project\test;c:\Users\path\to\project\tools
Standard: gnu++11
Compiler Path: g++.exe
Compiler Arguments: -fno-strict-aliasing;-ggdb;-v;-L/lib;-c;test_xml.cc;-o;test_xml.o;-MMD;-fpic;-fno-strict-aliasing;-ggdb;-v;-L/lib;-c;testMeta.cc;-o;testMeta.po;-fpic;-fno-strict-aliasing;-ggdb;-v;-L/lib;-c;testMeta.cc;-o;testMeta.po
----------------------------------------------------------------------------
Parsing for IntelliSense elapsed time: 0.908
Parsing for launch targets.
Analyzing line: make: Entering directory '/cygdrive/c/Users/path/to/project'
MAKE -C: entering directory c:\Users\path\to\project
Analyzing line: make[1]: Entering directory '/cygdrive/c/Users/path/to/project/doc'
MAKE -C: entering directory c:\Users\path\to\project\doc
Analyzing line: make[1]: Leaving directory '/cygdrive/c/Users/path/to/project/doc'
POPD command or end of MAKE -C: leaving directory c:\Users\path\to\project\doc and entering directory c:\Users\path\to\project
Analyzing line: make[1]: Entering directory '/cygdrive/c/Users/path/to/project/etc'
MAKE -C: entering directory c:\Users\path\to\project\etc
Analyzing line: make[1]: Leaving directory '/cygdrive/c/Users/path/to/project/etc'
POPD command or end of MAKE -C: leaving directory c:\Users\path\to\project\etc and entering directory c:\Users\path\to\project
Analyzing line: make[1]: Entering directory '/cygdrive/c/Users/path/to/project/libmyproject'
MAKE -C: entering directory c:\Users\path\to\project\libmyproject
Analyzing line: make[1]: Leaving directory '/cygdrive/c/Users/path/to/project/libmyproject'
POPD command or end of MAKE -C: leaving directory c:\Users\path\to\project\libmyproject and entering directory c:\Users\path\to\project
Analyzing line: make[1]: Entering directory '/cygdrive/c/Users/path/to/project/tools'
MAKE -C: entering directory c:\Users\path\to\project\tools
Analyzing line: make[1]: Leaving directory '/cygdrive/c/Users/path/to/project/tools'
POPD command or end of MAKE -C: leaving directory c:\Users\path\to\project\tools and entering directory c:\Users\path\to\project
Analyzing line: make[1]: Entering directory '/cygdrive/c/Users/path/to/project/test'
MAKE -C: entering directory c:\Users\path\to\project\test
Analyzing line: make[1]: Leaving directory '/cygdrive/c/Users/path/to/project/test'
POPD command or end of MAKE -C: leaving directory c:\Users\path\to\project\test and entering directory c:\Users\path\to\project
Analyzing line: make: Leaving directory '/cygdrive/c/Users/path/to/project'
POPD command or end of MAKE -C: leaving directory c:\Users\path\to\project and entering directory c:\Users\path\to\project
No new launch configurations have been detected.
Complete list of launch targets: c:\Users\path\to\project\test>test_...()
Parsing for launch targets elapsed time: 0.016
Generating parse content for build targets.
Generating targets information with command: 'C:\cygwin64\bin\make.exe all -f c:\Users\path\to\project\Makefile -j4 --print-data-base --no-builtin-variables --no-builtin-rules --question'
Writing the dry-run output: c:\Users\path\to\project\make_logs\targets.log
Spawning child process with:
process name: C:\cygwin64\bin\make.exe
process args: all,-f,c:\Users\path\to\project\Makefile,-j4,--print-data-base,--no-builtin-variables,--no-builtin-rules,--question
working directory: c:\Users\path\to\project
shell type: default
Generating dry-run elapsed time: 13.618
Parsing for build targets from: "c:\Users\path\to\project\make_logs\targets.log"
Found the following 29 new build targets defined in the makefile: all;all-recursive;check;checkconfig;clean;clean-cmake;clean-deps;clean-deps-dir;clean-gcov;clean-lib;clean-objs;clean-recursive;coverage;coverage-recursive;debug;dist;dist-clean;doc;install;install-check;install-dirs;install-extra;install-recursive;package;printconfig;release;tag;test;test-recursive
Complete list of build targets: all;all-recursive;check;checkconfig;clean;clean-cmake;clean-deps;clean-deps-dir;clean-gcov;clean-lib;clean-objs;clean-recursive;coverage;coverage-recursive;debug;dist;dist-clean;doc;install;install-check;install-dirs;install-extra;install-recursive;package;printconfig;release;tag;test;test-recursive
Parsing build targets elapsed time: 0.002
Configure finished. The status for all the subphases that ran:
generateParseContent: return code = 0, elapsed time = 78.439
preprocessParseContent: return code = 0, elapsed time = 0
parseIntelliSense: return code = 0, elapsed time = 0.908
parseLaunch: return code = 0, elapsed time = 0.016
dryrunTargets: return code = 1, elapsed time = 13.618
parseTargets: return code = 0, elapsed time = 0.002
Configure succeeded.
Configure elapsed time: 93.006
Building target "debug" with command: 'C:\cygwin64\bin\make.exe debug -f c:\Users\path\to\project\Makefile -j4'
Executing task: "Makefile Tools Build Task" with quoting style "Strong"
command name: C:\cygwin64\bin\make.exe
command args debug,-f,c:\Users\path\to\project\Makefile,-j4
Target "debug" failed to build.Additional Information
No response