Failed to compile for MinGW64 (cross compilation)

Issue #27 resolved
Former user created an issue

Below is the output from the ./configure stage. The compilation fails, as seen at the bottom, with the message: "error: variable 'GD_COLOR_MAP_X11' definition is marked dllimport"

checking build system type... i386-pc-mingw32
checking host system type... i386-pc-mingw32
checking target system type... i386-pc-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 if we are building a Cygwin target... no
checking for gcc... x86_64-w64-mingw32-gcc.exe
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-w64-mingw32-gcc.exe accepts -g... yes
checking for x86_64-w64-mingw32-gcc.exe option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of x86_64-w64-mingw32-gcc.exe... gcc3
checking for gcc... (cached) x86_64-w64-mingw32-gcc.exe
checking whether we are using the GNU C compiler... (cached) yes
checking whether x86_64-w64-mingw32-gcc.exe accepts -g... (cached) yes
checking for x86_64-w64-mingw32-gcc.exe option to accept ISO C89... (cached) none needed
checking dependency style of x86_64-w64-mingw32-gcc.exe... (cached) gcc3
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by x86_64-w64-mingw32-gcc.exe... /usr/x86_64-w64-mingw32/bin/ld.exe
checking if the linker (/usr/x86_64-w64-mingw32/bin/ld.exe) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 8192
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert i386-pc-mingw32 file names to i386-pc-mingw32 format... func_convert_file_msys_to_w32
checking how to convert i386-pc-mingw32 file names to toolchain format... func_convert_file_msys_to_w32
checking for /usr/x86_64-w64-mingw32/bin/ld.exe option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL
checking for dlltool... dlltool
checking how to associate runtime and link libraries... func_cygming_dll_for_implib
checking for archiver @FILE support... @
checking for strip... /usr/x86_64-w64-mingw32/bin/strip.exe
checking for ranlib... /usr/x86_64-w64-mingw32/bin/ranlib.exe
checking command to parse /usr/bin/nm -B output from x86_64-w64-mingw32-gcc.exe object... failed
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking how to run the C preprocessor... x86_64-w64-mingw32-gcc.exe -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... no
checking for objdir... .libs
checking if x86_64-w64-mingw32-gcc.exe supports -fno-rtti -fno-exceptions... no
checking for x86_64-w64-mingw32-gcc.exe option to produce PIC... -DDLL_EXPORT -DPIC
checking if x86_64-w64-mingw32-gcc.exe PIC flag -DDLL_EXPORT -DPIC works... yes
checking if x86_64-w64-mingw32-gcc.exe static flag -static works... yes
checking if x86_64-w64-mingw32-gcc.exe supports -c -o file.o... yes
checking if x86_64-w64-mingw32-gcc.exe supports -c -o file.o... (cached) yes
checking whether the x86_64-w64-mingw32-gcc.exe linker (/usr/x86_64-w64-mingw32/bin/ld.exe) supports shared libraries... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for X... libraries /usr/lib, headers
checking for ANSI C header files... (cached) yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for unistd.h... (cached) yes
checking for ld used by GCC... /usr/x86_64-w64-mingw32/bin/ld.exe
checking if the linker (/usr/x86_64-w64-mingw32/bin/ld.exe) is GNU ld... yes
checking for shared library run path origin... done
checking for iconv... no, consider installing GNU libiconv
checking iconv.h usability... no
checking iconv.h presence... no
checking for iconv.h... no
checking for sin... yes
checking for deflate in -lz... yes
checking png.h usability... no
checking png.h presence... no
checking for png.h... no
checking libpng/png.h usability... no
checking libpng/png.h presence... no
checking for libpng/png.h... no
checking for png_create_read_struct in -lpng... yes
checking for freetype-config... /usr/bin/freetype-config
checking for FT_Init_FreeType in -lfreetype... no
configure: WARNING: not found - disabling freetype support
checking ft2build.h usability... no
checking ft2build.h presence... no
checking for ft2build.h... no
no
checking for FcInit in -lfontconfig... no
checking for jpeg_set_defaults in -ljpeg... no
checking for XpmReadFileToXpmImage in -lXpm... no
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... no
checking whether pthreads work with -pthreads... no
checking whether pthreads work with -mthreads... no
checking for the pthreads library -lpthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no

** Configuration summary for gd 2.1.0:

   Support for PNG library:          yes
   Support for JPEG library:         no
   Support for Freetype 2.x library: no
   Support for Fontconfig library:   no
   Support for Xpm library:          no
   Support for pthreads:             yes

checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config/Makefile
config.status: creating config/gdlib-config
config.status: creating test/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
make -C ../src/libgd/src CPPFLAGS="-I/home/J/svn/mingw64/src/zlib-1.2.7" LDFLAGS="-L/home/J/svn/mingw64/install/win32-g++/bin/cygwin"
make[1]: Entering directory `/home/J/svn/mingw64/src/libgd/src'
make  all-am
make[2]: Entering directory `/home/J/svn/mingw64/src/libgd/src'
/bin/sh ./libtool --tag=CC    --mode=compile x86_64-w64-mingw32-gcc.exe -DHAVE_CONFIG_H -I.    -I/home/J/svn/mingw64/src/zlib-1.2.7  -fPIC -MT gd.lo -MD -MP -MF .deps/gd.Tpo -c -o gd.lo gd.c
libtool: compile:  x86_64-w64-mingw32-gcc.exe -DHAVE_CONFIG_H -I. -I/home/J/svn/mingw64/src/zlib-1.2.7 -fPIC -MT gd.lo -MD -MP -MF .deps/gd.Tpo -c gd.c -o gd.o
gd.c:1:0: warning: -fPIC ignored for target (all code is position independent)
mv -f .deps/gd.Tpo .deps/gd.Plo
/bin/sh ./libtool --tag=CC    --mode=compile x86_64-w64-mingw32-gcc.exe -DHAVE_CONFIG_H -I.    -I/home/J/svn/mingw64/src/zlib-1.2.7  -fPIC -MT gd_color.lo -MD -MP -MF .deps/gd_color.Tpo -c -o gd_color.lo gd_color.c
libtool: compile:  x86_64-w64-mingw32-gcc.exe -DHAVE_CONFIG_H -I. -I/home/J/svn/mingw64/src/zlib-1.2.7 -fPIC -MT gd_color.lo -MD -MP -MF .deps/gd_color.Tpo -c gd_color.c -o gd_color.o
gd_color.c:1:0: warning: -fPIC ignored for target (all code is position independent)
mv -f .deps/gd_color.Tpo .deps/gd_color.Plo
/bin/sh ./libtool --tag=CC    --mode=compile x86_64-w64-mingw32-gcc.exe -DHAVE_CONFIG_H -I.    -I/home/J/svn/mingw64/src/zlib-1.2.7  -fPIC -MT gd_color_map.lo -MD -MP -MF .deps/gd_color_map.Tpo -c -o gd_color_map.lo gd_color_map.c
libtool: compile:  x86_64-w64-mingw32-gcc.exe -DHAVE_CONFIG_H -I. -I/home/J/svn/mingw64/src/zlib-1.2.7 -fPIC -MT gd_color_map.lo -MD -MP -MF .deps/gd_color_map.Tpo -c gd_color_map.c -o gd_color_map.o
gd_color_map.c:1:0: warning: -fPIC ignored for target (all code is position independent)
gd_color_map.c:761:33: error: variable 'GD_COLOR_MAP_X11' definition is marked dllimport
gd_color_map.c:761:33: warning: 'GD_COLOR_MAP_X11' redeclared without dllimport attribute: previous dllimport ignored
Makefile:745: recipe for target `gd_color_map.lo' failed
make[2]: *** [gd_color_map.lo] Error 1
make[2]: Leaving directory `/home/J/svn/mingw64/src/libgd/src'
Makefile:418: recipe for target `all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/J/svn/mingw64/src/libgd/src'
../Makefiles/Makefile.libs:79: recipe for target `../install/win32-g++/bin/cygwin/libgd.a' failed
make: *** [../install/win32-g++/bin/cygwin/libgd.a] Error 2

Comments (5)

  1. Pierre Joye

    can you try using master please? We have updated the autoconf scripts and use the latest versions. We also correctly export symbols now.

  2. Former user Account Deleted

    I believe I have already fixed this as part of symbol visibility changes. I have commited some more changes to symbol visibility macros, which should (I hope) definitely fix all related errors on more exotic platforms (like Windows :)).

  3. Log in to comment