【发布时间】:2021-11-18 08:48:35
【问题描述】:
简介
虽然我能够为我的 64 位 Windows 系统构建二进制文件,但我无法找到生成 32 位二进制文件的方法,尽管我已经尝试了很多方法,但仍然出现大量错误. 具体我正在尝试的是在 wincon 文件夹下为 32 位系统构建 PDCurses-3.9(专用在我试图维护的这个unicurses 库中使用)。
但是到目前为止我所尝试的只给了我错误
- 主要是我所做的唯一重大更改是将
-m32标志添加到“wincon/Makefile”,如下所示:
ifeq ($(DEBUG),Y)
CFLAGS = -g -Wall -DPDCDEBUG
LDFLAGS = -g
else
CFLAGS = -m32 -O2 -Wall # <--
LDFLAGS = -m32 # <--
endif
- 但是当我尝试
make -f Makefile DLL=Y时,我最终得到的是:
...
windres -i ../common/pdcurses.rc pdcurses.o
gcc -Wl,--out-implib,pdcurses.a -shared -o pdcurses.dll addch.o addchstr.o addstr.o attr.o beep.o bkgd.o border.o clear.o color.o delch.o deleteln.o getch.o getstr.o getyx.o inch.o inchstr.o initscr.o inopts.o insch.o insstr.o instr.o kernel.o keyname.o mouse.o move.o outopts.o overlay.o pad.o panel.o printw.o refresh.o scanw.o scr_dump.o scroll.o slk.o termattr.o touch.o util.o window.o debug.o pdcclip.o pdcdisp.o pdcgetsc.o pdckbd.o pdcscrn.o pdcsetsc.o pdcutil.o pdcurses.o
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot export COLORS: symbol not found
...
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: i386 architecture of input file `addch.o' is incompatible with i386:x86-64 output
...
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: color.o:color.c:(.text+0x670): undefined reference to `_getenv'
...
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: pdcutil.o:pdcutil.c:(.text+0x4a): undefined reference to `__imp__GetTickCount@0'
collect2.exe: error: ld returned 1 exit status
make: *** [pdcurses.dll] Error 1
^ ... = 其中很多
系统信息
Windows 10 专业版 64 位 | Intel(R) Core(TM) i7-6700 CPU
> gcc --version
gcc (Rev5, Built by MSYS2 project) 10.3.0
Copyright (C) 2020 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.
make --version
GNU Make 3.81
Copyright (C) 2006 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.
This program built for i386-pc-mingw32
结尾
一般来说,我已经尝试过更改 makefile,但 我有点菜鸟,所以我没有成功 [...] 有什么想法吗?提前致谢
【问题讨论】:
标签: windows gcc linker mingw pdcurses