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

camlp4 fails to install with +32bit compilers (mac os) #108

Closed
lostman opened this issue Jul 7, 2016 · 10 comments
Closed

camlp4 fails to install with +32bit compilers (mac os) #108

lostman opened this issue Jul 7, 2016 · 10 comments

Comments

@lostman
Copy link

lostman commented Jul 7, 2016

Also posted this issue in ocaml/opam-repository:
ocaml/opam-repository#6925
but I think this is a better place.

I was trying to build js_of_ocaml which uses camlp4 with +32bit variants of the OCaml compiler (need 32-bit compiler to use js_of_ocaml with core_kernel and async).

Unfortunately it doesn't work:

=-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  🐫
Building camlp4.4.03+1:
  ./configure --bindir=/Users/lostman/.opam/4.03.0+32bit/bin --libdir=/Users/lostman/.opam/4.03.0+32bit/lib/ocaml --pkgdir=/Users/lostman/.opam/4.03.0+32bit/lib
  make all
  make install install-META
[ERROR] The compilation of camlp4.4.03+1 failed.
Removing camlp4.4.03+1.
  rm -rf /Users/lostman/.opam/4.03.0+32bit/lib/camlp4
  rm -f /Users/lostman/.opam/4.03.0+32bit/bin/camlp4 /Users/lostman/.opam/4.03.0+32bit/bin/camlp4boot /Users/lostman/.opam/4.03.0+32bit/bin/mkcamlp4 /Users/lostman/.opam/4.03.0+32bit/bin/camlp4r /Users/lostman/.opam/4.03.0+32bit/bin/camlp4rf /Users/lostman/.opam/4.03.0+32bit/bin/camlp4orf /Users/lostman/.opam/4.03.0+32bit/bin/camlp4o /Users/lostman/.opam/4.03.0+32bit/bin/camlp4of /Users/lostman/.opam/4.03.0+32bit/bin/camlp4oof /Users/lostman/.opam/4.03.0+32bit/bin/camlp4prof /Users/lostman/.opam/4.03.0+32bit/bin/camlp4rf.opt /Users/lostman/.opam/4.03.0+32bit/bin/camlp4orf.opt /Users/lostman/.opam/4.03.0+32bit/bin/camlp4o.opt /Users/lostman/.opam/4.03.0+32bit/bin/camlp4oof.opt /Users/lostman/.opam/4.03.0+32bit/bin/camlp4r.opt


#=== ERROR while installing camlp4.4.03+1 =====================================#
# opam-version 1.2.0
# os           darwin
# command      make all
# path         /Users/lostman/.opam/4.03.0+32bit/build/camlp4.4.03+1
# compiler     4.03.0+32bit
# exit-code    2
# env-file     /Users/lostman/.opam/4.03.0+32bit/build/camlp4.4.03+1/camlp4-5250-6d07ae.env
# stdout-file  /Users/lostman/.opam/4.03.0+32bit/build/camlp4.4.03+1/camlp4-5250-6d07ae.out
# stderr-file  /Users/lostman/.opam/4.03.0+32bit/build/camlp4.4.03+1/camlp4-5250-6d07ae.err
### stdout ###
# ...[truncated]
# /Users/lostman/.opam/4.03.0+32bit/bin/ocamlc.opt -c -g -w Z -I camlp4/import -I camlp4/config -I camlp4 -o camlp4/config/Camlp4_import.cmo camlp4/config/Camlp4_import.ml
# /Users/lostman/.opam/4.03.0+32bit/bin/ocamlopt.opt -c -g -w Z -I camlp4/import -I camlp4/config -I camlp4 -o camlp4/config/Camlp4_import.cmx camlp4/config/Camlp4_import.ml
# /Users/lostman/.opam/4.03.0+32bit/bin/ocamlopt.opt -c -g -w Z -I camlp4/import -I camlp4/config -I camlp4 -o camlp4/config/Camlp4_config.cmx camlp4/config/Camlp4_config.ml
# /Users/lostman/.opam/4.03.0+32bit/bin/ocamlopt.opt -c -g -w a -I camlp4/import -I camlp4/config -I camlp4/boot -o camlp4/boot/Camlp4.cmx camlp4/boot/Camlp4.ml
# /Users/lostman/.opam/4.03.0+32bit/bin/ocamlopt.opt -c -g -w a -I camlp4/import -I camlp4/config -I camlp4/boot -o camlp4/boot/camlp4boot.cmx camlp4/boot/camlp4boot.ml
# /Users/lostman/.opam/4.03.0+32bit/bin/ocamlopt.opt dynlink.cmxa -g camlp4/config/Camlp4_import.cmx camlp4/config/Camlp4_config.cmx camlp4/boot/Camlp4.cmx camlp4/boot/camlp4boot.cmx -o camlp4/boot/camlp4boot.native
# + /Users/lostman/.opam/4.03.0+32bit/bin/ocamlopt.opt dynlink.cmxa -g camlp4/config/Camlp4_import.cmx camlp4/config/Camlp4_config.cmx camlp4/boot/Camlp4.cmx camlp4/boot/camlp4boot.cmx -o camlp4/boot/camlp4boot.native
# File "_none_", line 1:
# Error: Cannot find file dynlink.cmxa
# Command exited with code 2.
### stderr ###
# + echo camlp4/Camlp4.cmo camlp4/Camlp4Top.cmo camlp4/camlp4prof.byte camlp4/mkcamlp4.byte camlp4/camlp4.byte camlp4/camlp4fulllib.cma camlp4/camlp4boot.byte camlp4/camlp4boot.cma camlp4/camlp4r.byte camlp4/camlp4r.cma camlp4/camlp4rf.byte camlp4/camlp4rf.cma camlp4/camlp4o.byte camlp4/camlp4o.cma camlp4/camlp4of.byte camlp4/camlp4of.cma camlp4/camlp4oof.byte camlp4/camlp4oof.cma camlp4/camlp4orf.b...[truncated]
# make: *** [byte] Error 10

natdynlink is disabled on 32-bit darwin architectures (ocaml-4.02.3/configure):

    i[3456]86-*-darwin*)
      if test $arch64 == true; then
        natdynlink=true
      fi;;
@lostman
Copy link
Author

lostman commented Jul 10, 2016

FWIW I've built 4.02.3+32bit with natdynlink=true and everything seems fine so far:

diff --git a/configure b/configure
index 4ea1498..a211f4b 100755
--- a/configure
+++ b/configure
@@ -784,10 +784,7 @@ if test $with_sharedlibs = "yes"; then
     i[3456]86-*-gnu*)             natdynlink=true;;
     x86_64-*-linux*)              natdynlink=true;;
     i[3456]86-*-darwin[89].*)     natdynlink=true;;
-    i[3456]86-*-darwin*)
-      if test $arch64 == true; then
-        natdynlink=true
-      fi;;
+    i[3456]86-*-darwin*)          natdynlink=true;;
     x86_64-*-darwin*)             natdynlink=true;;
     powerpc*-*-linux*)            natdynlink=true;;
     sparc*-*-linux*)              natdynlink=true;;

@gasche
Copy link
Collaborator

gasche commented Jul 11, 2016

Disabling natdynlink on 32bit darwins was done by @damiendoligez on ocaml/ocaml@9058296 . It seems, from the commit message, that 32bit+natdylink does work with darwin{8,9} but not with darwin{10,11} (that is 10.6 and 10.7); see also ocaml/ocaml@f93ec9a that initially disabled natdynlink on 32-bit 10.6 (darwin10).

What is your own host value?

@damiendoligez or @alainfrisch, do you know how to test whether natdynlink works correctly on a given 32bit darwin host, to know the check can be relaxed for a newer version?

@damiendoligez
Copy link

A more relevant question would be: does it work on Darwin15 (i.e. 10.11) because that's the current version. I wouldn't mind breaking 10.6 and 10.7, they are not even in our set of CI machines.

Especially as it would only break the automatic configuration.

@lostman
Copy link
Author

lostman commented Jul 15, 2016

@damiendoligez I'm running El Capitan 10.11.5 and everything appears to be fine. Compiled camlp4 and been using js_of_ocaml. If there are any tests I could run I'm happy to do so.

gasche added a commit to gasche/ocaml that referenced this issue Jul 15, 2016
…n hosts

See camlp4/camlp4#108: native dynlink seems to work correctly on recent
OSX machines (Darwin15, OSX 10.11), even on 32 bit setups. 32bit
setups were broken by OSX toolchain changes on darwin{10,11} (10.6,
10.7) so all 32bit darwin versions above darwin9 were pessimistically
disabled.

(Apparently the user demand for 32bit darwin host support is that
core_kernel assumes 32bit machines, at least when used in combination
with js_of_ocaml).
gasche added a commit to gasche/ocaml that referenced this issue Jul 15, 2016
…n hosts

See camlp4/camlp4#108: native dynlink seems to work correctly on recent
OSX machines (Darwin15, OSX 10.11), even on 32 bit setups. 32bit
setups were broken by OSX toolchain changes on darwin{10,11} (10.6,
10.7) so all 32bit darwin versions above darwin9 were pessimistically
disabled.

(Apparently the user demand for 32bit darwin host support is that
core_kernel assumes 32bit machines, at least when used in combination
with js_of_ocaml).
@gasche
Copy link
Collaborator

gasche commented Jul 15, 2016

I just sent a PR upstream to enable natdylink on darwin12 and more recent version.

@lostman could you check that applying the patch https://patch-diff.githubusercontent.com/raw/ocaml/ocaml/pull/692.patch on a fresh switch alias also works?

@lostman
Copy link
Author

lostman commented Jul 15, 2016

Just compiled 4.02.3 with this patch and installed js_of_ocaml. Looks good!

What's the best workflow for something like this? I manually copied the 4.02.3 directory in ~/.opam/compilers/... and added the link to the patch to the .comp file. Is there a better way?

@imeckler
Copy link

imeckler commented Nov 11, 2016

How can I apply the patch while leaving the old compiler config in place? I just edited the 4.03.0+32bit .comp file to include the patch since after copying it and editing the list of compilers it still didn't show up in opam switch --all.

@ghost
Copy link

ghost commented Nov 11, 2016

It seems to me that the patch should be added to the opam repository directly

gasche added a commit to gasche/ocaml that referenced this issue Nov 17, 2016
…n hosts

See camlp4/camlp4#108: native dynlink seems to work correctly on recent
OSX machines (Darwin15, OSX 10.11), even on 32 bit setups. 32bit
setups were broken by OSX toolchain changes on darwin{10,11} (10.6,
10.7) so all 32bit darwin versions above darwin9 were pessimistically
disabled.

(Apparently the user demand for 32bit darwin host support is that
core_kernel assumes 32bit machines, at least when used in combination
with js_of_ocaml).
@damiendoligez
Copy link

It doesn't work (with 4.02.3 or trunk) on my machine (darwin 15.6.0 and xcode 8.1) using either the config args found in INSTALL.adoc or the ones used by opam.

Could someone give me detailed instructions to make it work?

@damiendoligez
Copy link

@lostman I can't reproduce your observations. Could you send me the exact versions of MacOS and Xcode, the command lines that you used, and the contents of your environment (especially if you have defined MACOSX_DEPLOYMENT_TARGET) ? Thanks.

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

4 participants