Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apple Silicon can't build hiredis repo, error: ld: symbol(s) not found for architecture x86_64 #810

Closed
poinwater opened this issue Nov 17, 2021 · 10 comments

Comments

@poinwater
Copy link

poinwater commented Nov 17, 2021

Environment

rules_foreign_cc: 0.6.0
Bazel: 4.2.1
MacOS: Big Sur 11.4
Cmake: 3.21.2
Make: 3.81
Guile: 3.0.7

WORDSPACE:

workspace(name = "redis")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")

http_archive(
    name = "rules_foreign_cc",
    sha256 = "69023642d5781c68911beda769f91fcbc8ca48711db935a75da7f6536b65047f",
    strip_prefix = "rules_foreign_cc-0.6.0",
    url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.6.0.tar.gz",
)

load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
# This sets up some common toolchains for building targets. For more details, please see
# https://bazelbuild.github.io/rules_foreign_cc/0.6.0/flatten.html#rules_foreign_cc_dependencies
rules_foreign_cc_dependencies()

new_git_repository(
    name = "hiredis",
    branch = "master",
    build_file = "//redis:hiredis.BUILD",
    remote = "https://github.com/redis/hiredis.git",
)

# http_archive(
#     name = "redis-plus-plus",
#     build_file = "//redis:redis-plus-plus.BUILD",
#     sha256 = "3221e1df7bbe95669aecaec1c6c6f4c9a52f472dd4e694e681da951bc738d6bd",
#     strip_prefix = "redis-plus-plus-1.2.3",
#     url = "https://github.com/sewenew/redis-plus-plus/archive/refs/tags/1.2.3.zip",
# )

hiredis.BUILD

load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
# load(
#     "@local_config_tf//:build_defs.bzl",
#     "D_GLIBCXX_USE_CXX11_ABI",
# )

package(
    default_visibility = ["//visibility:public"],
)

licenses(["notice"])  # BSD

filegroup(
    name = "all_srcs",
    srcs = glob(["**"]),
    visibility = ["//visibility:public"],
)

cmake(
    name = "hiredis",
    copts = [
        "-DCMAKE_BUILD_TYPE=Release",
      # "-DCMAKE_CXX_FLAGS="+D_GLIBCXX_USE_CXX11_ABI,
    ],
    lib_source = "@hiredis//:all_srcs",
    out_static_libs = ["libhiredis_static.a"],
)

build command:
bazel build @hiredis//:hiredis

Error message:
image

Description
Hi, I tried to build the hiredis repo on my MacBook with Apple Silicon, but I got this error ld: symbol(s) not found for architecture x86_64.

I thought the error may indicate my local Guile was built on x86_64, since the path is /opt/homebrew/opt/..; But my homebrew installation message shows the Guile was built on arm64, and my local cmake can build hiredis without problem.

I tried different versions' bazel and rules_foreign_cc, and tried to set

rules_foreign_cc_dependencies(
    register_default_tools = False,
    register_built_tools = False,
)

None of my attempts works, I got the same error messageld: symbol(s) not found for architecture x86_64 again and again.

I also tried to install guile from source, but I failed in the second step. In the second step of installation, I used make check command, and it shows three errors so I can't continually install guile.

I noticed the building process freezes during the GNUmake Process, it might have issue.

FYI, I tried to build the examples in the rules_foreign_cc repository, and some examples built on apple silicon on the issue section, but I can't build any of them successfully.

Could you help me?

@poinwater
Copy link
Author

Here is the full log message in
/bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/make_tool_foreign_cc/BootstrapGNUMake.log

+ ./configure --disable-dependency-tracking --prefix=/private/var/tmp/_bazel_bcghostpc/ee182c645ce45c186ee611d56176f6cd/sandbox/darwin-sandbox/2/execroot/redis/bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... build-aux/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... none
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) none
checking for Minix Amsterdam compiler... no
checking for ar... ar
checking for ranlib... ranlib
checking build system type... x86_64-apple-darwin20.5.0
checking host system type... x86_64-apple-darwin20.5.0
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for _set_invalid_parameter_handler... no
checking for fcntl... yes
checking for symlink... yes
checking for getdtablesize... yes
checking for getprogname... yes
checking for getexecname... no
checking for sys/socket.h... yes
checking for unistd.h... (cached) yes
checking for sys/param.h... yes
checking for limits.h... yes
checking for wchar.h... yes
checking for stdint.h... (cached) yes
checking whether // is distinct from /... no
checking whether the preprocessor supports include_next... yes
checking whether system header files limit the line length... no
checking for complete errno.h... yes
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... no
checking for working fcntl.h... yes
checking for pid_t... yes
checking for mode_t... yes
checking for eaccess... no
checking whether getdtablesize is declared... yes
checking host CPU and C ABI... x86_64
checking whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH etc.... no
checking whether malloc, realloc, calloc are POSIX compliant... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for wchar_t... yes
checking for wint_t... yes
checking whether wint_t is too small... no
checking whether stdint.h conforms to C99... yes
checking whether stdint.h predates C++11... no
checking whether stdint.h has UINTMAX_WIDTH etc.... no
checking for C/C++ restrict keyword... __restrict
checking whether strerror(0) succeeds... no
checking for alloca as a compiler built-in... yes
checking whether // is distinct from /... (cached) no
checking whether dup2 works... yes
checking for error_at_line... no
checking whether fcntl handles F_DUPFD correctly... yes
checking whether fcntl understands F_DUPFD_CLOEXEC... yes
checking whether getdtablesize works... yes
checking for getloadavg... yes
checking sys/loadavg.h usability... no
checking sys/loadavg.h presence... no
checking for sys/loadavg.h... no
checking whether getloadavg is declared... yes
checking whether program_invocation_name is declared... no
checking whether program_invocation_short_name is declared... no
checking whether __argv is declared... no
checking whether __progname is defined in default libraries... yes
checking if system libc has GNU glob... no
checking for ssize_t... yes
checking for good max_align_t... yes
checking whether NULL can be used in arbitrary expressions... yes
checking which flavor of printf attribute matches inttypes macros... system
checking for stpcpy... yes
checking for ranlib... (cached) ranlib
checking how to run the C preprocessor... gcc -E
checking for ar... ar
checking for perl... perl
checking for library containing strerror... none required
checking whether byte ordering is bigendian... no
checking for a sed that does not truncate output... /usr/bin/sed
checking whether NLS is requested... yes
checking for msgfmt... /opt/local/bin/msgfmt
checking for gmsgfmt... /opt/local/bin/msgfmt
checking for xgettext... /opt/local/bin/xgettext
checking for msgmerge... /opt/local/bin/msgmerge
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for shared library run path origin... done
checking for CFPreferencesCopyAppValue... yes
checking for CFLocaleCopyCurrent... yes
checking for GNU gettext in libc... no
checking for iconv... yes
checking for working iconv... yes
checking how to link with libiconv... -liconv
checking for GNU gettext in libintl... no
checking whether to use NLS... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for library containing getpwnam... none required
checking for ANSI C header files... (cached) yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking whether stat file-mode macros are broken... no
checking whether time.h and sys/time.h may both be included... yes
checking for stdlib.h... (cached) yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking for unistd.h... (cached) yes
checking for limits.h... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for string.h... (cached) yes
checking for memory.h... (cached) yes
checking for sys/param.h... (cached) yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/timeb.h usability... yes
checking sys/timeb.h presence... yes
checking for sys/timeb.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking spawn.h usability... yes
checking spawn.h presence... yes
checking for spawn.h... yes
checking for an ANSI C-conforming const... yes
checking return type of signal handlers... void
checking for uid_t in sys/types.h... yes
checking for pid_t... (cached) yes
checking for off_t... yes
checking for size_t... (cached) yes
checking for ssize_t... yes
checking for unsigned long long int... yes
checking for uintmax_t... yes
checking for nanoseconds field of struct stat... st_mtimespec.tv_nsec
checking whether to use high resolution file timestamps... yes
checking for library containing clock_gettime... none required
checking whether system uses MSDOS-style paths... no
checking for standard gettimeofday... yes
checking for strdup... yes
checking for strndup... yes
checking for memrchr... no
checking for umask... yes
checking for mkstemp... yes
checking for mktemp... yes
checking for fdopen... yes
checking for dup... yes
checking for dup2... yes
checking for getcwd... yes
checking for realpath... yes
checking for sigsetmask... yes
checking for sigaction... yes
checking for getgroups... yes
checking for seteuid... yes
checking for setegid... yes
checking for setlinebuf... yes
checking for setreuid... yes
checking for setregid... yes
checking for getrlimit... yes
checking for setrlimit... yes
checking for setvbuf... yes
checking for pipe... yes
checking for strsignal... yes
checking for lstat... yes
checking for readlink... yes
checking for atexit... yes
checking for isatty... yes
checking for ttyname... yes
checking for pselect... yes
checking for posix_spawn... yes
checking for posix_spawnattr_setsigmask... yes
checking whether bsd_signal is declared... yes
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for strcasecmp... yes
checking for strncasecmp... yes
checking for strcmpi... no
checking for strncmpi... no
checking for stricmp... no
checking for strnicmp... no
checking for working strcoll... yes
checking whether closedir returns void... no
checking for struct dirent.d_type... yes
checking for pkg-config... /opt/homebrew/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GNU Guile... 3.0
checking for GUILE... yes
checking for libguile.h... yes
checking whether sys_siglist is declared... yes
checking whether _sys_siglist is declared... no
checking whether __sys_siglist is declared... no
checking for sys/wait.h... yes
checking for waitpid... yes
checking for wait3... yes
checking for union wait... no
checking for SA_RESTART... yes
checking whether dlopen is declared... yes
checking whether dlsym is declared... yes
checking whether dlerror is declared... yes
checking for library containing dlopen... none required
checking If the linker accepts -Wl,--export-dynamic... no
checking If the linker accepts -rdynamic... yes
checking for posix_spawn that fails synchronously... yes
checking for location of SCCS get command... get
checking if malloc debugging is wanted... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating build.cfg
config.status: creating lib/Makefile
config.status: creating po/Makefile.in
config.status: creating doc/Makefile
config.status: creating tests/config-flags.pm
config.status: creating src/config.h
config.status: executing depfiles commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
+ ./build.sh
config.status: creating ./lib/alloca.h__
config.status: creating ./lib/fcntl.h__
config.status: creating ./lib/limits.h__
config.status: creating ./lib/fnmatch.h__
config.status: creating ./lib/glob.h__
config.status: creating ./lib/stdint.h__
config.status: creating ./lib/stdio.h__
config.status: creating ./lib/stdlib.h__
config.status: creating ./lib/string.h__
config.status: creating ./lib/sys/types.h__
config.status: creating ./lib/unistd.h__
compiling lib/concat-filename.c...
compiling lib/dirname-lgpl.c...
compiling lib/basename-lgpl.c...
compiling lib/stripslash.c...
compiling lib/exitfail.c...
compiling lib/fd-hook.c...
compiling lib/findprog-in.c...
compiling lib/getprogname.c...
compiling lib/fnmatch.c...
compiling lib/glob.c...
./lib/glob.c:823:27: warning: incompatible pointer types passing 'char **' to parameter of type 'char *'; dereference with * [-Wincompatible-pointer-types]
            = (char **) realloc (pglob->gl_pathv,
                                 ^~~~~~~~~~~~~~~
                                 *
./lib/glob.c:942:24: warning: incompatible pointer types passing 'char **' to parameter of type 'char *'; dereference with * [-Wincompatible-pointer-types]
                = (char **) realloc (pglob->gl_pathv,
                                     ^~~~~~~~~~~~~~~
                                     *
./lib/glob.c:997:39: warning: incompatible pointer types passing 'char **' to parameter of type 'char *'; dereference with * [-Wincompatible-pointer-types]
              new_pathv = (char **) realloc (pglob->gl_pathv,
                                             ^~~~~~~~~~~~~~~
                                             *
./lib/glob.c:1388:23: warning: incompatible pointer types passing 'char **' to parameter of type 'char *'; dereference with * [-Wincompatible-pointer-types]
        = (char **) realloc (pglob->gl_pathv,
                             ^~~~~~~~~~~~~~~
                             *
4 warnings generated.
compiling lib/unistd.c...
compiling lib/xmalloc.c...
compiling lib/xalloc-die.c...
compiling lib/xconcat-filename.c...
compiling lib/error.c...
compiling lib/strerror.c...
compiling lib/strerror-override.c...
creating libgnu.a...
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ./lib/libgnu.a(fd-hook.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ./lib/libgnu.a(getprogname.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ./lib/libgnu.a(unistd.o) has no symbols
compiling src/ar.c...
compiling src/arscan.c...
compiling src/commands.c...
compiling src/default.c...
compiling src/dir.c...
compiling src/expand.c...
compiling src/file.c...
compiling src/function.c...
compiling src/getopt.c...
./src/getopt.c:685:6: warning: add explicit braces to avoid dangling else [-Wdangling-else]
                   else
                   ^
1 warning generated.
compiling src/getopt1.c...
compiling src/guile.c...
compiling src/hash.c...
compiling src/implicit.c...
compiling src/job.c...
compiling src/load.c...
compiling src/loadapi.c...
compiling src/main.c...
./src/main.c:784:11: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
      if (streq (output_sync_option, "none"))
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/makeint.h:316:9: note: expanded from macro 'streq'
   ((a) == (b) || \
        ^  ~~~
./src/main.c:786:16: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
      else if (streq (output_sync_option, "line"))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/makeint.h:316:9: note: expanded from macro 'streq'
   ((a) == (b) || \
        ^  ~~~
./src/main.c:788:16: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
      else if (streq (output_sync_option, "target"))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/makeint.h:316:9: note: expanded from macro 'streq'
   ((a) == (b) || \
        ^  ~~~
./src/main.c:790:16: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
      else if (streq (output_sync_option, "recurse"))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/makeint.h:316:9: note: expanded from macro 'streq'
   ((a) == (b) || \
        ^  ~~~
./src/main.c:1401:13: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
        if (streq (v->name, "SHELL"))
            ^~~~~~~~~~~~~~~~~~~~~~~~
./src/makeint.h:316:9: note: expanded from macro 'streq'
   ((a) == (b) || \
        ^  ~~~
5 warnings generated.
compiling src/misc.c...
compiling src/output.c...
compiling src/read.c...
./src/read.c:2081:30: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
      if (!posix_pedantic && streq (name, ".POSIX"))
                             ^~~~~~~~~~~~~~~~~~~~~~
./src/makeint.h:316:9: note: expanded from macro 'streq'
   ((a) == (b) || \
        ^  ~~~
./src/read.c:2095:37: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
      else if (!second_expansion && streq (name, ".SECONDEXPANSION"))
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/makeint.h:316:9: note: expanded from macro 'streq'
   ((a) == (b) || \
        ^  ~~~
./src/read.c:2098:30: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
      else if (!one_shell && streq (name, ".ONESHELL"))
                             ^~~~~~~~~~~~~~~~~~~~~~~~~
./src/makeint.h:316:9: note: expanded from macro 'streq'
   ((a) == (b) || \
        ^  ~~~
3 warnings generated.
compiling src/remake.c...
compiling src/rule.c...
compiling src/signame.c...
compiling src/strcache.c...
compiling src/variable.c...
./src/variable.c:405:47: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
  if (variable_changenum != last_changenum && streq (var->name, ".VARIABLES"))
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/makeint.h:316:9: note: expanded from macro 'streq'
   ((a) == (b) || \
        ^  ~~~
./src/variable.c:1055:23: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
                  if (streq (v->name, "SHELL") && shell_var.value)
                      ^~~~~~~~~~~~~~~~~~~~~~~~
./src/makeint.h:316:9: note: expanded from macro 'streq'
   ((a) == (b) || \
        ^  ~~~
./src/variable.c:1126:7: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
  if (streq (var->name, RECIPEPREFIX_NAME))
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/makeint.h:316:9: note: expanded from macro 'streq'
   ((a) == (b) || \
        ^  ~~~
3 warnings generated.
compiling src/version.c...
compiling src/vpath.c...
compiling src/posixos.c...
compiling src/remote-stub.c...
linking make...
ld: warning: ignoring file /opt/homebrew/Cellar/guile/3.0.7_2/lib/libguile-3.0.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/bdw-gc/lib/libgc.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
  "_scm_c_define_gsubr", referenced from:
      _guile_define_module in guile.o
  "_scm_c_define_module", referenced from:
      _guile_init in guile.o
  "_scm_c_eval_string", referenced from:
      _guile_init in guile.o
      _guile_define_module in guile.o
  "_scm_c_module_lookup", referenced from:
      _guile_init in guile.o
  "_scm_call_1", referenced from:
      _internal_guile_eval in guile.o
      _guile_expand_wrapper in guile.o
      _guile_eval_wrapper in guile.o
  "_scm_eval_string", referenced from:
      _internal_guile_eval in guile.o
  "_scm_from_locale_string", referenced from:
      _guile_expand_wrapper in guile.o
  "_scm_from_utf8_string", referenced from:
      _internal_guile_eval in guile.o
  "_scm_to_locale_string", referenced from:
      _internal_guile_eval in guile.o
      _guile_expand_wrapper in guile.o
      _guile_eval_wrapper in guile.o
  "_scm_variable_ref", referenced from:
      _guile_init in guile.o
  "_scm_with_guile", referenced from:
      _func_guile in guile.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@keith
Copy link
Member

keith commented Nov 18, 2021

I hit this when working on envoy as well, I believe the issue might be that the version of make being built here hasn't been updated itself to correctly support apple silicon since this script is deferring this to its build system, but I haven't dug in here

@poinwater
Copy link
Author

poinwater commented Nov 18, 2021

I hit this when working on envoy as well, I believe the issue might be that the version of make being built here hasn't been updated itself to correctly support apple silicon since this script is deferring this to its build system, but I haven't dug in here

Thank you for your response. I am wondering whether the guile used in the building process is the local guile or the guile in the sandbox. My local machine uses Make versions 4.3 and 3.81. The 4.3 was built on apple silicon and installed using Homebrew, the 3.81 might be installed using Xcode, so I think the 3.81 version supports apple silicon as well. Both of them work well on the hiredis repo.

@keith
Copy link
Member

keith commented Nov 18, 2021

To temporarily workaround this you can tell rules_foreign_cc not to build these tools itself https://github.com/envoyproxy/envoy/blob/d60f86c6b54e4ba376f67474d4e5a11f2c8d4dfb/bazel/dependency_imports.bzl#L18

This isn't idea for reproducibility but might unblock you in the short term

@poinwater
Copy link
Author

To temporarily workaround this you can tell rules_foreign_cc not to build these tools itself https://github.com/envoyproxy/envoy/blob/d60f86c6b54e4ba376f67474d4e5a11f2c8d4dfb/bazel/dependency_imports.bzl#L18

This isn't idea for reproducibility but might unblock you in the short term

It works. I tried the command before, but I manually installed cmake in another path such that it raised an error. Now I am using homebrew's cmake, and all works very well. Thanks!

@jsharpe
Copy link
Member

jsharpe commented Nov 18, 2021

#814 may help with this - it seems like make's configure script is escaping the sandbox (see references to homebrew guile) so by explicitly disabling this it will hopefully fix this issue on Apple Silicon (I don't have access to such a machine to test).

@poinwater
Copy link
Author

#814 may help with this - it seems like make's configure script is escaping the sandbox (see references to homebrew guile) so by explicitly disabling this it will hopefully fix this issue on Apple Silicon (I don't have access to such a machine to test).

Yes. It works after I set:

rules_foreign_cc_dependencies(
    register_default_tools = False,
    register_built_tools = False,
)

I reinstalled the cmake using bazel, previous I used alias to link my cmake in application, and it raised an error. By removing the alias in .zshrc, it works now.

@jsharpe
Copy link
Member

jsharpe commented Nov 18, 2021

@poinwater that PR should remove the need to set register_built_tools = False and will hermetically build make 4.3.

@jsharpe
Copy link
Member

jsharpe commented Nov 18, 2021

You should also be able to remove register_default_tools = False as cmake provides universal binaries for download so you can let it download cmake rather than having to install it yourself.

@poinwater
Copy link
Author

You should also be able to remove register_default_tools = False as cmake provides universal binaries for download so you can let it download cmake rather than having to install it yourself.

Yes, I tested. It works without register_default_tools = False.

@jsharpe jsharpe closed this as completed Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants