Created attachment 417174 [details] /var/tmp/portage/dev-lang/ocaml-4.02.3/temp/build.log $ emerge dev-lang/ocaml fails with: make otherlibrariesopt ocamltoolsopt ocamlbuild.native make[1]: Entering directory '/var/tmp/portage/dev-lang/ocaml-4.02.3/work/ocaml-4.02.3' for i in unix str num dynlink bigarray systhreads threads; do \ (cd otherlibs/$i; make allopt) || exit $?; \ done make[2]: Entering directory '/var/tmp/portage/dev-lang/ocaml-4.02.3/work/ocaml-4.02.3/otherlibs/unix' ../../boot/ocamlrun ../../ocamlopt -nostdlib -I ../../stdlib -c -w +33..39 -warn-error A -bin-annot -g -safe-string -nolabels unix.ml ../../boot/ocamlrun ../../ocamlopt -nostdlib -I ../../stdlib -c -w +33..39 -warn-error A -bin-annot -g -safe-string -nolabels unixLabels.ml ../../boot/ocamlrun ../../tools/ocamlmklib -o unix -oc unix -ocamlopt '../../boot/ocamlrun ../../ocamlopt -nostdlib -I ../../stdlib' -linkall \ unix.cmx unixLabels.cmx ../../boot/ocamlrun ../../ocamlopt -nostdlib -I ../../stdlib -shared -o unix.cmxs -I . unix.cmxa sh: -W: invalid option Usage: sh [GNU long option] [option] ... sh [GNU long option] [option] script-file ... GNU long options: --debug --debugger --dump-po-strings --dump-strings --help --init-file --login --noediting --noprofile --norc --posix --rcfile --restricted --verbose --version Shell options: -ilrsD or -c command or -O shopt_option (invocation only) -abefhkmnptuvxBCHP or -o option File "caml_startup", line 1: Error: Error during linking ../Makefile.shared:55: recipe for target 'unix.cmxs' failed make[2]: *** [unix.cmxs] Error 2 make[2]: Leaving directory '/var/tmp/portage/dev-lang/ocaml-4.02.3/work/ocaml-4.02.3/otherlibs/unix' Makefile:763: recipe for target 'otherlibrariesopt' failed make[1]: *** [otherlibrariesopt] Error 2 make[1]: Leaving directory '/var/tmp/portage/dev-lang/ocaml-4.02.3/work/ocaml-4.02.3' Makefile:261: recipe for target 'opt' failed make: *** [opt] Error 2 * ERROR: dev-lang/ocaml-4.02.3::gentoo failed (compile phase): * emake failed * * If you need support, post the output of `emerge --info '=dev-lang/ocaml-4.02.3::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-lang/ocaml-4.02.3::gentoo'`. * The complete build log is located at '/var/tmp/portage/dev-lang/ocaml-4.02.3/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/dev-lang/ocaml-4.02.3/temp/environment'. * Working directory: '/var/tmp/portage/dev-lang/ocaml-4.02.3/work/ocaml-4.02.3' * S: '/var/tmp/portage/dev-lang/ocaml-4.02.3/work/ocaml-4.02.3' * Messages for package dev-lang/ocaml-4.02.3: * Ocaml generates its own native asm, you're using a PIE compiler * We have appended -nopie to ocaml build options * because linking an executable with pie while the objects are not pic will not work * ERROR: dev-lang/ocaml-4.02.3::gentoo failed (compile phase): * emake failed * * If you need support, post the output of `emerge --info '=dev-lang/ocaml-4.02.3::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-lang/ocaml-4.02.3::gentoo'`. * The complete build log is located at '/var/tmp/portage/dev-lang/ocaml-4.02.3/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/dev-lang/ocaml-4.02.3/temp/environment'. * Working directory: '/var/tmp/portage/dev-lang/ocaml-4.02.3/work/ocaml-4.02.3' * S: '/var/tmp/portage/dev-lang/ocaml-4.02.3/work/ocaml-4.02.3' Using musl stage3: http://distfiles.gentoo.org/experimental/amd64/musl/stage3-amd64-musl-hardened-20151104.tar.bz2 Full build log and env attached. Reproducible: Always (same result with MAKEOPTS="-j1")
Created attachment 417176 [details] emerge --info '=dev-lang/ocaml-4.02.3::gentoo'
Created attachment 417178 [details] emerge -pqv '=dev-lang/ocaml-4.02.3::gentoo'
Created attachment 417180 [details] /var/tmp/portage/dev-lang/ocaml-4.02.3/temp/environment
USE="$USE -ocamlopt" emerge dev-lang/ocaml compiles OK USE="$USE ocamlopt" emerge dev-lang/ocaml fails
This blocks net-misc/unison because: The following USE changes are necessary to proceed: (see "package.use" in the portage(5) man page for more details) # required by net-misc/unison-2.48.3::gentoo # required by unison (argument) >=dev-lang/ocaml-4.02.3 ocamlopt
Changing "emake world" to "emake world -n" in src_compile() of /usr/portage/dev-lang/ocaml/ocaml-4.02.3.ebuild results in a different failure: ../byterun/caml/instruct.h > opnames.ml ../boot/ocamlrun ../boot/ocamlc -nostdlib -I ../boot -c -strict-sequence -w +27+32..39 -warn-error A -safe-string -I ../utils -I ../parsing -I ../typing -I ../bytecomp -I ../asmcomp -I ../driver -I ../toplevel opnames.ml ../boot/ocamlrun ../boot/ocamlc -nostdlib -I ../boot -c -strict-sequence -w +27+32..39 -warn-error A -safe-string -I ../utils -I ../parsing -I ../typing -I ../bytecomp -I ../asmcomp -I ../driver -I ../toplevel ../utils/tbl.mli make[4]: *** No rule to make target '../bytecomp/opcodes.cmo', needed by 'dumpobj.cmo'. Stop. make[4]: Leaving directory '/var/tmp/portage/dev-lang/ocaml-4.02.3/work/ocaml-4.02.3/tools' Makefile:720: recipe for target 'ocamltools' failed make[3]: *** [ocamltools] Error 2 make[3]: Leaving directory '/var/tmp/portage/dev-lang/ocaml-4.02.3/work/ocaml-4.02.3' Makefile:206: recipe for target 'coreall' failed make[2]: *** [coreall] Error 2 make[2]: Leaving directory '/var/tmp/portage/dev-lang/ocaml-4.02.3/work/ocaml-4.02.3' Makefile:129: recipe for target 'all' failed make[1]: *** [all] Error 2 make[1]: Leaving directory '/var/tmp/portage/dev-lang/ocaml-4.02.3/work/ocaml-4.02.3' Makefile:137: recipe for target 'world' failed make: *** [world] Error 2 * ERROR: dev-lang/ocaml-4.02.3::gentoo failed (compile phase): * emake failed full build log attached as ocaml-4.02.3_build.log_with_emake_world_-n
Created attachment 417254 [details] build.log with "emake world -n"
This appears to be musl specific, I can not reproduce it on a very similar (same config files, different CHOST) glibc system.
How does the "Configuration summary" look on the glibc system? Are shared libraries also not supported? I've just tried compiling on musl (outside of emerge). The configure output contains dlopen() found. Dynamic loading of shared libraries is supported. mmap() found. I think it would be good to investigate why you don't have the second line.
Created attachment 417262 [details, diff] Proposed patch against ocaml-4.02.3 The configure script has some intricate knowledge about which targets support shared libraries but has not heard that non-gnu linux might support them as well... Please try compiling with this patch.
Same error with patch applied (I manually verified that /var/tmp/portage/dev-lang/ocaml-4.02.3/work/ocaml-4.02.3/configure was properly patched in src_prepare()). The good news is ./configure now shows the 'Dynamic loading of shared libraries is supported' line. setlocale() and <locale.h> found. dlopen() found. Dynamic loading of shared libraries is supported. mmap() found. pwrite() found stat() supports nanosecond precision. gethostbyname_r() found (with 6 arguments). gethostbyaddr_r() found (with 8 arguments). mkstemp() found nice() found Replay debugger supported. System stack overflow can be detected. POSIX threads library supported. Options for linking with POSIX threads: -lpthread sigwait() found Bytecode threads library supported. [WARNING] Cannot compile X11 program. [WARNING] X11 not found, the "graph" library will not be supported. [WARNING] BFD library not found, 'objinfo' will be unable to display info on .cmxs files. Assembler supports CFI ** Configuration summary ** Directories where OCaml will be installed: binaries.................. /usr/bin standard library.......... /usr/lib/ocaml manual pages.............. /usr/share/man (with extension .1) Configuration for the bytecode compiler: C compiler used........... x86_64-gentoo-linux-musl-gcc options for compiling..... -march=native -O2 -pipe -O -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT options for linking....... -Wl,-O1 -Wl,--as-needed -nopie -Wl,-E -lm -lcurses -lpthread shared libraries are supported options for compiling..... -O -fPIC -march=native -O2 -pipe -O -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT command for building...... x86_64-gentoo-linux-musl-gcc -shared -Wl,-O1 -Wl,--as-needed -nopie -o lib.so -Wl,-rpath,/a/path objs Configuration for the native-code compiler: hardware architecture..... amd64 OS variant................ linux C compiler used........... x86_64-gentoo-linux-musl-gcc options for compiling..... -march=native -O2 -pipe -O -D_FILE_OFFSET_BITS=64 -D_REENTRANT options for linking....... -Wl,-O1 -Wl,--as-needed -nopie -lm assembler ................ x86_64-gentoo-linux-musl-as preprocessed assembler ... x86_64-gentoo-linux-musl-gcc -c assembler supports CFI ... yes with frame pointers....... no naked pointers forbidden.. no native dynlink ........... true profiling with gprof ..... supported Source-level replay debugger: supported Additional libraries supported: unix str num dynlink bigarray systhreads threads Configuration for the "num" library: target architecture ...... amd64 (asm level 1) The "graph" library: not supported ** OCaml configuration completed successfully ** full build log attached as ocaml-4.02.3_build.log_with_emake_world_-n_and_patch_417262
Created attachment 417310 [details] build.log with "emake world -n" and patch 417262
Is there any reasoning for changing "emake world" to "emake world -n"? I guess it just breaks everything.
Yep! I thought it was just extra verbose but no: man make says "Print the commands that would be executed, but do not execute them (except in certain circumstances).". Oops. Your patch fixes it. I double checked. Without -n, the compile fails with the orig "sh: -W: invalid option".
Submitted the patch upstream: https://github.com/ocaml/ocaml/pull/558
The patch is now upstream: https://github.com/ocaml/ocaml/commit/2ddcd4de9b5f4616f9790a26e6e56489366c9137 Could it be added to the in tree ebuilds?
(In reply to Felix Janda from comment #16) > The patch is now upstream: > > https://github.com/ocaml/ocaml/commit/ > 2ddcd4de9b5f4616f9790a26e6e56489366c9137 > > Could it be added to the in tree ebuilds? That will be in 4.05 I think. I'd prefer not touching anything in 4.04 now that it is stable.
Is this still an issue?