WordNet:文件是为 i386 构建的,这不是被链接的架构 (x86_64) [英] WordNet: file was built for i386 which is not the architecture being linked (x86_64)

查看:39
本文介绍了WordNet:文件是为 i386 构建的,这不是被链接的架构 (x86_64)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行 make 尝试编译 WordNet 3.0 时出现以下错误:

I get the following error when running make trying to compile WordNet 3.0:

gcc -m64  -g -O2   -o wishwn  wishwn-tkAppInit.o wishwn-stubs.o -L../lib -lWN -    F/Library/Frameworks -framework Tk -F/Library/Frameworks -framework Tcl -lpthread -framework CoreFoundation -framework Cocoa -framework Carbon -framework IOKit  -lz  -lpthread -framework CoreFoundation  
ld: warning: ignoring file /Library/Frameworks/Tk.framework/Tk, file was built for i386 which is     not the architecture being linked (x86_64): /Library/Frameworks/Tk.framework/Tk
Undefined symbols for architecture x86_64:
  "_Tk_Init", referenced from:
  _Tcl_AppInit in wishwn-tkAppInit.o
  "_Tk_MainEx", referenced from:
  _main in wishwn-tkAppInit.o
  "_Tk_SafeInit", referenced from:
  _Tcl_AppInit in wishwn-tkAppInit.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [wishwn] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

我正在运行通过 ActiveTcl 安装的 Tcl 8.6.

I'm running Tcl 8.6 installed via ActiveTcl.

有什么想法吗?

推荐答案

每个可执行文件(在所有正常情况下)都必须为单一架构构建,例如,仅为 i386(32 位 Intel-ish) 或 x86_64(64 位 Intel-ish),因为虽然单个 CPU 可以支持多种架构,但它们之间的切换在形式上是上下文切换,因此只能在操作系统内核和您的代码.(一些平台——尤其是 OSX——在过去支持多架构二进制文件——胖"二进制文件——但这很像拥有一个单一的元架构,你现在不应该这样做.)反过来意味着链接的库,无论是否共享库,都必须与您正在构建的架构相匹配.

Each executable must (under all normal circumstances) be built for a single architecture, e.g., for just i386 (32-bit Intel-ish) or x86_64 (64-bit Intel-ish), as while it is possible to have a single CPU support multiple architectures, switching between them is formally a context switch and so is only done between the OS kernel and your code. (Some platforms — notably OSX — have supported multi-architecture binaries — "fat" binaries — in the past, but that's very much like having a single meta-architecture, and you're not supposed to do that now.) This in turn means that the libraries that are linked in, whether shared libraries or not, must also match the architecture you're building for.

不幸的是,您尝试实际使用的库是为不同的体系结构构建的:您尝试链接的 ActiveState 构建看起来像是针对 i386,但您是尝试制作 64 位版本.那行不通.

Unfortunately, the libraries that you're trying to actually use are built for a different architectures: the ActiveState build you're trying to link against looks like it is for i386, yet you're trying to make a 64-bit version. That won't work.

最简单的方法可能是获取 Tcl 和 Tk 的源代码并在您想要的配置中构建它们;这就是我在 OSX 上所做的,而且很简单.从 SourceForge 上的官方发布位置 获取源代码.要为 OSX 构建 Tcl,请运行:

The simplest way is probably to get the sources for Tcl and Tk and build them in the configuration you want; that's what I do on OSX, and it's easy. Grab the sources from the official release location on SourceForge. To build Tcl for OSX, run:

cd tcl8.6.1/unix
./configure --prefix=/where/you/will/install --enable-64bit
make
make test
sudo make install

您可能会传入 --enable-framework 进行配置(但我不会),您可能会省略 make test 并且您可能不需要使用 sudomake install (这取决于您安装到的位置).

You might pass in --enable-framework to configure (but I don't), you might omit the make test and you might not need to use sudo with make install (it depends on where you're installing to).

对于 Tk,您可以:

cd tk8.6.1/unix
./configure --prefix=/where/you/will/install --enable-64bit --enable-aqua
make
sudo make install

可能需要传入--with-tcl=/location/of/tclConfig.sh(这里是tclConfig.sh> 您刚刚在上面安装)但是如果您将 Tk 源代码放在 Tcl 源代码旁边,构建脚本会自动找到它.有一个 Tk 测试套件,但它比 Tcl 测试套件更具侵入性(因为它必须弹出窗口、窃取焦点、抓住鼠标指针等等;它是一个 GUI 工具包,所以你应该期待那种的东西)这意味着我完全可以理解你没有运行单元测试.

You might need to pass in --with-tcl=/location/of/tclConfig.sh (where that's the tclConfig.sh that you just installed above) but the build scripts find it automatically if you've put the Tk sources next to the Tcl sources. There's a test suite for Tk, but it's much more intrusive than the Tcl one (since it has to pop up windows, steal the focus, grab the mouse pointer, that sort of thing; it's a GUI toolkit, so you should expect that sort of thing) which means I can totally understand you not running the unit tests.

这篇关于WordNet:文件是为 i386 构建的,这不是被链接的架构 (x86_64)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆