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

MacOs: Cannot create a switch: "./configure": command not found #4912

Closed
rixed opened this issue Nov 14, 2021 · 12 comments
Closed

MacOs: Cannot create a switch: "./configure": command not found #4912

rixed opened this issue Nov 14, 2021 · 12 comments

Comments

@rixed
Copy link

rixed commented Nov 14, 2021

MacOS BigSur 11.6.1

~ $ brew install opam
==> Downloading https://ghcr.io/v2/homebrew/core/opam/manifests/2.1.1
Already downloaded: /Users/rixed/Library/Caches/Homebrew/downloads/efa9e5ef7a2ae3b01ec3eec2717a684f26e84d06765cf0089e593544b9e0109a--opam-2.1.1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/opam/blobs/sha256:17f550490c8bfe2159fedcd830aac382c6b0bb5a40af26da6ce59c7943d93809
Already downloaded: /Users/rixed/Library/Caches/Homebrew/downloads/d3991e11aea5f0ec6057f4bd2455a24939605b9bcf4def12b3ca7982e17255b8--opam--2.1.1.big_sur.bottle.tar.gz
==> Pouring opam--2.1.1.big_sur.bottle.tar.gz
==> Caveats
OPAM uses ~/.opam by default for its package database, so you need to
initialize it first by running:

$ opam init
==> Summary
�  /usr/local/Cellar/opam/2.1.1: 50 files, 13.3MB
~ $ opam init --no-setup --disable-sandboxing
[WARNING] OPAMBUILDDOC was ignored because CLI 2.1 was requested and it was removed in 2.1, set OPAMCLI environment variable to 2.0.
No configuration file found, using built-in defaults.
Checking for available remotes: rsync and local, git.
  - you won't be able to use mercurial repositories unless you install the hg command on your system.
  - you won't be able to use darcs repositories unless you install the darcs command on your system.


<><> Fetching repository information ><><><><><><><><><><><><><><><><><><><><><>
[default] Initialised

<><> Creating initial switch 'default' (invariant ["ocaml" {>= "4.05.0"}] - initially with ocaml-system)

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml" {>= "4.05.0"}]

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed base-bigarray.base
-> installed base-threads.base
-> installed base-unix.base
-> installed ocaml-system.4.12.0
-> installed ocaml-config.2
-> installed ocaml.4.12.0
Done.
~ $ opam config report
[WARNING] OPAMBUILDDOC was ignored because CLI 2.1 was requested and it was removed in 2.1, set OPAMCLI environment variable to 2.0.
# opam config report
# opam-version         2.1.1
# self-upgrade         no
# system               arch=x86_64 os=macos os-distribution=homebrew os-version=11.6.1
# solver               builtin-mccs+glpk
# install-criteria     -removed,-count[avoid-version,changed],-count[version-lag,request],-count[version-lag,changed],-count[missing-depexts,changed],-changed
# upgrade-criteria     -removed,-count[avoid-version,changed],-count[version-lag,solution],-count[missing-depexts,changed],-new
# jobs                 3
# repositories         1 (http) (default repo at c7f70eff)
# pinned               0
# current-switch       4.09.1
~ $ opam switch create 4.09.1 --jobs=1 --verbose -b
[WARNING] OPAMBUILDDOC was ignored because CLI 2.1 was requested and it was removed in 2.1, set OPAMCLI environment variable to 2.0.

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml-base-compiler" {= "4.09.1"} | "ocaml-system" {= "4.09.1"}]

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>

#=== ERROR while compiling ocaml-base-compiler.4.09.1 =========================#
"./configure": command not found.


<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions were aborted
| - install base-bigarray base
| - install base-threads  base
| - install base-unix     base
| - install ocaml         4.09.1
| - install ocaml-config  1
+- 
+- The following actions failed
| - build ocaml-base-compiler 4.09.1
+- 
- No changes have been performed
# Run eval (opam env --switch=4.09.1) to update the current shell environment
Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [Y/n] n
'opam switch create 4.09.1 --jobs=1 --verbose -b' failed.

Note that the -b option seems to do nothing: I could not find any left overs / build directory left in ./opam.

Notice that /usr/bin/tar is a link to /usr/bin/bsdtar (macos) and /usr/local/bin/tar is a link to /usr/local/bin/gtar.

@dra27
Copy link
Member

dra27 commented Nov 15, 2021

Is this on an M1 or an Intel Mac?

@rixed
Copy link
Author

rixed commented Nov 15, 2021

Is this on an M1 or an Intel Mac?

Sorry, should have included this information.
It's on an intel mac (namely an old MBP 2015), with latest MacOS and latest brew packages.

@dra27
Copy link
Member

dra27 commented Nov 15, 2021

No problem! Is there definitely nothing in .opam/4.09.1/.opam-switch/build/ocaml-base-compiler.4.09.1?

@rixed
Copy link
Author

rixed commented Nov 15, 2021

This single file:

~/.o/4/.o/b/ocaml-base-compiler.4.09.1 $ cat ocaml-base-compiler.install 
share_root: ["config.cache" {"ocaml/config.cache"}]

@dra27
Copy link
Member

dra27 commented Nov 16, 2021

OK, that's strange - that looks like the tarball has failed to extract. Are you able to download the tarball manually and extract it?

@rjbou
Copy link
Collaborator

rjbou commented Nov 16, 2021

Can you share the output with -vv (to have command launched), and --debug (more precise process information)?

@rixed
Copy link
Author

rixed commented Nov 16, 2021

that looks like the tarball has failed to extract

There was a similar ticket recently, opened by @UnixJunkie IIRC, on openbsd. The issue then was that bsdtar was run which does not understand the command line. I cannot find this issue right now, for some reason. Although it was supposed to be fixed, maybe that's a new variant of that bug?

Can you share the output with -vv (to have command launched), and --debug

There it is:
opam.log

@rjbou
Copy link
Collaborator

rjbou commented Nov 17, 2021

In attached log, build directory is well populated, and configure launched. It's another failure:

#=== ERROR while compiling ocaml-base-compiler.4.09.1 =========================#
# context              2.1.1 | macos/x86_64 |  | https://opam.ocaml.org#7247859e
# path                 ~/.opam/4.09.1/.opam-switch/build/ocaml-base-compiler.4.09.1
# command              /usr/bin/make -j1 world
# exit-code            2
# env-file             ~/.opam/log/ocaml-base-compiler-3468-164fae.env
# output-file          ~/.opam/log/ocaml-base-compiler-3468-164fae.out
### output ###
# Undefined symbols for architecture x86_64:
# [...]
#       _caml_builtin_cprim in prims.o
#   "_caml_weak_get_copy", referenced from:
#       _caml_builtin_cprim in prims.o
#   "_caml_weak_set", referenced from:
#       _caml_builtin_cprim in prims.o
#   "_main", referenced from:
#      implicit entry/start for main executable
# ld: symbol(s) not found for architecture x86_64
# clang: error: linker command failed with exit code 1 (use -v to see invocation)

@dbuenzli
Copy link
Contributor

dbuenzli commented Nov 17, 2021

This looks like the classical case when another C compiler install gets in the way (#3650).

@rixed could you check your homebrew or macports that it doesn't have gcc or other binutils installed and in your PATH.

Basically make sure you have

> command -v cc
/usr/bin/cc
> command -v ld
/usr/bin/ld

@rixed
Copy link
Author

rixed commented Nov 17, 2021

~ % command -v cc 
/usr/bin/cc
~ % command -v ld
/usr/bin/ld
~ % /usr/bin/cc --version
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
~ 1 /usr/bin/ld -v       
@(#)PROGRAM:ld  PROJECT:ld64-711
BUILD 18:11:15 Aug  3 2021
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 13.0.0, (clang-1300.0.29.3) (static support for 27, runtime is 27)
TAPI support using: Apple TAPI version 13.0.0 (tapi-1300.0.6.5)

Yet, brew unlink binutils fixed the issue.
Will I have to learn to live without the GNU build tools? :'(

@rixed rixed closed this as completed Nov 17, 2021
@UnixJunkie
Copy link
Contributor

UnixJunkie commented Nov 17, 2021 via email

@dbuenzli
Copy link
Contributor

Yet, brew unlink binutils fixed the issue.

Yes sorry it was likely ranlib or ar.

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

5 participants