`make mingw` should forward/use CC, CXX, HOST variables if set
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 2k
- Forks
- 691
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 1
Description
Right now, make mingw seems to have some notion of MinGW hardcoded. This is nice as a start until you try to run it on a distribution where it's named differently. So I thought why not just specify CXX, CXX, and HOST, like the cmake error actually encourages me to, but it's all ignored:
$ make mingw CC=/usr/bin/x86_64-w64-mingw32-gcc CXX=/usr/bin/x86_64-w64-mingw32-g++ HOST=/usr/bin/x86_64-w64-mingw32 CFLAGS="-m64"
mkdir -p build-mingw; \
cd build-mingw; \
cmake .. -DCMAKE_TOOLCHAIN_FILE=../toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=windows ;\
make && make install
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
The CMAKE_C_COMPILER:
i686-w64-mingw32-gcc
is not a full path and was not found in the PATH.
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error at CMakeLists.txt:2 (project):
The CMAKE_CXX_COMPILER:
i686-w64-mingw32-g++
is not a full path and was not found in the PATH.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "/home/user/commonmark/build-mingw/CMakeFiles/CMakeOutput.log".
See also "/home/user/commonmark/build-mingw/CMakeFiles/CMakeError.log".
make[1]: Entering directory '/home/user/commonmark/build-mingw'
make[1]: *** No targets specified and no makefile found. Stop.
make[1]: Leaving directory '/home/user/commonmark/build-mingw'
make: *** [Makefile:102: mingw] Error 2
I even tried to modify cmark's Makefile to pass on the CC, CXX, HOST vars to the cmake call (which I think they should be), but cmake still ignores it. If that could be made to work that would be great, because with autotools and similar, setting CC/CXX and specifying the --host version works perfectly, same for most plain Makefiles that don't use cmake behind the scenes.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the mingw target in Makefile and the settings in toolchain-mingw32.cmake; reproduce the issue using the command shown with custom CC, CXX, and HOST values. Done means make mingw forwards or uses those values so CMake selects the specified MinGW compilers instead of hardcoded names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cmake
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100