mirleft / ocaml-nocrypto

OCaml cryptographic library
ISC License
111 stars 53 forks source link

Opam2 install fails with ocaml 4.06 #154

Closed jserot closed 5 years ago

jserot commented 5 years ago
$ opam install nocrypto
The following actions will be performed:
  ∗ install nocrypto 0.5.4-1

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
[nocrypto.0.5.4-1] found in cache

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
[ERROR] The compilation of nocrypto failed at "/Users/.../.opam/opam-init/hooks/sandbox.sh build ocaml pkg/pkg.ml build
        --pinned false --tests false --jobs 1 --with-lwt true --xen false --freestanding false".

#=== ERROR while compiling nocrypto.0.5.4-1 ===================================#
# context     2.0.2 | macos/x86_64 | base-bigarray.base base-threads.base base-unix.base ocaml-base-compiler.4.06.0 | https://opam.ocaml.org/#0a6fcc94
# path        ~/.opam/4.06.0/.opam-switch/build/nocrypto.0.5.4-1
# command     ~/.opam/opam-init/hooks/sandbox.sh build ocaml pkg/pkg.ml build --pinned false --tests false --jobs 1 --with-lwt true --xen false --freestanding false
# exit-code   2
# env-file    ~/.opam/log/nocrypto-36353-ebe0e0.env
# output-file ~/.opam/log/nocrypto-36353-ebe0e0.out
### output ###
# Cannot load required shared library dllcpuid_stubs.
# Reason: /Users/.../.opam/4.06.0/lib/stublibs/dllcpuid_stubs.so: dlopen(/Users/.../.opam/4.06.0/lib/stublibs/dllcpuid_stubs.so, 10): Symbol not found: ___cpuid
#   Referenced from: /Users/.../.opam/4.06.0/lib/stublibs/dllcpuid_stubs.so
#   Expected in: flat namespace
#  in /Users/.../.opam/4.06.0/lib/stublibs/dllcpuid_stubs.so.
# File "./pkg/pkg.ml", line 1:
# Error: Reference to undefined global `Cpuid'
# pkg.ml: [ERROR] No package description found. A syntax error may have occured
#                 or did you forget to call Topkg.Pkg.describe ?

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
┌─ The following actions failed
│ λ build nocrypto 0.5.4-1
└─ 

Because the nocrypto package is in the dependency list, this bug prevents building the opampublish plugin :(

pqwy commented 5 years ago

Hmmm.

Which compiler are you using?

It uses the cpuid lib to configure the build, and that fails to load. And it fails to load because it fails to resolve the symbol ___cpuid. And this is where it gets weird, because similarly-named __cpuid should have been provided by the headers, and generate no external linkage.

jserot commented 5 years ago
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
$ ocamlc -v
The OCaml compiler, version 4.06.0
dbuenzli commented 5 years ago

FWIW I can't reproduce the problem but my gcc is a bit older:

> gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Could you maybe try to update to a later version of xcode ?

jserot commented 5 years ago

Thanks for testing, Daniel. Your version is newer, you meant (10.0.0, mine 5.0) ? I will try to update xcode to see if it solves the pb.

jserot commented 5 years ago

Solved by

dbuenzli commented 5 years ago

Cool, thanks for getting back with the resolution.