ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.24k stars 358 forks source link

ocaml broken with latest XCode #1236

Closed azone closed 10 years ago

azone commented 10 years ago
===== ERROR while installing bin_prot.111.03.00 =====
# opam-version 1.1.1
# os           darwin
# command      make
# path         /Users/hjmobile/.opam/system/build/bin_prot.111.03.00
# compiler     system (4.01.0)
# exit-code    2
# env-file     /Users/hjmobile/.opam/system/build/bin_prot.111.03.00/bin_prot-31777-ffb3fd.env
# stdout-file  /Users/hjmobile/.opam/system/build/bin_prot.111.03.00/bin_prot-31777-ffb3fd.out
# stderr-file  /Users/hjmobile/.opam/system/build/bin_prot.111.03.00/bin_prot-31777-ffb3fd.err
### stdout ###
# ...[truncated]
# pkg_camlp4_extend: ................................... /usr/local/lib/ocaml/camlp4
# pkg_type_conv: ....................................... /Users/hjmobile/.opam/system/lib/type_conv
#
# ./setup.exe -build
# ocamlfind ocamlopt unix.cmxa -I /usr/local/lib/ocaml/ocamlbuild /usr/local/lib/ocaml/ocamlbuild/ocamlbuildlib.cmxa -linkpkg myocamlbuild.ml /usr/local/lib/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
# ocamlfind ocamlc -ccopt -DOS_DARWIN -c lib/blit_stubs.c
# + ocamlfind ocamlc -ccopt -DOS_DARWIN -c lib/blit_stubs.c
# clang: error: unknown argument: '-fno-defer-pop' [-Wunused-command-line-argument-hard-error-in-future]
# clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
# Command exited with code 2.
### stderr ###
# clang: error: unknown argument: '-fno-defer-pop' [-Wunused-command-line-argument-hard-error-in-future]
# clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
# W: Cannot find source file matching module 'bin_prot' in library bin_prot
# E: Failure("Command ''/usr/local/bin/ocamlbuild' lib/libbin_prot_stubs.a lib/dllbin_prot_stubs.so lib/bin_prot.cma lib/bin_prot.cmxa lib/bin_prot.a lib/bin_prot.cmxs syntax/pa_bin_prot.cma syntax/pa_bin_prot.cmxa syntax/pa_bin_prot.a syntax/pa_bin_prot.cmxs -use-ocamlfind -tag debug' terminated with error code 10")
# make: *** [build] Error 1

'opam install Core' failed.
avsm commented 10 years ago

What operating system and compiler version is this?

On 12 Mar 2014, at 09:20, Yozone Wong notifications@github.com wrote:

===== ERROR while installing bin_prot.111.03.00 =====

opam-version 1.1.1

os darwin

command make

path /Users/hjmobile/.opam/system/build/bin_prot.111.03.00

compiler system (4.01.0)

exit-code 2

env-file /Users/hjmobile/.opam/system/build/bin_prot.111.03.00/bin_prot-31777-ffb3fd.env

stdout-file /Users/hjmobile/.opam/system/build/bin_prot.111.03.00/bin_prot-31777-ffb3fd.out

stderr-file /Users/hjmobile/.opam/system/build/bin_prot.111.03.00/bin_prot-31777-ffb3fd.err

stdout

...[truncated]

pkg_camlp4_extend: ................................... /usr/local/lib/ocaml/camlp4

pkg_type_conv: ....................................... /Users/hjmobile/.opam/system/lib/type_conv

#

./setup.exe -build

ocamlfind ocamlopt unix.cmxa -I /usr/local/lib/ocaml/ocamlbuild /usr/local/lib/ocaml/ocamlbuild/ocamlbuildlib.cmxa -linkpkg myocamlbuild.ml /usr/local/lib/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild

ocamlfind ocamlc -ccopt -DOS_DARWIN -c lib/blit_stubs.c

+ ocamlfind ocamlc -ccopt -DOS_DARWIN -c lib/blit_stubs.c

clang: error: unknown argument: '-fno-defer-pop' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

Command exited with code 2.

stderr

clang: error: unknown argument: '-fno-defer-pop' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

W: Cannot find source file matching module 'bin_prot' in library bin_prot

E: Failure("Command ''/usr/local/bin/ocamlbuild' lib/libbin_prot_stubs.a lib/dllbin_prot_stubs.so lib/bin_prot.cma lib/bin_prot.cmxa lib/bin_prot.a lib/bin_prot.cmxs syntax/pa_bin_prot.cma syntax/pa_bin_prot.cmxa syntax/pa_bin_prot.a syntax/pa_bin_prot.cmxs -use-ocamlfind -tag debug' terminated with error code 10")

make: *\ [build] Error 1

'opam install Core' failed. — Reply to this email directly or view it on GitHub.

azone commented 10 years ago

@avsm My OS is OS X 10.9.2, and compiler is: Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.1.0 Thread model: posix

gabor-mediasmiths commented 10 years ago

I have the exact same problem. Tried installation via macports, homebrew and ocamlbrew. Same message every time.

avsm commented 10 years ago

Works for me on 10.9.2 with

$ clang -v
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

So the problem is the very latest xcode from the looks of it.

/cc @diml @bmillwood

ghost commented 10 years ago

Seems to be an ocaml problem:

$ ocamlc -config|grep c_compiler
bytecomp_c_compiler: gcc -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -g  -fno-omit-frame-pointer -fPIC
native_c_compiler: gcc -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -g  -fno-omit-frame-pointer

We don't touch the C compiler arguments in bin_prot.

ghost commented 10 years ago

@azone or @gabor-mediasmiths, can you check if you can compile a C file with ocamlc?

touch foo.c
ocamlc -c -verbose foo.c
gabor-mediasmiths commented 10 years ago

@diml nope:

$ touch foo.c
$ ocamlc -c -verbose foo.c
+ /usr/bin/clang -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT  -c   -I'/opt/local/lib/ocaml' 'foo.c'
clang: error: unknown argument: '-fno-defer-pop' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
ghost commented 10 years ago

OK, we need to fix this is ocaml then. Can you give the output of ocamlc -config?

And also, can you try to execute the clang command displayed by ocamlc and remove the -fno-defer-pop to check that it does compile?

gabor-mediasmiths commented 10 years ago
$ ocamlc -config
version: 4.01.0
standard_library_default: /opt/local/lib/ocaml
standard_library: /opt/local/lib/ocaml
standard_runtime: /opt/local/bin/ocamlrun
ccomp_type: cc
bytecomp_c_compiler: /usr/bin/clang -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT 
bytecomp_c_libraries: -lcurses -lpthread
native_c_compiler: /usr/bin/clang -D_FILE_OFFSET_BITS=64 -D_REENTRANT
native_c_libraries: 
native_pack_linker: ld -r  -o 
ranlib: ranlib
cc_profile: -pg
architecture: amd64
model: default
system: macosx
asm: clang -arch x86_64 -c
asm_cfi_supported: true
with_frame_pointers: false
ext_obj: .o
ext_asm: .s
ext_lib: .a
ext_dll: .so
os_type: Unix
default_executable_name: a.out
systhread_supported: true
exec_magic_number: Caml1999X008
cmi_magic_number: Caml1999I015
cmo_magic_number: Caml1999O007
cma_magic_number: Caml1999A008
cmx_magic_number: Caml1999Y011
cmxa_magic_number: Caml1999Z010
ast_impl_magic_number: Caml1999M016
ast_intf_magic_number: Caml1999N015
cmxs_magic_number: Caml2007D001
cmt_magic_number: Caml2012T002
$ /usr/bin/clang -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT  -c   -I'/opt/local/lib/ocaml' 'foo.c'
$
ghost commented 10 years ago

Can you try this branch? https://github.com/diml/ocaml/tree/fix-clang-build If it's ok i'll submit the patch.

Just running ./configure and checking that the output doesn't have -fno-defer-pop should be fine.

gabor-mediasmiths commented 10 years ago

Maybe fixed, though I don't know why it wants to use gcc:

...
Configuration for the bytecode compiler:
        C compiler used........... gcc
        options for compiling.....  -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT
        options for linking.......     -lcurses -lpthread
        shared libraries are supported
        options for compiling.....   -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT
        command for building...... gcc -bundle -flat_namespace -undefined suppress -Wl,-no_compact_unwind -o lib.so /a/path objs
Configuration for the native-code compiler:
        hardware architecture..... amd64
        OS variant................ macosx
        C compiler used........... gcc
        options for compiling.....  -D_FILE_OFFSET_BITS=64 -D_REENTRANT
        options for linking.......   
        assembler ................ clang -arch x86_64 -c
        preprocessed assembler ... clang -arch x86_64 -c
        assembler supports CFI ... yes
        with frame pointers....... no
        native dynlink ........... true
        native dynlink ........... true
        profiling with gprof ..... supported
gabor-mediasmiths commented 10 years ago

Nope:

$ make world.opt
/Applications/Xcode.app/Contents/Developer/usr/bin/make coldstart
cd byterun; /Applications/Xcode.app/Contents/Developer/usr/bin/make all
sed -n -e '/^  /s/ \([A-Z]\)/ \&\&lbl_\1/gp' \
           -e '/^}/q' instruct.h > jumptbl.h
gcc -DCAML_NAME_SPACE -O -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT    -c -o interp.o interp.c
clang: error: unknown argument: '-fno-defer-pop' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make[2]: *** [interp.o] Error 1
make[1]: *** [coldstart] Error 2
make: *** [world.opt] Error 2
dsheets commented 10 years ago

@gregtatcam also ran into this. I've created an experimental opam switch in ocamllabs/opam-repo-dev called 4.01.0+clang-fix which applies @diml's fix-clang-build branch diff on top of the stock 4.01.0 source. So far, it seems to build fine on Linux 3.12 and fails like @gabor-mediasmiths says under OS X with this morning's XCode.

ghost commented 10 years ago

I did another patch to check if gcc is in fact clang. You can try again.

avsm commented 10 years ago

Should update ocaml/ocaml#9 with the final version of this patch

gabor-mediasmiths commented 10 years ago

The second fix works with XCode: the code now compiles. Thanks for the quick fix!

dsheets commented 10 years ago

@gregtatcam reports the switch appears to be working as expected.

andyli commented 10 years ago

I also confirm @diml's fix at https://github.com/diml/ocaml/tree/fix-clang-build works for me (Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)).

yminsky commented 10 years ago

What's the final fix for this? Waiting for an upstream release to the compiler seems like it would take too long. Can we get the patch applied so that people who install 4.01.0 via OPAM get the patch?

avsm commented 10 years ago

I submitted it upstream to Homebrew/homebrew#27611 to fix it at the source. Once its test bot has confirmed there's no regression to older revisions of MacOS, I'll merge the same patch into OPAM. The upstream fix is likely to be different (removing -fno-defer-pop entirely).

fdagnat commented 10 years ago

From the user side, not sure of what to do. Removing objective-caml, update homebrew and installing objective-caml again do not solve the issue in my case. A opam install iocaml still stop on -fno-defer-pop. Do I miss something?

gabor-mediasmiths commented 10 years ago

As a temporary workaround, uninstall the latest XCode, download the previous version (dated last October) from the Apple Developer website, and install that one instead.

yminsky commented 10 years ago

Perhaps some prominent notice on the website? On Mar 18, 2014 3:06 AM, "gabor-mediasmiths" notifications@github.com wrote:

As a temporary workaround, uninstall the latest XCode, download the previous version (dated last October) from the Apple Developer website, and install that one instead.

Reply to this email directly or view it on GitHubhttps://github.com/ocaml/opam/issues/1236#issuecomment-37833975 .

avsm commented 10 years ago

On 17 Mar 2014, at 15:59, fdagnat notifications@github.com wrote:

From the user side, not sure of what to do. Removing objective-caml, update homebrew and installing objective-caml again do not solve the issue in my case. A opam install iocaml still stop on -fno-defer-pop. Do I miss something?

The fix has now been merged into Homebrew, so from the user side:

$ brew update $ brew remove ocaml $ brew install ocaml --build-from-source

Should do the trick. When they update their keg, the "build-from-source" will no longer be necessary.

-anil

fdagnat commented 10 years ago

Ok, building from the source did the trick (notice that the brew package is named objective-caml).

avsm commented 10 years ago

On 17 Mar 2014, at 16:40, fdagnat notifications@github.com wrote:

Ok, building from the source did the trick (notice that the brew package is named objective-caml).

The package is aliased to "ocaml" and "o-ocaml", so any of the variations will also work.

-anil

agarwal commented 10 years ago

@avsm This just fixes the system compiler. Are we now supposed to force opam to use the system compiler?

If you're starting from scratch, you can't even do opam switch, as compiling the compiler fails with the same error.

avsm commented 10 years ago

I haven't had a chance to integrate a patch into the 4.01 series yet. Patches welcome there.

On 18 Mar 2014, at 18:03, Ashish Agarwal notifications@github.com wrote:

@avsm This just fixes the system compiler. Are we now supposed to force opam to use the system compiler?

If you're starting from scratch, you can't even do opam switch, as compiling the compiler fails with the same error.

— Reply to this email directly or view it on GitHub.

agarwal commented 10 years ago

This has been fixed in ocaml/opam-repository@71500ee0f8cdd1246df3261bfed7918e0c01e3b2. Thus, I think this issue can be closed (it is anyway not an opam issue).

ghost commented 10 years ago

Guys,

Unfortunately, this doesn't work when attempting to install Coq:

===== ERROR while installing coq.8.4pl2 =====
# opam-version 1.1.1
# os           darwin
# command      make world states
# path         /Users/psnively/.opam/4.01.0+clang-fix/build/coq.8.4pl2
# compiler     4.01.0+clang-fix
# exit-code    2
# env-file     /Users/psnively/.opam/4.01.0+clang-fix/build/coq.8.4pl2/coq-13701-1872ec.env
# stdout-file  /Users/psnively/.opam/4.01.0+clang-fix/build/coq.8.4pl2/coq-13701-1872ec.out
# stderr-file  /Users/psnively/.opam/4.01.0+clang-fix/build/coq.8.4pl2/coq-13701-1872ec.err
### stdout ###
# ...[truncated]
# OCAMLC    tactics/class_tactics.ml
# OCAMLOPT  tactics/class_tactics.ml
# OCAMLC    tactics/rewrite.ml
# OCAMLOPT  tactics/rewrite.ml
# OCAMLC    tactics/tauto.ml
# OCAMLOPT  tactics/tauto.ml
# OCAMLC    tactics/eqdecide.ml
# OCAMLOPT  tactics/eqdecide.ml
# OCAMLOPT -a -o tactics/hightactics.cmxa
# OCAMLC    kernel/byterun/coq_fix_code.c
### stderr ###
# ...[truncated]
# File "toplevel/toplevel.ml", line 203, characters 43-44:
# Warning 3: deprecated feature: operator (&); you should use (&&) instead
# File "toplevel/toplevel.ml", line 202, characters 21-22:
# Warning 3: deprecated feature: operator (&); you should use (&&) instead
# File "tactics/eauto.ml4", line 35, characters 5-49:
# Warning 3: deprecated feature: operator (or); you should use (||) instead
# clang: error: unknown argument: '-fno-defer-pop' [-Wunused-command-line-argument-hard-error-in-future]
# clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
# make[1]: *** [kernel/byterun/coq_fix_code.o] Error 2
# make: *** [world] Error 2

I haven't dug into this; it may very well be the case that Coq's configuration defeats the patch. Any advice would be most welcome!

ghost commented 10 years ago

Ack! Sorry for the noise!