I am trying to learn Ocaml using Real World Ocaml. I installed ocaml using MacPorts. Now, I am trying to install ocaml-core-extended:
$ sudo port install ocaml-core-extended
but it fails while installing dependency ocaml-bin-prot:
Here is the relevant part from the build log:
:notice:build ---> Building ocaml-bin-prot
:debug:build Executing org.macports.build (ocaml-bin-prot)
:debug:build Environment: CPATH='/opt/local/include' CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_ocaml-bin-prot/ocaml-bin-prot/work/.CC_PRINT_OPTIONS' LIBRARY_PATH='/opt/local/lib' CC_PRINT_OPTIONS='YES' MACOSX_DEPLOYMENT_TARGET='10.9'
:debug:build Assembled command: 'cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_ocaml-bin-prot/ocaml-bin-prot/work/bin_prot-108.00.02" && /opt/local/bin/ocaml setup.ml -build'
:debug:build Executing command line: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_ocaml-bin-prot/ocaml-bin-prot/work/bin_prot-108.00.02" && /opt/local/bin/ocaml setup.ml -build
:info:build getconf: no such configuration parameter `LFS64_CFLAGS'
:info:build ocamlfind ocamldep -pp 'cpp -traditional -undef -w -DARCH_SIXTYFOUR' -package unix -package bigarray -modules lib/type_class.mli > lib/type_class.mli.depends
:info:build + ocamlfind ocamldep -pp 'cpp -traditional -undef -w -DARCH_SIXTYFOUR' -package unix -package bigarray -modules lib/type_class.mli > lib/type_class.mli.depends
:info:build File "lib/type_class.mli", line 68, characters 16-20:
:info:build Error: Syntax error
:info:build Command exited with code 2.
:info:build E: Failure("Command '/opt/local/bin/ocamlbuild lib/libbin_prot_stubs.a lib/dllbin_prot_stubs.so lib/bin_prot.cma lib/bin_prot.cmxs lib/bin_prot.cmxa lib/bin_prot.a syntax/pa_bin_prot.cma -tag debug' terminated with error code 10")
:info:build Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_ocaml-bin-prot/ocaml-bin-prot/work/bin_prot-108.00.02" && /opt/local/bin/ocaml setup.ml -build
:info:build Exit code: 1
:error:build org.macports.build for port ocaml-bin-prot returned: command execution failed
I looked at the lib/type_class.mli and I have no clue why there would be a syntax error there. It is just a macro expansion. I would like my bug report to be a little better than "here's a problem".
So, has anyone encountered this failure? Any hints?
$ uname -a
Darwin zzzz.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013;
root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64
$ ocaml -version
The OCaml toplevel, version 4.01.0
$ cpp --version
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
I am assuming the specific problems I had are more related to the transition to Mavericks than anything else.
In the mean time, I decided to install opam with ocamlbrew, and everything worked very smoothly.
I was able to set up my environment following the instructions.
What is the version of core library? Looks like the library is not updated for OCaml 4.01, probably the port is old and haven't catched up yet..
Related
I currently have Fedora 26 installed, and I have installed the following packages:
sudo dnf install opam ocaml gcc gcc-c++ m4 make ocamldoc sqlite-devel libcurl-devel fuse-devel zlib-devel ocaml-camlp4-devel redhat-rpm-config
This is the error I currently get trying to install utop:
#=== ERROR while installing lwt.2.7.1 =========================================#
# opam-version 1.2.2
# os linux
# command make build
# path /home/z/.opam/system/build/lwt.2.7.1
# compiler system (4.02.3)
# exit-code 2
# env-file /home/z/.opam/system/build/lwt.2.7.1/lwt-21869-a00279.env
# stdout-file /home/z/.opam/system/build/lwt.2.7.1/lwt-21869-a00279.out
# stderr-file /home/z/.opam/system/build/lwt.2.7.1/lwt-21869-a00279.err
### stdout ###
# ./setup.exe -build
# ocamlfind ocamlopt -package unix -package ocamlbuild -linkpkg -package cppo_ocamlbuild myocamlbuild.ml /usr/lib64/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
# + ocamlfind ocamlopt -package unix -package ocamlbuild -linkpkg -package cppo_ocamlbuild myocamlbuild.ml /usr/lib64/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
# File "myocamlbuild.ml", line 1:
# Error: Files /home/z/.opam/system/lib/cppo_ocamlbuild/ocamlbuild_cppo.cmxa
# and /usr/lib64/ocaml/ocamlbuild/ocamlbuildlib.cmxa
# make inconsistent assumptions over implementation Ocamlbuild_plugin
# Command exited with code 2.
# Makefile:33: recipe for target 'build' failed
### stderr ###
# W: Cannot find source file matching module 'Lwt_unix' in library lwt-unix.
# W: Use InterfacePatterns or ImplementationPatterns to define this file with feature "source_patterns".
# W: Cannot find source file matching module 'Lwt_unix' in library lwt-unix.
# W: Use InterfacePatterns or ImplementationPatterns to define this file with feature "source_patterns".
# E: Failure("Command ''/usr/bin/ocamlbuild' src/core/lwt.cma src/core/lwt.cmxa src/core/lwt.a src/core/lwt.cmxs src/logger/lwt-log.cma src/logger/lwt-log.cmxa src/logg$r/lwt-log.a src/logger/lwt-log.cmxs src/unix/liblwt-unix_stubs.a src/unix/dlllwt-unix_stubs.so src/unix/lwt-unix.cma src/unix/lwt-unix.cmxa src/unix/lwt-unix.a src/unix$lwt-unix.cmxs src/simple_top/lwt-simple-top.cma src/simple_top/lwt-simple-top.cmxa src/simple_top/lwt-simple-top.a src/simple_top/lwt-simple-top.cmxs src/react/lwt-reac$.cma src/react/lwt-react.cmxa src/react/lwt-react.a src/react/lwt-react.cmxs src/preemptive/lwt-preemptive.cma src/preemptive/lwt-preemptive.cmxa src/preemptive/lwt-pre$mptive.a src/preemptive/lwt-preemptive.cmxs src/ppx/ppx.cma src/ppx/ppx.cmxa src/ppx/ppx.a src/ppx/ppx.cmxs src/ppx/ppx_lwt_ex.native doc/examples/unix/logging.native d$c/examples/unix/relay.native doc/examples/unix/parallelize.native -use-ocamlfind -plugin-tags 'package(cppo_ocamlbuild)' -tag debug' terminated with error code 10")
# make: *** [build] Error 1
What should I do?
Thank you!
Opam's "system compiler", that is used by default on opam init, is an hybrid setting in which the packages are installed in the local opam sandbox, but the compiler from the system (/usr) is used. See the opam switch command to use a sandbox with a compiler compiled by opam instead, or to switch back.
Your example shows that you are using a system compiler, as provided by dnf install ocaml ; opam is consequently supposed to use e.g. /usr/bin/ocamlopt, but installed software and libs from ~/.opam/system/{bin,lib}.
What is supposed to happen is that lwt depends on ocamlbuild and ocamlfind, which opam installs first; then PATH is set so that ~/.opam/system/bin/ is first and these installed binaries are always chosen. It's where something must be going wrong, because the end of the log shows that /usr/bin/ocamlbuild was called.
It's difficult to know what without more details, and I failed to reproduce on a Fedora 25 container. But you could:
check if ocamlbuild and ocamlfind were properly installed by opam, and the presence of ~/.opam/system/bin/ocaml{find,build}
check if there is any global or environment configuration of ocamlfind that could interfere (which ocamlfind; ocamlfind printconf; opam config exec -- ocamlfind printconf).
check the linked environment file: /home/z/.opam/system/build/lwt.2.7.1/lwt-21869-a00279.env to see if PATH is properly defined
run with -v to see all commands issued by opam
Of course, as mentionned in the comments above, using a standard (i.e. non-system) switch, which includes its own OCaml compiler, would work around the issue. It takes a tad longer to compile though.
I'm trying to build tensorflow on Ubuntu 14.04 LTS with python 2.7, no GPU. when I run the following command on terminal followed from this tutorial:
bazel build tensorflow/examples/image_retraining:retrain
it says failed to build with log:
ERROR: /home/yuan/tensorflow_source/tensorflow/tensorflow/python/BUILD:1826:1: Linking of rule '//tensorflow/python:_pywrap_tensorflow.so' failed: gcc failed: error executing command
(cd /home/yuan/.cache/bazel/_bazel_yuan/e5b8b6538ba16bbae5b1e0f5c26b7a12/execroot/tensorflow && \
exec env - \
/usr/bin/gcc -shared -o bazel-out/local-fastbuild/bin/tensorflow/python/_pywrap_tensorflow.so -Wl,--version-script tensorflow/tf_version_script.lds -pthread -Wl,-no-as-needed -B/usr/bin -B/usr/bin -pass-exit-codes '-Wl,--build-id=md5' '-Wl,--hash-style=gnu' -Wl,-S -Wl,#bazel-out/local-fastbuild/bin/tensorflow/python/_pywrap_tensorflow.so-2.params): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
bazel-out/local-fastbuild/bin/tensorflow/core/libversion_lib.a(version_info.pic.o): In function `tf_git_version()':
version_info.cc:(.text+0x0): multiple definition of `tf_git_version()'
bazel-out/local-fastbuild/bin/tensorflow/core/libframework_internal.lo(version_info.pic.o):version_info.cc:(.text+0x0): first defined here
bazel-out/local-fastbuild/bin/tensorflow/core/libversion_lib.a(version_info.pic.o): In function `tf_compiler_version()':
version_info.cc:(.text+0xd): multiple definition of `tf_compiler_version()'
bazel-out/local-fastbuild/bin/tensorflow/core/libframework_internal.lo(version_info.pic.o):version_info.cc:(.text+0xd): first defined here
collect2: error: ld returned 1 exit status
Target //tensorflow/examples/image_retraining:retrain failed to build
INFO: Elapsed time: 52.885s, Critical Path: 34.63s
Here's my build environment:
OS: Ubuntu 14.04 LTS 64 bit with RAM 12Gib
gcc version: 4.8.4
python version: 2.7.6
bazel version: 0.3.2
git version of tensorflow souce: v0.11.0rc0-1541-g3737ac3
Does anyone have idea to fix this error? Thanks a lot!
#David thanks for your help, it seems my ./configure result is not as expected.
I finally build successful by the following steps
sync tensorflow source to HEAD
run ./configure again, if have any error, refer to this.
run the build command again
bazel build tensorflow/examples/image_retraining:retrain
And my build result will have no error.
I'm attempting to manually compile Boost on Ubuntu Linux 12.04. However, it seems to be attempting to cross-compile, even though I haven't told it to.
These are the commands I used:
git clone https://github.com/boostorg/boost
git checkout boost-1.60.0
git submodule init
git submodule update
cd tools/build/
./bootstrap.sh
sudo ./b2 install --prefix=/usr/local/
cd ../../
sudo b2 -j12 --build-dir=/tmp/build_boost --build-type=complete toolset=gcc address-model=64 architecture=x86 threading=multi runtime-link=shared stage --layout=tagged
The last command fails, giving various compilation errors, all similar to the first one shown below:
gcc.compile.c++ /tmp/build_boost/boost/bin.v2/libs/system/build/gcc-arm/release/address-model-64/architecture-x86/threading-multi/error_code.
arm-linux-gnueabi-g++: error: unrecognized command line option ‘-m64’
"arm-linux-gnueabi-g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pedantic -pthread -fPIC -m64 -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DNDEBUG -I"." -c -o "/tmp/build_boost/boost/bin.v2/libs/system/build/gcc-arm/release/address-model-64/architecture-x86/threading-multi/error_code.o" "libs/system/src/error_code.cpp"
...failed gcc.compile.c++ /tmp/build_boost/boost/bin.v2/libs/system/build/gcc-arm/release/address-model-64/architecture-x86/threading-multi/error_code.o...
How do I make sure it uses the native g++ (for x86-64)?
Found the problem: there was a user-config.jam in my home directory (probably stored temporarily during cross-compile tests). I only found out because removing all arm-linux-gnueabi-* files from /usr/bin/ led to the following error:
/home/janito/boost/tools/build/src/tools/gcc.jam:83: in gcc.init from module gcc
error: toolset gcc initialization:
error: provided command 'arm-linux-gnueabi-g++' not found
error: initialized from /home/janito/user-config.jam:45
/home/janito/boost/tools/build/src/build/toolset.jam:43: in toolset.using from module toolset
/home/janito/boost/tools/build/src/build/project.jam:1052: in using from module project-rules
/home/janito/user-config.jam:45: in modules.load from module user-config
/home/janito/boost/tools/build/src/build-system.jam:249: in load-config from module build-system
/home/janito/boost/tools/build/src/build-system.jam:389: in load-configuration-files from module build-system
/home/janito/boost/tools/build/src/build-system.jam:524: in load from module build-system
/home/janito/boost/tools/build/src/kernel/modules.jam:295: in import from module modules
/home/janito/boost/tools/build/src/kernel/bootstrap.jam:139: in boost-build from module
/home/janito/boost/boost-build.jam:17: in module scope from module
At least the solution was simply to remove the ~/user-config.jam file.
Posting it as an answer so that it can be useful in the future if someone runs into the same situation.
I receive the following error while trying to install core with opam.
==== ERROR [while installing core.109.42.00] ====
# opam-version 1.0.0
# os linux
# command make
# path /home/cesally/.opam/4.01.0/build/core.109.42.00
# exit-code 2
# env-file /home/cesally/.opam/4.01.0/build/core.109.42.00/core-5f1023.env
# stdout-file /home/cesally/.opam/4.01.0/build/core.109.42.00/core-5f1023.out
# stderr-file /home/cesally/.opam/4.01.0/build/core.109.42.00/core-5f1023.err
### stdout ###
...[truncated]
/home/cesally/.opam/4.01.0/bin/ocamlopt.opt unix.cmxa -I /home/cesally/.opam/4.01.0/ lib/ocaml/ocamlbuild /home/cesally/.opam/4.01.0/lib/ocaml/ocamlbuild/ocamlbuildlib .cmxa myocamlbuild.ml /home/cesally/.opam/4.01.0/lib/ocaml/ocamlbuild/ocamlbuild.c mx -o myocamlbuild
ocamlfind ocamlc -I lib -package core_kernel -c lib/backtrace_stubs.c
mv backtrace_stubs.o lib/backtrace_stubs.o
ocamlfind ocamlc -I lib -package core_kernel -c lib/bigstring_stubs.c
+ ocamlfind ocamlc -I lib -package core_kernel -c lib/bigstring_stubs.c
lib/bigstring_stubs.c: In function ‘bigstring_recvmmsg_assume_fd_is_nonblocking_ stub’:
lib/bigstring_stubs.c:592:18: error: array type has incomplete element type
lib/bigstring_stubs.c:639:7: warning: implicit declaration of function ‘recvmmsg ’ [-Wimplicit-function-declaration]
lib/bigstring_stubs.c:592:18: warning: unused variable ‘hdrs’ [-Wunused-variable ]
Command exited with code 2.
### stderr ###
/tmp/cc5m08R9.o: In function `main':
test_recvmmsg.c:(.text+0x24): warning: recvmmsg is not implemented and will alwa ys fail
E: Failure("Command ''/home/cesally/.opam/4.01.0/bin/ocamlbuild' lib/libcore_stubs .a lib/dllcore_stubs.so lib/core.cma lib/core.cmxa lib/core.a lib/core.cmxs top/ core_top.cma top/core_top.cmxa top/core_top.a top/core_top.cmxs -tag debug' term inated with error code 10")
make: *** [build] Error 1
'opam install core' failed.
I can't quite understand this error message, can any ocaml hackers shed some light?
I am on ubuntu, without admin rights. Thanks
Edit: g++ version is 4.6.3
Looks like the core configure script and the C compiler are in disagreement on whether recvmmsg is available on your system. I guess it is a bug in core. First, try the latest version (at time of this writing it is 110.something), and if it is not fixed yet report it to core authors.
Hi guys i'm trying to install rrdtool (for PYTHON 2.7) on my windows 7 system , i install it using this command line.
python setup.py install build --compiler=mingw32
it gives me the following output:
running install
running build
running build_ext
running build_configure
building 'rrdtoolmodule' extension
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Irrdtool-1.4.7/src -IC:\Python2
7\include -IC:\Python27\PC -c rrdtool-1.4.7/bindings/python/rrdtoolmodule.c -o b
uild\temp.win32-2.7\Release\rrdtool-1.4.7\bindings\python\rrdtoolmodule.o
cc1.exe: error: unrecognized command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1
i have tried many solutions to solve this, but had no success.i'm using mingw version 4.6.2
can anyone pls help me .
See this answer: https://stackoverflow.com/a/6035864/1516291
you need to edit distutils\cygwinccompiler.py in your Python directory to remove all instances of -mno-cygwin
good luck