I'm trying to build gmp-6.3.0 under msys64 / MINGW64:

MINGW64 /d/SOFTWARE/gmp-6.3.0
$ ./configure --enable-static=yes --enable-shared=no --enable-cxx --with-pic --prefix=$(realpath install_dir_MINGW64)
configure: loading site script /etc/config.site
checking build system type... x86_64-w64-mingw32
checking host system type... x86_64-w64-mingw32
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking ABI=64
checking compiler gcc -O2 -pedantic -fomit-frame-pointer -m64 ... no
checking whether cc is gcc... yes
checking compiler cc -O2 -pedantic -fomit-frame-pointer -m64 ... no
checking ABI=x32
checking compiler gcc -O2 -pedantic -fomit-frame-pointer -mx32 ... no
checking whether cc is gcc... yes
checking compiler cc -O2 -pedantic -fomit-frame-pointer -mx32 ... no
checking ABI=32
checking compiler gcc -m32 -O2 -pedantic -fomit-frame-pointer ... no
checking compiler gcc -O2 -pedantic -fomit-frame-pointer ... no
checking compiler icc -no-gcc ... no
checking whether cc is gcc... yes
checking compiler cc -m32 -O2 -pedantic -fomit-frame-pointer ... no
checking compiler cc -O2 -pedantic -fomit-frame-pointer ... no
configure: error: could not find a working compiler, see config.log for details

Here is the config.log (fragment):

configure:5911: gcc 2>&1 | grep xlc >/dev/null
configure:5914: $? = 1
configure:5968: checking compiler gcc -O2 -pedantic -fomit-frame-pointer -m64 
Test compile: 
configure:5982: gcc -O2 -pedantic -fomit-frame-pointer -m64  conftest.c >&5
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot open output file a.exe: Permission denied
collect2.exe: error: ld returned 1 exit status

Here we see the Permission denied.

I've reproduced it:

MINGW64 /d/SOFTWARE/gmp-6.3.0
$ cat conftest.c
int main(void){}

MINGW64 /d/SOFTWARE/gmp-6.3.0
$ gcc -O1 conftest.c -o conftest7

MINGW64 /d/SOFTWARE/gmp-6.3.0
$ gcc -O1 conftest.c -o conftest7

MINGW64 /d/SOFTWARE/gmp-6.3.0
$ gcc -O2 conftest.c -o conftest7

MINGW64 /d/SOFTWARE/gmp-6.3.0
$ gcc -O2 conftest.c -o conftest7
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot open output file conftest7.exe: Permission denied
collect2.exe: error: ld returned 1 exit status

MINGW64 /d/SOFTWARE/gmp-6.3.0
$ gcc --version
gcc.exe (Rev2, Built by MSYS2 project) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Why does the second gcc -O2 conftest.c -o conftest7 lead to Permission denied?

Any ideas how to fix?

Note that building of gmp-6.3.0 under msys64 / UCRT64 does not have this issue.

0

There are 0 best solutions below