如何在此实例中修复体系结构x86_64的未定义符号?

时间:2013-04-27 01:07:07

标签: compiler-errors makefile

我正在尝试在Mac OS X 10.8.3计算机上编译cgminer。我用自制软件安装了libcurl。让./configure工作需要一段时间,但我终于做到了(请参阅此问题How do I specify LDFLAGS and CPPFLAGS for ./configure?)。

现在,当我尝试make该程序时,我收到的错误Undefined symbols for architecture x86_64似乎与curl有关。这是从开始到错误的整个make消息:

c10:cgminer-3.0.0 haroldbr$ make
make  all-recursive
Making all in lib
  GEN    signal.h
  GEN    stdint.h
  GEN    string.h
make  all-recursive
  CC     memmem.o
  AR     libgnu.a
/usr/bin/ranlib: file: libgnu.a(dummy.o) has no symbols
ranlib: file: libgnu.a(dummy.o) has no symbols
Making all in compat
make[3]: Nothing to be done for `all-am'.
Making all in ccan
  CC     libccan_a-helpers.o
  CC     libccan_a-opt.o
  CC     libccan_a-parse.o
  CC     libccan_a-usage.o
  AR     libccan.a
  CC     cgminer-cgminer.o
  CC     cgminer-util.o
  CC     cgminer-sha2.o
  CC     cgminer-api.o
api.c: In function ‘print_data’:
api.c:1104: warning: format ‘%06ld’ expects type ‘long int’, but argument 6 has type ‘__darwin_suseconds_t’
  CC     cgminer-logging.o
  CC     cgminer-driver-opencl.o
  CC     cgminer-ocl.o
  CC     cgminer-findnonce.o
  CC     cgminer-adl.o
  CC     cgminer-scrypt.o
  CCLD   cgminer
Undefined symbols for architecture x86_64:
  "_curl_easy_cleanup", referenced from:
      _update_gbt in cgminer-cgminer.o
      _pool_active in cgminer-cgminer.o
      _longpoll_thread in cgminer-cgminer.o
      _reap_curl in cgminer-cgminer.o
      _setup_stratum_curl in cgminer-util.o
      _suspend_stratum in cgminer-util.o
  "_curl_easy_getinfo", referenced from:
      _json_rpc_call in cgminer-util.o
      _setup_stratum_curl in cgminer-util.o
  "_curl_easy_init", referenced from:
      _update_gbt in cgminer-cgminer.o
      _recruit_curl in cgminer-cgminer.o
      _pool_active in cgminer-cgminer.o
      _longpoll_thread in cgminer-cgminer.o
      _setup_stratum_curl in cgminer-util.o
  "_curl_easy_perform", referenced from:
      _json_rpc_call in cgminer-util.o
      _setup_stratum_curl in cgminer-util.o
  "_curl_easy_reset", referenced from:
      _json_rpc_call in cgminer-util.o
  "_curl_easy_setopt", referenced from:
      _longpoll_thread in cgminer-cgminer.o
      _keep_curlalive in cgminer-util.o
      _json_rpc_call in cgminer-util.o
      _setup_stratum_curl in cgminer-util.o
  "_curl_global_cleanup", referenced from:
      _clean_up in cgminer-cgminer.o
  "_curl_global_init", referenced from:
      _main in cgminer-cgminer.o
  "_curl_slist_append", referenced from:
      _json_rpc_call in cgminer-util.o
  "_curl_slist_free_all", referenced from:
      _json_rpc_call in cgminer-util.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[2]: *** [cgminer] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

从我读过的所有内容来看,这是某种类型的链接器错误,而不是编译错误。这显示在./configure脚本的末尾:

------------------------------------------------------------------------
cgminer 3.0.0
------------------------------------------------------------------------


Configuration Options Summary:

  curses.TUI...........: FOUND: -lncurses
  OpenCL...............: FOUND. GPU mining support enabled
  scrypt...............: Enabled
  ADL..................: SDK NOT found, GPU monitoring support DISABLED

  Avalon.ASICs.........: Disabled
  BFL.ASICs............: Disabled
  BitForce.FPGAs.......: Disabled
  Icarus.FPGAs.........: Disabled
  ModMiner.FPGAs.......: Disabled
  Ztex.FPGAs...........: Disabled

Compilation............: make (or gmake)
  CPPFLAGS.............: -I/usr/local/opt/curl/include
  CFLAGS...............: -g 
  LDFLAGS..............: -L/usr/local/opt/curl/lib 
  LDADD................:  -L/usr/local/opt/curl/lib -ljansson -lpthread -framework OpenCL    -lm  

Installation...........: make install (as root if needed, with 'su' or 'sudo')
  prefix...............: /usr/local

我不知道如何解决链接器错误。我是否需要更改./configure的内容?任何建议都非常感谢。

1 个答案:

答案 0 :(得分:0)

这似乎有效:

  

LIBCURL_CFLAGS =“ - I / usr / local / opt / curl / include”LIBCURL_LIBS =“ - L / usr / local / opt / curl / lib -lcurl”./ configure