【问题标题】:Compile gettext for Windows with MSVC x64使用 MSVC x64 为 Windows 编译 gettext
【发布时间】:2022-09-25 16:35:32
【问题描述】:

我正在尝试在使用 cmake 和 msvc for x64 构建的项目中使用 gettext。我们需要集成 gettext 来本地化我们的应用程序(作为共享库)。我们在获取带有 msvc_x64 的编译版本时遇到了麻烦。 我们尝试了以下选项:

  1. https://download.gnome.org/binaries/win32/dependencies/ 下载运行时和工具包,并按照https://*.com/a/20038623 中的建议使用。该项目成功地找到了库,但在链接步骤中失败,因为它们是为 win32 准备的。
  2. 使用在https://mlocati.github.io/articles/gettext-iconv-windows.html 中找到的编译版本,但 CMake 抱怨 libintl 库,因为此编译似乎不准备用作其他项目的一部分。
  3. 使用 vcpkg 安装 gettext,但 libiconv(它是一个依赖项)的安装失败。此外,我不确定生成的头文件和库是否适合开发。
  4. 按照https://ftp.gnu.org/pub/gnu/gettext/gettext-0.21.tar.gz 的gettext README 中的说明手动编译。配置命令失败,输出如下:
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for x86_64-w64-mingw32-strip... :
    checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking whether UID \'4096\' is supported by ustar format... yes
    checking whether GID \'4096\' is supported by ustar format... yes
    checking how to create a ustar tar archive... gnutar
    checking build system type... x86_64-pc-cygwin
    checking host system type... x86_64-w64-mingw32
    checking that generated files are newer than configure... done
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating gnulib-local/Makefile
    === configuring in gettext-runtime (/cygdrive/c/Users/User/Downloads/gettext-0.21/gettext-runtime)
    configure: running /bin/sh ./configure --disable-option-checking \'--prefix=/usr/local/msvc64\'  \'--host=x86_64-w64-mingw32\' \'CC=/home/MariAngelesSantosOli/msvc/compile cl -nologo\' \'CFLAGS=-MD\' \'CXX=/home/User/msvc/compile cl -nologo\' \'CXXFLAGS=-MD\' \'CPPFLAGS=-D_WIN32_WINNT= -I/usr/local/msvc64/include\' \'LDFLAGS=-L/usr/local/msvc64/lib\' \'LD=link\' \'NM=dumpbin -symbols\' \'STRIP=:\' \'AR=/home/MariAngelesSantosOli/msvc/ar-lib lib\' \'RANLIB=:\' \'host_alias=x86_64-w64-mingw32\' --cache-file=/dev/null --srcdir=.
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for x86_64-w64-mingw32-strip... :
    checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking for x86_64-w64-mingw32-gcc... /home/User/msvc/compile cl -nologo
    checking whether the C compiler works... no
    configure: error: in `/cygdrive/c/Users/User/Downloads/gettext-0.21/gettext-runtime\':
    configure: error: C compiler cannot create executables
    See `config.log\' for more details
    configure: error: ./configure failed for gettext-runtime
    

    我将不胜感激能够为 msvc_x64 编译 gettext-runtime 的任何指南建议

  • 您可以按照脚本输出的建议发布config.log 的相关部分吗?

标签: visual-studio-2015 localization 64-bit gettext


【解决方案1】:

gcc 也是如此

checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/install/gettext-0.21/gettext-runtime':
configure: error: C compiler cannot create executables
See `config.log' for more details
configure: error: ./configure failed for gettext-runtime

【讨论】: