CygWin 64 位可以编译 32 位源代码吗?

CygWin 64 位可以编译 32 位源代码吗?

我在尝试着在 CygWin 64 位上编译(假定)32 位网络唤醒工具这里由 Thomas Krennwallner 创建,应该编译在 Unix 和 Windows 上的 CygWin 下。

下载后我做了:

tar -zxvf wol-0.7.1.tar.gz

并且,为了更新其 configure.guess 脚本(包含的脚本有点旧:来自 2004 年),我从这里

因此,根据其README文件,我这样做:

./configure

我得到:

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 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 

这似乎是在报告预期的问题时在 64 位上编译 32 位程序平台。

是否有可能解决这个问题?
我读过一些关于在 gcc 编译器上使用标志“-m32”或在编译之前发送一些变量(导出)的信息,但问题似乎出在配置部分,而不是编译部分。顺序似乎是:

  • 。配置
  • 制作
  • 进行检查
  • 进行安装
  • 使清洁

第一步失败了:-(。
无论如何,我尝试过:

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

./configure剧本却不断失败。

顺便说一句,我试图忽略错误并继续(第二步)编译:

make

但它会产生一些错误消息报告(抱歉,我的 CygWin 似乎是西班牙语的),类似于No objective specified and no makefile found

我认为解决这个问题可以帮助我学习如何在 CygWin 64 上编译 32 位程序。
请提供一些帮助。

PS:我知道这个工具有 Win32 版本可供下载,并且还有其他用于局域网唤醒的程序。但是如何解决问题呢?

编辑:我在 CygWin 上安装了以下软件包名称:

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

编辑-2:我通过卸载 CygWin 64 位并安装 32 位版本节省了我的时间。一切都进行得很顺利。

答案1

Cygwin 软件包有两个版本:64 位版本和 32 位版本。由于 64 位库比 32 位库更新,因此缺少一些库和程序。

您可以同时安装 32 位和 64 位 Cygwin,不会出现任何问题。因此,如果您想使用 32 位模式进行编译和继续,请安装 32 位 cygwin 并调用其 bash shell。

Cygwin 32位通常安装在c:\cygwin,64位cygwin安装在c:\cygwin64。

总而言之,如果您需要 32 位功能,请安装 32 位 cygwin 和完成任务所需的所有必要软件包。

注意:32 位程序将在 64 位 Windows 平台上运行。

答案2

为了使以前的答案更加稳定和可信(我还不能评论),这是官方答案:

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

“问:至少在我看来,‘gcc -m32’可以理解为‘在当前 ABI 环境 (cygwin64) 中创建一个使用 32 位架构的可执行文件’。

答:不,确实不能。-m32 的作用正如 GCC 文档所述:它使 GCC 生成 32 位 x86 代码。文档中没有任何内容表明此类代码在给定的 ABI 环境中确实可以运行。对于 Cygwin64 来说,它不能运行。

问:如何让 32 位编译后的 cygwin 程序在 cygwin64' 下运行?

答:您不能。其他人也不能。对于基于 Cygwin64 的程序,Cygwin32 是一个真正的交叉编译平台,而不仅仅是同一平台的某个子集。反之亦然。

相关内容