简体   繁体   English

C程序(在OS X中) - 为归档而构建的文件不是被链接的体系结构(x86_64)

[英]C Program (in OS X) - file was built for archive which is not the architecture being linked (x86_64)

I have an assignment in which I have to use a given source code with an included library, namely, libdb_factory.a and libdb_factory32.a (they gave us both x86_64 and ie386 versions). 我有一个任务,我必须使用包含库的给定源代码,即libdb_factory.a和libdb_factory32.a(他们给了我们x86_64和ie386版本)。

The first hint of something going wrong is that, when executing lipo -info on any of them , I get this: 出现问题的第一个暗示是,当在任何一个上执行lipo -info时,我得到了这个:

fatal error: /Library/Developer/CommandLineTools/usr/bin/lipo: archive 
with no architecture specification: libdb_factory32.a 
(can't determine architecture for it)

Whenever I try to compile the code with make, I get the following: 每当我尝试使用make编译代码时,我都会得到以下结果:

Compiling
-n
-n Concurent example [..
ld: warning: ignoring file ./lib//libdb_factory.a, file was built for
 archive which is not the architecture being linked (x86_64): ./lib//libdb_factory.a
Undefined symbols for architecture x86_64:
  "_db_factory_create_element", referenced from:
  _insert_create in factory-0aefa1.o
  "_db_factory_get_element_name", referenced from:
      _transporter in factory-0aefa1.o
  "_db_factory_get_ready_state", referenced from:
      _transporter in factory-0aefa1.o
  "_db_factory_get_stock", referenced from:
      _transporter in factory-0aefa1.o
      _receiver in factory-0aefa1.o
      _insert_update in factory-0aefa1.o
  "_db_factory_init", referenced from:
      _init_factory in factory-0aefa1.o
  "_db_factory_update_stock", referenced from:
      _transporter in factory-0aefa1.o
      _insert_update in factory-0aefa1.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: *** [all] Error 1

The referenced functions are part of the library which is ignored. 引用的函数是库的一部分,被忽略。 I don't have access to a linux machine (unless I use a virtual machine) but I know it works alright on ubuntu 14.04. 我无法访问Linux机器(除非我使用虚拟机),但我知道它在ubuntu 14.04上运行正常。

Does anyone know what can I do? 有谁知道我能做什么? Any help would be kind appreciated. 任何帮助都会很感激。

Static libraries (ie the object files within them) compiled for Linux cannot be used on OSX. 为Linux编译的静态库(即其中的目标文件)不能在OSX上使用。

The only thing you can do is: 你唯一能做的就是:

  1. Get access to the source and create OSX versions of the libraries. 访问源并创建库的OSX版本。
  2. Use a virtual machine to build the code. 使用虚拟机构建代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 忽略文件lib.a,该文件是为归档而构建的,而不是要链接的体系结构(x86_64) - ignoring file lib.a, file was built for archive which is not the architecture being linked (x86_64) 归档问题,而不是在C中链接的架构(x86_64) - Issue with archive which is not the architecture being linked (x86_64) in C 错误:文件是为不受支持的文件格式构建的,这不是正在链接的体系结构 (x86_64) - Error: file was built for unsupported file format which is not the architecture being linked (x86_64) 文件是为i386构建的,而不是在Mac OSX 10.6上为iOS 4.2编译OpenCV2.2时所链接的架构(x86_64) - file was built for i386 which is not the architecture being linked (x86_64) while compiling OpenCV2.2 for iOS 4.2 on Mac OSX 10.6 编译 .C 文件:体系结构 x86_64 的未定义符号 - Compiling a .C file: Undefined symbols for architecture x86_64 Cuda-体系结构x86_64 OS X的未定义符号 - Cuda - Undefined symbols for architecture x86_64 OS X OS X上的Gcc:体系结构x86_64的未定义符号 - Gcc on OS X: Undefined symbols for architecture x86_64 C中架构x86_64的未定义符号 - Undefined symbols for architecture x86_64 in C 架构x86_64的未定义符号-C - Undefined Symbol for Architecture x86_64 - C 如何修复 C 中的“架构 x86_64 的未定义符号”? - How to fix “ Undefined symbols for architecture x86_64 ” in C?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM