5
votes

I've been trying for almost a to build fltk on windows in so many different ways but I always end up with:

configure: error: C compiler cannot create executable (msys fltk/configure)

or

Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken (CMake-gui)

I've tried it with fltk 1.3.0 and 1.3.3 and I've even used three different MinGW distros, GCC version: 5.1.0; 4.9.2 and 3.4.5. Yet it just won't compile. Here is some of the error log generated by the ./configure file:

$ ./configure --prefix=C:/libs/fltk-1.3.3

-----------

Core tests.

-----------

configure:1336: checking build system type configure:1354: result: i686-pc-mingw32 configure:1362: checking host system type configure:1376: result: i686-pc-mingw32 configure:1439: checking for gcc configure:1455: found /c/mingw32/bin/gcc configure:1465: result: gcc configure:1709: checking for C compiler version configure:1712: gcc --version &5 gcc.exe (i686-win32-dwarf-rev2, Built by MinGW-W64 project) 4.9.2 Copyright (C) 2014 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:1715: $? = 0 configure:1717: gcc -v &5 Using built-in specs. COLLECT_GCC=c:\mingw32\bin\gcc.exe COLLECT_LTO_WRAPPER=c:/mingw32/bin/../libexec/gcc/i686-w64-mingw32/4.9.2/lto-wrapper.exe Target: i686-w64-mingw32 Configured with: ../../../src/gcc-4.9.2/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c/mingw492/i686-492-win32-dwarf-rt_v4-rev2/mingw32 --with-gxx-include-dir=/mingw32/i686-w64-mingw32/include/c++ --enable-shared --enable-static --disable-multilib --enable-languages=ada,c,c++,fortran,objc,obj-c++,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-sjlj-exceptions --with-dwarf2 --disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tune=generic --with-libiconv --with-system-zlib --with-gmp=/c/mingw492/prerequisites/i686-w64-mingw32-static --with-mpfr=/c/mingw492/prerequisites/i686-w64-mingw32-static --with-mpc=/c/mingw492/prerequisites/i686-w64-mingw32-static --with-isl=/c/mingw492/prerequisites/i686-w64-mingw32-static --with-cloog=/c/mingw492/prerequisites/i686-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='i686-win32-dwarf-rev2, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/c/mingw492/i686-492-win32-dwarf-rt_v4-rev2/mingw32/opt/include -I/c/mingw492/prerequisites/i686-zlib-static/include -I/c/mingw492/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/c/mingw492/i686-492-win32-dwarf-rt_v4-rev2/mingw32/opt/include -I/c/mingw492/prerequisites/i686-zlib-static/include -I/c/mingw492/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/c/mingw492/i686-492-win32-dwarf-rt_v4-rev2/mingw32/opt/lib -L/c/mingw492/prerequisites/i686-zlib-static/lib -L/c/mingw492/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware' Thread model: win32 gcc version 4.9.2 (i686-win32-dwarf-rev2, Built by MinGW-W64 project) configure:1720: $? = 0 configure:1722: gcc -V &5 gcc.exe: error: unrecognized command line option '-V' gcc.exe: fatal error: no input files compilation terminated. configure:1725: $? = 1 configure:1748: checking for C compiler default output configure:1751: gcc
conftest.c >&5 c:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib/libmingw32.a(lib32_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x39): undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status configure:1754: $? = 1 configure: failed program was: |

line 1728 "configure" | /* confdefs.h. */ | | #define PACKAGE_NAME "" | #define PACKAGE_TARNAME "" | #define PACKAGE_VERSION "" | #define

PACKAGE_STRING "" | #define PACKAGE_BUGREPORT "" | /* end confdefs.h. */ | | int main () | { | | ; | return 0; | } configure:1793: error: C compiler cannot create executables See `config.log' for more details.

configure: exit 77

I previously compiled 2 other gui libraries with these same tools (nana and SFML), so there can't be anything wrong with the gcc compilers.

EDIT

Something (most probably cygwin) keeps breaking my mingw gcc program and every time its "broken" I get black vcc1.exe windows. Then I must replace the mingw folder to get it working again, this happens mostly when I open netbeans. I just don't know how to fix this, so I've just been avoiding cygwin and netbeans.

2
I see you have quite few MinGW directories there: C:/MinGW, C:/mingw32, and C:/mingw492. Maybe the configure is confused and can't find the C/C++ compiler?DejanLekic
I initially had MinGW for general C++ compiling, then I had to use mingw32 to build SFML, then finally I had to use another mingw distro to compile the nana library (I named it mingw-nana). I definitely do not have a directory called mingw492. If this is the problem though, is there a way to specify the gcc compiler ~~~~~~~EDIT: line 19 says otherwise, as it seems to have already chosen a gccducklin5
Can you try running CMake again and show us the contents of CMakeFiles/CMakeError.log and CMakeFiles/CMakeOutput.log?kirbyfan64sos
Also, when the broken vcc1.exe happens, does restarting the computer fix the problem?kirbyfan64sos
No, I dont belive so. It also really makes it hard to build anything. I believe I have a virus because in addition to that in the cygwin64/bin/ directory some of the executable begin to have a hidden v<filename>.exe version. Im actually reinstalling both cygwin and tmd-gcc right nowducklin5

2 Answers

0
votes
  • I was finally able to build it yesterday with this version of TDM-GCC (as per the gui installer):
    • MinGW-w64/TDM64 (32-bit and 64-bit) ==> TDM-GCC
  • I used he cmake gui instead of the .configure
    1. open cmake gui.
    2. input the source code folder (root of fltk folder, ie: "C:/libs/fltk-1.3.3").
    3. input the build folder, ie: "C:/libs/fltk-1.3.3/build/".
    4. click configure
    5. ** optionally you can change some options but i didn't
    6. click Genertae
    7. in cmd (I used git bash though): cd to the build directory and run make or mingw32-make

  • I completely uninstalled cygwin because of its interference with the tool chain builds, i.e mingw and tdm-gcc (Still not sure why this happens).

0
votes

An easier way to setup a development environment is to use MSYS2.

  • Download and install
  • Run MSYS2 Shell
  • Install some dev tools anf FLTK: pacman -S make automake autoconf libtool mingw-w64-i686-gcc mingw-w64-i686-fltk
  • Run Mingw64 Shell and you'll be able to easily compile your source: g++ -o myproject myproject.cpp -lfltk