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

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

我有一个作业,其中我必须使用包含库的给定源代码,即 libdb_factory.a 和 libdb_factory32.a(他们给了我们 x86_64 和 ie386 版本).

出现问题的第一个提示是,在 其中任何一个 上执行 lipo -info 时,我得到:

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

每当我尝试用 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

引用的函数是被忽略的库的一部分。 我无法访问 linux 机器(除非我使用虚拟机)但我知道它在 ubuntu 14.04.

上运行正常

有人知道我能做什么吗?如有任何帮助,我们将不胜感激。

为 Linux 编译的静态库(即其中的目标文件)不能在 OSX 上使用。

你唯一能做的就是:

  1. 访问源代码并创建 OSX 个版本的库。
  2. 使用虚拟机构建代码。