msys and tdm-gcc: configure error - cannot run C compiled programs - c++

so I'm trying to compile a preexisting C++ project with msys and tdm-gcc in Windows. I have done this successfully by installing tdm-gcc (latest version) via the installer, editing MinGW/msys/1.0/etc/fstab to give my tdm-gcc install as the mount location, then running msys to call the configure script, and make.
However, for this project I need to use an old version of tdm-gcc (4.6.1-tdm64-1) for binary compatibility. So I installed the required packages from the tdm-gcc sourceforge site (gcc core, gcc c++, binutils, mingw64-runtime, mingw32-make, libintl, libiconv, all of the version the readme says to use with 4.6.1), extracted to a new directory, and edited fstab to point to their location. Now while executing the configure I get this error: cannot run C compiled programs. The config file reads:
[omitted]
configure:3436: $? = 0
configure:3425: gcc -v >&5
Using built-in specs.
COLLECT_GCC=c:\TDM-GCC-4.6.1-64\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/tdm-gcc-4.6.1-64/bin/../libexec/gcc/x86_64-w64-mingw32/4.6.1/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../src/gcc-4.6.1/configure --build=x86_64-w64-mingw32 --enable- targets=all --enable-languages=c,c++,fortran,objc,obj-c++ --enable-libgomp --enable-lto --enable-libstdcxx-debug --enable-version-specific-runtime-libs --enable-fully-dynamic-string --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --prefix=/mingw64tdm --with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=http://tdm-gcc.tdragon.net/bugs
Thread model: win32
gcc version 4.6.1 (tdm64-1)
configure:3436: $? = 0
configure:3425: gcc -V >&5
gcc.exe: error: unrecognized option '-V'
gcc.exe: fatal error: no input files
compilation terminated.
configure:3436: $? = 1
configure:3425: gcc -qversion >&5
gcc.exe: error: unrecognized option '-qversion'
gcc.exe: fatal error: no input files
compilation terminated.
configure:3436: $? = 1
configure:3456: checking whether the C compiler works
configure:3478: gcc conftest.c >&5
configure:3482: $? = 0
configure:3530: result: yes
configure:3533: checking for C compiler default output file name
configure:3535: result: a.exe
configure:3541: checking for suffix of executables
configure:3548: gcc -o conftest.exe conftest.c >&5
configure:3552: $? = 0
configure:3574: result: .exe
configure:3596: checking whether we are cross compiling
configure:3604: gcc -o conftest.exe conftest.c >&5
configure:3608: $? = 0
configure:3615: ./conftest.exe
./configure: line 3617: ./conftest.exe: Bad file number
configure:3619: $? = 126
configure:3626: error: in `/c/jagswm':
configure:3628: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
[omitted]
I've tried adding the tdm-gcc bin to my path, although I don't think that should matter if fstab is set.
Any advice would be greatly appreciated, thanks.

Try to disable your antivirus.
Worked for me while compiling GStreamer, probably because Avast was deleting the a.exe file.
Source: http://wiki.openttd.org/Compiling_on_Windows_using_MinGW#Compilation_and_installation_of_the_required_packages

Related

configure: error: Fortran compiler cannot create executables

I'm trying to install Quantum ESPRESSO on my computer and have run into an issue when using the ./configure command in the unpacked directory.
$ ./configure
checking build system type... x86_64-apple-darwin21.2.0
checking ARCH... mac686
checking setting AR... ... ar
checking setting ARFLAGS... ... ruv
checking for gfortran... gfortran
checking whether the Fortran compiler works... no
configure: error: in `/Users/myname/winter/q-e-qe-6.8':
configure: error: Fortran compiler cannot create executables
See `config.log' for more details
I just updated to macOS Monterey and have GNU Fortran (Homebrew GCC 11.2.0_3) 11.2.0 installed.
When trying to debug this, I looked at the config.log file and looked at similar googled questions. They all point me to updating or reinstalling things, like gcc, which I subsequently did.
Does the problem have to do with this:
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin21.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I can see that the version is 4.2.1, but I'm unaware of what Apple clang is. Is it a PATH issue?
I'd appreciate any help.
P.S. Please choose to be kind in responses.
Here is part of the config.log:
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Homebrew GCC 11.2.0_3)
configure:2542: $? = 0
configure:2531: gfortran -V >&5
gfortran: error: unrecognized command-line option '-V'
gfortran: fatal error: no input files
compilation terminated.
configure:2542: $? = 1
configure:2531: gfortran -qversion >&5
gfortran: error: unrecognized command-line option '-qversion'; did you mean '--version'?
gfortran: fatal error: no input files
compilation terminated.
configure:2542: $? = 1
configure:2557: checking whether the Fortran compiler works
configure:2579: gfortran conftest.f >&5
clang: error: invalid version number in '-mmacosx-version-min=12.1'
configure:2583: $? = 1
configure:2621: result: no
configure: failed program was:
| program main
For reference:
$ gfortran --version
GNU Fortran (Homebrew GCC 11.2.0_3) 11.2.0
Copyright (C) 2021 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.```
I had the same issue and I solved by doing the following:
Removing the old tools
($ sudo rm -rf /Library/Developer/CommandLineTools).
Installing xcode command line tools again
($ xcode-select --install).
It was retrieved from:
How to update Xcode from command line

Problems when installing OPEN-MPI

I got some errors when I try to ./configure --prefix=/usr/local
Installed a bunch of stuff and openmpi versions, but they didn't work. I think previously this command worked, but after following different tuts, it gives errors.
Terminal is in the openmpi folder.
Help? ) Thank you in advance.
Terminal result:
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out checking
for suffix of executables... checking whether we are cross
compiling... configure: error: in
`/Users/maximgavrilov/Documents/temp/openmpi-4.0.0': configure:
error: cannot run C compiled programs. If you meant to cross compile,
use `--host'. See `config.log' for more details
config.log (partially):
uname -m = x86_64
uname -r = 18.0.0
uname -s = Darwin
uname -v = Darwin Kernel Version 18.0.0: Wed Aug 22 20:13:40 PDT 2018;
root:xnu-4903.201.2~1/RELEASE_X86_64
/usr/bin/uname -p = i386
/bin/uname -X = unknown
configure:5797: checking for perl
configure:5813: found /usr/bin/perl
configure:5825: result: perl
configure:5854: === Configuring Open MPI
configure:5870: *** Startup tests
configure:5986: checking build system type
configure:6000: result: x86_64-apple-darwin18.0.0
configure:6020: checking host system type
configure:6033: result: x86_64-apple-darwin18.0.0
configure:6053: checking target system type
configure:6066: result: x86_64-apple-darwin18.0.0
configure:6196: checking for gcc
configure:6212: found /usr/local/bin/gcc
configure:6223: result: gcc
configure:6452: checking for C compiler version
configure:6461: gcc --version >&5
gcc (GCC) 8.1.0
configure:6472: $? = 0
configure:6461: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-
darwin17.5.0/8.1.0/lto-wrapper
Target: x86_64-apple-darwin17.5.0
Configured with: ../gcc-8.1.0/configure --enable-languages=c++,fortran
Thread model: posix
gcc version 8.1.0 (GCC)
configure:6472: $? = 0
configure:6461: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:6472: $? = 1
configure:6461: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'; did you mean
'--version'?
gcc: fatal error: no input files
compilation terminated.
configure:6472: $? = 1
configure:6492: checking whether the C compiler works
configure:6514: gcc conftest.c >&5
configure:6518: $? = 0
configure:6566: result: yes
configure:6569: checking for C compiler default output file name
configure:6571: result: a.out
configure:6577: checking for suffix of executables
configure:6584: gcc -o conftest conftest.c >&5
configure:6588: $? = 0
configure:6610: result:
configure:6632: checking whether we are cross compiling
configure:6640: gcc -o conftest conftest.c >&5
In file included from conftest.c:10:
/usr/local/lib/gcc/x86_64-apple-darwin17.5.0/8.1.0/include-
fixed/stdio.h:80:14: error: expected ';' before 'extern'
__BEGIN_DECLS
^
;
extern FILE *__stdinp;
~~~~~~
/usr/local/lib/gcc/x86_64-apple-darwin17.5.0/8.1.0/include-fixed/stdio.h:81:8: error: unknown type name 'FILE'
extern FILE *__stdinp;
^~~~
/usr/local/lib/gcc/x86_64-apple-darwin17.5.0/8.1.0/include-fixed/stdio.h:82:8: error: unknown type name 'FILE'
extern FILE *__stdoutp;
^~~~
/usr/local/lib/gcc/x86_64-apple-darwin17.5.0/8.1.0/include-fixed/stdio.h:83:8: error: unknown type name 'FILE'
extern FILE *__stderrp;
^~~~
/usr/local/lib/gcc/x86_64-apple-darwin17.5.0/8.1.0/include-fixed/stdio.h:84:1: error: unknown type name '__END_DECLS'
__END_DECLS
^~~~~~~~~~~
/usr/local/lib/gcc/x86_64-apple-darwin17.5.0/8.1.0/include-fixed/stdio.h:155:14: error: expected ';' before 'void'
__BEGIN_DECLS
^
;
void clearerr(FILE *);

sqlcipher ./configuration Windows

How can I compile Sqlcipher on windows?
I'm trying this:
Git Clone sqlcipher C:\sqlcipher
Install MINGW32 C:\MINGW32
Install msys C:\MINGW32\msys\1.0
Install tcltk-8.4.1-1 C:\MINGW32\bin tclsh84 to tclsh.exe
Install Win32OpenSSL-1_0_1f C:\OpenSSL-Win32
1- Run C:\MINGW32\msys\1.0\msys.exe
2 - Cmd mysys command cd c:sqlcipher
3 - ./configure --prefix=C:/Qt/Qt5.2.1/5.2.1/mingw48_32/plugins/sqldrivers/qsqlcipher CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
returns the error:
./configure: line 470: sed: command not found
./configure: line 469: expr:command not found
./configure: line 470: sed: command not found
./configure: line 484: sed: command not found
Updated
Config.log
configure:2484: checking build system type
configure:2498: result: i686-pc-mingw32
configure:2518: checking host system type
configure:2531: result: i686-pc-mingw32
configure:2599: checking for gcc
configure:2615: found /bin/gcc
configure:2626: result: gcc
configure:2855: checking for C compiler version
configure:2864: gcc --version >&5
gcc.exe (GCC) 4.8.1
Copyright (C) 2013 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.
configure:2875: $? = 0
configure:2864: gcc -v >&5
Using built-in specs.
COLLECT_GCC=C:\MinGW\msys\1.0\bin\gcc.exe
Target: mingw32
Configured with: ../gcc-4.8.1/configure --prefix=/mingw --host=mingw32 --build=mingw32 --without-pic --enable-shared --enable-static --with-gnu-ld --enable-lto --enable-libssp --disable-multilib --enable-languages=c,c++,fortran,objc,obj-c++,ada --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --with-gmp=/usr/src/pkg/gmp-5.1.2-1-mingw32-src/bld --with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld --with-mpfr= --with-system-zlib --with-gnu-as --enable-decimal-float=yes --enable-libgomp --enable-threads --with-libiconv-prefix=/mingw32 --with-libintl-prefix=/mingw --disable-bootstrap LDFLAGS=-s CFLAGS=-D_USE_32BIT_TIME_T
Thread model: win32
gcc version 4.8.1 (GCC)
configure:2875: $? = 0
configure:2864: gcc -V >&5
gcc.exe: error: unrecognized command line option '-V'
gcc.exe: fatal error: no input files
compilation terminated.
configure:2875: $? = 1
configure:2864: gcc -qversion >&5
gcc.exe: error: unrecognized command line option '-qversion'
gcc.exe: fatal error: no input files
compilation terminated.
configure:2875: $? = 1
configure:2895: checking whether the C compiler works
configure:2917: gcc conftest.c >&5
gcc.exe: error: CreateProcess: No such file or directory
configure:2921: $? = 1
configure:2959: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "sqlcipher"
| #define PACKAGE_TARNAME "sqlcipher"
| #define PACKAGE_VERSION "3.8.0.2"
| #define PACKAGE_STRING "sqlcipher 3.8.0.2"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:2964: error: in `/c/sqlcipher':
configure:2966: error: C compiler cannot create executables
See `config.log' for more details

Can't compile SQLCipher on Windows

I'm trying to compile SQLCipher. I've downloaded source code from http://sqlcipher.net/.
Then I'm doing from this post:
[http://groups.google.com/group/sqlcipher/browse_thread/thread/55c6296b56bf4533:][1]
[1]
I installed MinGW (set path to gcc: d:\MinGW\bin), OpenSSL and ActiveState Perl. I copyied file libeay32.dll to sqlcipher directory. Than I try execute this command:
./configure --disable-tcl CFLAGS="-DSQLITE_HAS_CODEC
-I/path/to/openssl/include" LDFLAGS="-leay32"
and I got error:
checking build system type... i686-pc-mingw32
checking host system type... i686-pc-mingw32
checking for gcc... gcc
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See 'config.log' for more details.
Config.log shows:
configure:2537: $? = 0
configure:2544: gcc -v >&5
Using built-in specs.
COLLECT_GCC=D:\MinGW\bin\gcc.exe
COLLECT_LTO_WRAPPER=d:/mingw/bin/../libexec/gcc/mingw32/4.5.2/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.5.2/configure --enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-werror --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.5.2 (GCC)
configure:2548: $? = 0
configure:2555: gcc -V >&5
gcc.exe: '-V' option must have argument
configure:2559: $? = 1
configure:2582: checking for C compiler default output file name
configure:2604: gcc -DSQLITE_HAS_CODEC -l/d/OpenSSL-Win32/bin -libeay32 conftest.c >&5
**d:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -ld:/OpenSSL-Win32/bin
d:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -libeay32**
collect2: ld returned 1 exit status
I don't know what is -leay32. I copied file libeay32.dll to sqlcipher directory. In D there is directory OpenSSL-Win32.
Thanks
Try this for your configure command:
./configure –disable-tcl CFLAGS=”-DSQLITE_HAS_CODEC –Ic:/path/to/openssl/include –Lc:/path/to/openssl/lib –leay32”
-leay32 is a library flag, so think of it like "-l eay32". It's referred to as "eay32" because the library flag ignores the "lib" of "libeay32".

MingW c++ compile Error Win 7 x64

I'm trying to compile a simple C++ HelloWorld example on my Win 7 x64 machine with the mingw compiler.
I downloaded the automated installer here: http://sourceforge.net/project/showfiles.php?group_id=2435
After setting the required paths in the system environment variables i was trying to get the compiler to work with a simple HelloWorld example. Sadly, it always crashes with the following error dialog (i am using a german windows, so the translation may not be perfect):
cc1plus.exe - Application error
The application could not be started correctly (0xc000003b).
Click "OK" to close the application.
Below the verbose compile output
W:\Timo\workspace\c++\HelloWorld>gcc HelloWorld.cpp -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=d:/workspace/mingw/bin/../libexec/gcc/mingw32/4.5.2/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.5.2/configure --enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --ena
ble-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-werror -
-build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.5.2 (GCC)
COLLECT_GCC_OPTIONS='-v' '-mtune=i386' '-march=i386'
d:/workspace/mingw/bin/../libexec/gcc/mingw32/4.5.2/cc1plus.exe -quiet -v -iprefix d:\workspace\mingw\bin\../lib/gcc/mingw32/4.5.2/ He
lloWorld.cpp -quiet -dumpbase HelloWorld.cpp -mtune=i386 -march=i386 -auxbase HelloWorld -version -o C:\Users\afro\AppData\Local\Temp\c
czfrXM3.s
Thanks in advance.
Timo
I've found the problem. The file i tried to compile was saved on my NAS-Server which requires a login to access the files. I was able to access the file via console, the compiler obviously did not. After moving the source files on my local hdd, the compiler started working.