0

I am getting these linker errors when trying to build cgminer in Mac OS 12.3.1 for antminer s2 with these options:

./autogeh.sh
export CFLAGS="-O2"
./configure --enable-ants2
Undefined symbols for architecture arm64:
  "_opt_bitmain_auto", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_opt_bitmain_beeper", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_opt_bitmain_checkall", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_opt_bitmain_checkn2diff", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_opt_bitmain_hwerror", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_opt_bitmain_overheat", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_opt_bitmain_temp", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_opt_bitmain_tempoverctrl", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_opt_bitmain_workdelay", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_set_bitmain_fan", referenced from:
      _opt_config_table in cgminer-cgminer.o
ld: symbol(s) not found for architecture arm64

I've added --enable-bitmain but still get the same error.

I was able to use this codebase to build for the Gekko miner with --enable-gekko so the codebase is in tact and works. I've looked inside the source code and these variables are defined inside driver-bitmain.c. When looking at the output of make there is a cgminer-driver-bitmain.o object file built in ccan so I'm guessing that driver-bitmain.c is picked-up, and yet it appears it's not. The codebase I'm using is from https://github.com/vthoang/cgminer.git which is the codebase used by the gekko miner.

Making all in ccan
  CC       opt/libccan_a-helpers.o
  CC       opt/libccan_a-opt.o
  CC       opt/libccan_a-parse.o
  CC       opt/libccan_a-usage.o
  AR       libccan.a
  CC       cgminer-cgminer.o
  CC       cgminer-util.o
  CC       cgminer-sha2.o
  CC       cgminer-api.o
  CC       cgminer-logging.o
  CC       cgminer-klist.o
  CC       cgminer-noncedup.o
  CC       cgminer-driver-bitmain.o
  CCLD     cgminer

Can anyone help me make sense of this / how to make this compile with the --enable-ants2 option? I'm either not configuring the environment well (very likely) or the make process is broken (unlikely). Here is the output of make:

/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
Making all in lib
  GEN      c++defs.h
  GEN      arg-nonnull.h
  GEN      warn-on-use.h
  GEN      signal.h
  GEN      string.h
/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
  CC       dummy.o
  CC       memmem.o
  AR       libgnu.a
Making all in compat
Making all in jansson-2.9
/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
Making all in doc
make[5]: Nothing to be done for `all'.
Making all in src
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..    -Wall -Wextra -Wdeclaration-after-statement -O2 -MT dump.lo -MD -MP -MF .deps/dump.Tpo -c -o dump.lo dump.c
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..    -Wall -Wextra -Wdeclaration-after-statement -O2 -MT error.lo -MD -MP -MF .deps/error.Tpo -c -o error.lo error.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT error.lo -MD -MP -MF .deps/error.Tpo -c error.c  -fno-common -DPIC -o .libs/error.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT dump.lo -MD -MP -MF .deps/dump.Tpo -c dump.c  -fno-common -DPIC -o .libs/dump.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT error.lo -MD -MP -MF .deps/error.Tpo -c error.c -o error.o >/dev/null 2>&1
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT dump.lo -MD -MP -MF .deps/dump.Tpo -c dump.c -o dump.o >/dev/null 2>&1
mv -f .deps/error.Tpo .deps/error.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..    -Wall -Wextra -Wdeclaration-after-statement -O2 -MT hashtable.lo -MD -MP -MF .deps/hashtable.Tpo -c -o hashtable.lo hashtable.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT hashtable.lo -MD -MP -MF .deps/hashtable.Tpo -c hashtable.c  -fno-common -DPIC -o .libs/hashtable.o
mv -f .deps/dump.Tpo .deps/dump.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..    -Wall -Wextra -Wdeclaration-after-statement -O2 -MT hashtable_seed.lo -MD -MP -MF .deps/hashtable_seed.Tpo -c -o hashtable_seed.lo hashtable_seed.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT hashtable_seed.lo -MD -MP -MF .deps/hashtable_seed.Tpo -c hashtable_seed.c  -fno-common -DPIC -o .libs/hashtable_seed.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT hashtable.lo -MD -MP -MF .deps/hashtable.Tpo -c hashtable.c -o hashtable.o >/dev/null 2>&1
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT hashtable_seed.lo -MD -MP -MF .deps/hashtable_seed.Tpo -c hashtable_seed.c -o hashtable_seed.o >/dev/null 2>&1
mv -f .deps/hashtable_seed.Tpo .deps/hashtable_seed.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..    -Wall -Wextra -Wdeclaration-after-statement -O2 -MT load.lo -MD -MP -MF .deps/load.Tpo -c -o load.lo load.c
mv -f .deps/hashtable.Tpo .deps/hashtable.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..    -Wall -Wextra -Wdeclaration-after-statement -O2 -MT memory.lo -MD -MP -MF .deps/memory.Tpo -c -o memory.lo memory.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT load.lo -MD -MP -MF .deps/load.Tpo -c load.c  -fno-common -DPIC -o .libs/load.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT memory.lo -MD -MP -MF .deps/memory.Tpo -c memory.c  -fno-common -DPIC -o .libs/memory.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT memory.lo -MD -MP -MF .deps/memory.Tpo -c memory.c -o memory.o >/dev/null 2>&1
mv -f .deps/memory.Tpo .deps/memory.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..    -Wall -Wextra -Wdeclaration-after-statement -O2 -MT pack_unpack.lo -MD -MP -MF .deps/pack_unpack.Tpo -c -o pack_unpack.lo pack_unpack.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT load.lo -MD -MP -MF .deps/load.Tpo -c load.c -o load.o >/dev/null 2>&1
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT pack_unpack.lo -MD -MP -MF .deps/pack_unpack.Tpo -c pack_unpack.c  -fno-common -DPIC -o .libs/pack_unpack.o
mv -f .deps/load.Tpo .deps/load.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..    -Wall -Wextra -Wdeclaration-after-statement -O2 -MT strbuffer.lo -MD -MP -MF .deps/strbuffer.Tpo -c -o strbuffer.lo strbuffer.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT strbuffer.lo -MD -MP -MF .deps/strbuffer.Tpo -c strbuffer.c  -fno-common -DPIC -o .libs/strbuffer.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT pack_unpack.lo -MD -MP -MF .deps/pack_unpack.Tpo -c pack_unpack.c -o pack_unpack.o >/dev/null 2>&1
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT strbuffer.lo -MD -MP -MF .deps/strbuffer.Tpo -c strbuffer.c -o strbuffer.o >/dev/null 2>&1
mv -f .deps/strbuffer.Tpo .deps/strbuffer.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..    -Wall -Wextra -Wdeclaration-after-statement -O2 -MT strconv.lo -MD -MP -MF .deps/strconv.Tpo -c -o strconv.lo strconv.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT strconv.lo -MD -MP -MF .deps/strconv.Tpo -c strconv.c  -fno-common -DPIC -o .libs/strconv.o
mv -f .deps/pack_unpack.Tpo .deps/pack_unpack.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..    -Wall -Wextra -Wdeclaration-after-statement -O2 -MT utf.lo -MD -MP -MF .deps/utf.Tpo -c -o utf.lo utf.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT strconv.lo -MD -MP -MF .deps/strconv.Tpo -c strconv.c -o strconv.o >/dev/null 2>&1
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT utf.lo -MD -MP -MF .deps/utf.Tpo -c utf.c  -fno-common -DPIC -o .libs/utf.o
mv -f .deps/strconv.Tpo .deps/strconv.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..    -Wall -Wextra -Wdeclaration-after-statement -O2 -MT value.lo -MD -MP -MF .deps/value.Tpo -c -o value.lo value.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT utf.lo -MD -MP -MF .deps/utf.Tpo -c utf.c -o utf.o >/dev/null 2>&1
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT value.lo -MD -MP -MF .deps/value.Tpo -c value.c  -fno-common -DPIC -o .libs/value.o
mv -f .deps/utf.Tpo .deps/utf.Plo
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Wextra -Wdeclaration-after-statement -O2 -MT value.lo -MD -MP -MF .deps/value.Tpo -c value.c -o value.o >/dev/null 2>&1
mv -f .deps/value.Tpo .deps/value.Plo
/bin/sh ../libtool  --tag=CC   --mode=link gcc -Wall -Wextra -Wdeclaration-after-statement -O2 -no-undefined -export-symbols-regex '^json_' -version-info 13:0:9  -o libjansson.la -rpath /usr/local/lib dump.lo error.lo hashtable.lo hashtable_seed.lo load.lo memory.lo pack_unpack.lo strbuffer.lo strconv.lo utf.lo value.lo  
libtool: link: /usr/bin/nm -B  .libs/dump.o .libs/error.o .libs/hashtable.o .libs/hashtable_seed.o .libs/load.o .libs/memory.o .libs/pack_unpack.o .libs/strbuffer.o .libs/strconv.o .libs/utf.o .libs/value.o   | sed -n -e 's/^.*[     ]\([BCDEGRST][BCDEGRST]*\)[     ][  ]*_\([_A-Za-z][_A-Za-z0-9]*\)$/\1 _\2 \2/p' | sed '/ __gnu_lto/d' | /usr/bin/sed 's/.* //' | sort | uniq > .libs/libjansson.exp
libtool: link: /usr/bin/grep -E -e "^json_" ".libs/libjansson.exp" > ".libs/libjansson.expT"
libtool: link: mv -f ".libs/libjansson.expT" ".libs/libjansson.exp"
libtool: link: sed 's|^|_|' < .libs/libjansson.exp > .libs/libjansson-symbols.expsym
libtool: link: gcc -dynamiclib  -o .libs/libjansson.4.dylib  .libs/dump.o .libs/error.o .libs/hashtable.o .libs/hashtable_seed.o .libs/load.o .libs/memory.o .libs/pack_unpack.o .libs/strbuffer.o .libs/strconv.o .libs/utf.o .libs/value.o    -O2   -install_name  /usr/local/lib/libjansson.4.dylib -compatibility_version 14 -current_version 14.0 -Wl,-single_module -Wl,-exported_symbols_list,.libs/libjansson-symbols.expsym
libtool: link: (cd ".libs" && rm -f "libjansson.dylib" && ln -s "libjansson.4.dylib" "libjansson.dylib")
libtool: link: ar cru .libs/libjansson.a  dump.o error.o hashtable.o hashtable_seed.o load.o memory.o pack_unpack.o strbuffer.o strconv.o utf.o value.o
libtool: link: ranlib .libs/libjansson.a
libtool: link: ( cd ".libs" && rm -f "libjansson.la" && ln -s "../libjansson.la" "libjansson.la" )
Making all in test
Making all in bin
make[6]: Nothing to be done for `all'.
Making all in suites
Making all in api
make[7]: Nothing to be done for `all'.
make[7]: Nothing to be done for `all-am'.
make[6]: Nothing to be done for `all-am'.
make[3]: Nothing to be done for `all-am'.
Making all in ccan
  CC       opt/libccan_a-helpers.o
  CC       opt/libccan_a-opt.o
  CC       opt/libccan_a-parse.o
  CC       opt/libccan_a-usage.o
  AR       libccan.a
  CC       cgminer-cgminer.o
  CC       cgminer-util.o
util.c:3583:31: warning: address of function 'interrupted' will always evaluate to 'true' [-Wpointer-bool-conversion]
        else if (unlikely(ret < 0 && interrupted))
                                  ~~ ^~~~~~~~~~~
./miner.h:203:45: note: expanded from macro 'unlikely'
#define unlikely(expr) (__builtin_expect(!!(expr), 0))
                                            ^~~~
util.c:3583:31: note: prefix with the address-of operator to silence this warning
        else if (unlikely(ret < 0 && interrupted))
                                     ^
                                     &
./miner.h:203:45: note: expanded from macro 'unlikely'
#define unlikely(expr) (__builtin_expect(!!(expr), 0))
                                            ^
util.c:3583:31: note: suffix with parentheses to turn this into a function call
util.c:3595:31: warning: address of function 'interrupted' will always evaluate to 'true' [-Wpointer-bool-conversion]
        else if (unlikely(ret < 0 && interrupted))
                                  ~~ ^~~~~~~~~~~
./miner.h:203:45: note: expanded from macro 'unlikely'
#define unlikely(expr) (__builtin_expect(!!(expr), 0))
                                            ^~~~
util.c:3595:31: note: prefix with the address-of operator to silence this warning
        else if (unlikely(ret < 0 && interrupted))
                                     ^
                                     &
./miner.h:203:45: note: expanded from macro 'unlikely'
#define unlikely(expr) (__builtin_expect(!!(expr), 0))
                                            ^
util.c:3595:31: note: suffix with parentheses to turn this into a function call
2 warnings generated.
  CC       cgminer-sha2.o
  CC       cgminer-api.o
  CC       cgminer-logging.o
  CC       cgminer-klist.o
  CC       cgminer-noncedup.o
  CC       cgminer-driver-bitmain.o
  CCLD     cgminer
Undefined symbols for architecture arm64:
  "_opt_bitmain_auto", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_opt_bitmain_beeper", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_opt_bitmain_checkall", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_opt_bitmain_checkn2diff", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_opt_bitmain_hwerror", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_opt_bitmain_overheat", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_opt_bitmain_temp", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_opt_bitmain_tempoverctrl", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_opt_bitmain_workdelay", referenced from:
      _opt_config_table in cgminer-cgminer.o
  "_set_bitmain_fan", referenced from:
      _opt_config_table in cgminer-cgminer.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [cgminer] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.