Can CygWin 64 bits compile 32 bits sources?

1

I am trying to compile on CygWin 64 bits the (presumed) 32 bits wake on lan tool here created by Thomas Krennwallner, supposed to compile on Unix and Windows under CygWin.

After download I did:

tar -zxvf wol-0.7.1.tar.gz

and, in order to update its configure.guess script (the included one is a bit old: from 2004), I have downloaded it from here.

So, according to its README file, I do:

./configure

and I get:

Luis@Windu /cygdrive/h/Temporal/wol/wol-0.7.1
$ ./configure
checking build system type... x86_64-unknown-cygwin
checking host system type... x86_64-unknown-cygwin
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
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.

This is my config.log:

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.59.  Invocation command line was

  $ ./configure 

## --------- ##
## Platform. ##
## --------- ##

hostname = Windu
uname -m = x86_64
uname -r = 1.7.33-2(0.280/5/3)
uname -s = CYGWIN_NT-6.1
uname -v = 2014-11-13 15:47

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = x86_64
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
hostinfo               = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/local/bin
PATH: /usr/bin
PATH: /cygdrive/c/Program Files (x86)/AMD APP/bin/x86_64
PATH: /cygdrive/c/Program Files (x86)/AMD APP/bin/x86
PATH: /cygdrive/c/Windows/system32
PATH: /cygdrive/c/Windows
PATH: /cygdrive/c/Windows/System32/Wbem
PATH: /cygdrive/c/Windows/System32/WindowsPowerShell/v1.0
PATH: /cygdrive/c/ATI Technologies - Graphics/ATI.ACE/Core-Static
PATH: /cygdrive/d/Utilidades/UnxUtils
PATH: /cygdrive/d/Utilidades/CURL
PATH: /cygdrive/d/Utilidades/SSH-Rsync/cwRsync/bin
PATH: /cygdrive/d/Utilidades/Copy Path To Clipboard
PATH: /cygdrive/d/Programas/HashCat/OCLHashCat
PATH: /cygdrive/d/Utilidades/Scripts
PATH: /cygdrive/d/Utilidades/SysInternals Suite - PSTools
PATH: /cygdrive/d/Utilidades/NirSoft NirCmd
PATH: /cygdrive/c/nmap
PATH: /cygdrive/c/Bitvise SSH Client
PATH: /cygdrive/d/Utilidades/Scripts/Clortho
PATH: /cygdrive/c/Nmap


## ----------- ##
## Core tests. ##
## ----------- ##

configure:1348: checking build system type
configure:1366: result: x86_64-unknown-cygwin
configure:1374: checking host system type
configure:1388: result: x86_64-unknown-cygwin
configure:1428: checking for a BSD-compatible install
configure:1483: result: /usr/bin/install -c
configure:1494: checking whether build environment is sane
configure:1537: result: yes
configure:1570: checking for gawk
configure:1586: found /usr/bin/gawk
configure:1596: result: gawk
configure:1606: checking whether make sets $(MAKE)
configure:1626: result: yes
configure:1810: checking for style of include used by make
configure:1838: result: GNU
configure:1909: checking for gcc
configure:1925: found /usr/bin/gcc
configure:1935: result: gcc
configure:2179: checking for C compiler version
configure:2182: gcc --version </dev/null >&5
gcc (GCC) 4.8.3
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:2185: $? = 0
configure:2187: gcc -v </dev/null >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc_old/gcc-4.8.3-5.x86_64/src/gcc-4.8.3/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc_old/gcc-4.8.3-5.x86_64/src/gcc-4.8.3 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --libdir=/usr/lib --datarootdir=/usr/share --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id
Thread model: posix
gcc version 4.8.3 (GCC) 
configure:2190: $? = 0
configure:2192: gcc -V </dev/null >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2195: $? = 1
configure:2218: checking for C compiler default output file name
configure:2221: gcc    conftest.c  >&5
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find crt0.o: No such file or directory
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lcygwin
collect2: error: ld returned 1 exit status
configure:2224: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE "wol"
| #define VERSION "0.7.1"
| #define PACKAGE "wol"
| #define VERSION "0.7.1"
| #define _GNU_SOURCE 1
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:2263: error: C compiler cannot create executables
See `config.log' for more details.

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=x86_64-unknown-cygwin
ac_cv_build_alias=x86_64-unknown-cygwin
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=x86_64-unknown-cygwin
ac_cv_host_alias=x86_64-unknown-cygwin
ac_cv_path_install='/usr/bin/install -c'
ac_cv_prog_AWK=gawk
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_make_make_set=yes

## ----------------- ##
## Output variables. ##
## ----------------- ##

ACLOCAL='${SHELL} /cygdrive/h/Temporal/wol/wol-0.7.1/missing --run aclocal-1.7'
ALLOCA=''
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='${SHELL} /cygdrive/h/Temporal/wol/wol-0.7.1/missing --run tar'
AUTOCONF='${SHELL} /cygdrive/h/Temporal/wol/wol-0.7.1/missing --run autoconf'
AUTOHEADER='${SHELL} /cygdrive/h/Temporal/wol/wol-0.7.1/missing --run autoheader'
AUTOMAKE='${SHELL} /cygdrive/h/Temporal/wol/wol-0.7.1/missing --run automake-1.7'
AWK='gawk'
BUILD_INCLUDED_LIBINTL=''
CATOBJEXT=''
CC='gcc'
CCDEPMODE=''
CFLAGS=''
CPP=''
CPPFLAGS=''
CYGPATH_W='cygpath -w'
DATADIRNAME=''
DEFS=''
DEPDIR='.deps'
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
EXTRA_LIBS=''
GENCAT=''
GLIBC21=''
GMSGFMT=''
HAVE_ASPRINTF=''
HAVE_POSIX_PRINTF=''
HAVE_SNPRINTF=''
HAVE_WPRINTF=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s'
INSTOBJEXT=''
INTLBISON=''
INTLLIBS=''
INTLOBJS=''
INTL_LIBTOOL_SUFFIX_PREFIX=''
LDFLAGS=''
LIBICONV=''
LIBINTL=''
LIBOBJS=''
LIBS=''
LN_S=''
LTLIBICONV=''
LTLIBINTL=''
LTLIBOBJS=''
MAKEINFO='${SHELL} /cygdrive/h/Temporal/wol/wol-0.7.1/missing --run makeinfo'
MKINSTALLDIRS=''
MSGFMT=''
MSGMERGE=''
OBJEXT=''
P2M=''
PACKAGE='wol'
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
PERL=''
POD2TEXI_FALSE=''
POD2TEXI_TRUE=''
POSUB=''
RANLIB=''
SED=''
SET_MAKE=''
SHELL='/bin/sh'
STRIP=''
USE_INCLUDED_LIBINTL=''
USE_NLS=''
VERSION='0.7.1'
XGETTEXT=''
ac_ct_CC='gcc'
ac_ct_RANLIB=''
ac_ct_STRIP=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__include='include'
am__leading_dot='.'
am__quote=''
bindir='${exec_prefix}/bin'
build='x86_64-unknown-cygwin'
build_alias=''
build_cpu='x86_64'
build_os='cygwin'
build_vendor='unknown'
datadir='${prefix}/share'
exec_prefix='NONE'
host='x86_64-unknown-cygwin'
host_alias=''
host_cpu='x86_64'
host_os='cygwin'
host_vendor='unknown'
includedir='${prefix}/include'
infodir='${prefix}/info'
install_sh='/cygdrive/h/Temporal/wol/wol-0.7.1/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localstatedir='${prefix}/var'
mandir='${prefix}/man'
oldincludedir='/usr/include'
prefix='NONE'
program_transform_name='s,x,x,'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

#define PACKAGE "wol"
#define PACKAGE "wol"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME ""
#define PACKAGE_STRING ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define VERSION "0.7.1"
#define VERSION "0.7.1"
#define _GNU_SOURCE 1

configure: exit 77 

That seems to be reporting the expected problem when compiling a 32 bits program on a 64 bits platform.

Is it possible to solve this?
I have read some info about using the flag "-m32" on the gcc compiler, or sending some variables (exporting) before the compiling, but the problem seems to come rather from the configuring part, not the compiling. The order seems to be:

  • .configure
  • make
  • make check
  • make install
  • make clean

and the first step fails :-( .
Anyway, I tried:

export CFLAGS='-m32' export CXXFLAGS='-m32' export LDFLAGS='-m32'

But the ./configure script keeps failing.

And, by the way, I tried to ignore the error and continue (2nd step) compiling:

make

but it yields some error message reporting (sorry, my CygWin seems to be in spanish) something like No objective specified and no makefile found.

I think that solving this problem could help me to learn a way to compile 32 bits programs on CygWin 64.
I request some help, please.

P.S: I know this tool has a Win32 version available to download, as well as there are another programs for wake on LAN. But where is the learning on that way to solve things?

EDIT: I have installed the following package names on CygWin:

gcc-core
gdb
make
mingw-gcc-core
mingw-gcc-g++
mingw-w32api

EDIT-2: I have saved my day by uninstalling CygWin 64 bits and installing 32 bits version. This everything went smooth and fine.

Sopalajo de Arrierez

Posted 2014-11-26T23:04:47.270

Reputation: 5 328

Did you install gcc? Did you install the 32-bit gcc? – Elliott Frisch – 2014-11-26T23:07:03.953

@ElliottFrisch, I have added that info to my original post, thanks. I don't know if those packages are 32 or 64 bits. Well, I suppose the packages are 64 bits, just like CygWin, but I don't know if the compiling part is a 32 or 64 bits. – Sopalajo de Arrierez – 2014-11-26T23:11:07.163

The error compiler cannot create executables is telling. – Elliott Frisch – 2014-11-26T23:15:20.730

So, @ElliottFrisch, I understand that I still need to install the 32-bit gcc. How can I install 32-bit gcc on 64 bits CygWin? Is that possible? – Sopalajo de Arrierez – 2014-11-26T23:22:45.177

I'm not certain, but if your system can't compile at all you're not going to get very far. – Elliott Frisch – 2014-11-26T23:25:47.330

Why are you simply not using the 32-bit version, but yes, you need the 32-bit objects thats sort of obvious. – Ramhound – 2014-11-27T00:19:47.260

Answers

4

Cygwin packages come in two versions, a 64-bit version and a 32-bit version. As the 64-bit library is newer than the 32-bit library, there are some missing libraries and programs.

You can have BOTH the 32-bit and the 64-bit Cygwin installed concurrently without any problems. Thus if you wanted to compile and go on using 32-bit mode, install the 32-bit cygwin and invoke its bash shell.

Cygwin 32-bit is usually installed in c:\cygwin and the 64-bit cygwin is installed in c:\cygwin64.

So in summary, if you need 32-bit capabilities install the 32-bit cygwin and all the necessary packages you need to complete your task.

NOTE: 32-bit programs WILL run on 64-bit windows platforms.

mdpc

Posted 2014-11-26T23:04:47.270

Reputation: 4 176

Both 32 and 64 bits windows programs run fine on my Windows 7 64 bits. If I install CygWin 32 and 64 bits, I will need to remember/test which one can run my programs: some will run on 32 bits and some on 64. I think this is a disadvantage. If the 64 bits version of CygWin has some flaws, I prefer to use only the 64 bits version. Thanks. – Sopalajo de Arrierez – 2014-11-27T01:27:16.590

Excuse me, @mdpc, I wanna say "I prefer to use only the 32 bits version". It has been a typo, sorry. – Sopalajo de Arrierez – 2014-11-27T04:17:10.367

1

To make the previous answer more stable and trustful (I can't comment yet) this is the official answer :

https://cygwin.com/ml/cygwin/2017-02/msg00038.html

"Q: At least it seems to me that 'gcc -m32' could be taken to mean 'create an executable in the current ABI-environment (cygwin64) which uses a 32-bit architecture'.

A: No, it really can't. -m32 does what the GCC documentation says: it makes GCC generate 32-bit x86 code. Nothing in there so much as suggests that such code will actually work in a given ABI environment. In the case of Cygwin64 it won't.

Q: how can I make a 32-bit compiled cygwin program run under cygwin64'?

A: You can't. Nor can anybody else. For a Cygwin64-based program, Cygwin32 is a bona fide cross-compilation platform rather than just some subset of the same platform. The same holds vice versa."

Alix

Posted 2014-11-26T23:04:47.270

Reputation: 11