OCaml compiler build failure - ocaml

I checkout the latest OCaml source code and try to build on my OS X 10.10 machine
with gcc 4.9.2. I use the following command as suggested here.
$ ./configure && make world
Build gets no error but when I tried the compiler I just build by doing $ ./ocamlc, I get the following error:
Fatal error: unknown C primitive `caml_add_debug_info'

I believe this happens when you use the old bytecode interpreter to run the new compiler. Make sure you're using the new bytecode interpreter (ocamlrun).

Related

C/C++ Cyanogenmod How to compile kernel using different version of toolchain?

I am trying to compile kernel for Cyanogenmod 13. I am getting error
ERROR: modpost: Found 2 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
To build the kernel despite the mismatches, build with:
'make CONFIG_NO_ERROR_ON_MISMATCH=y'
(NOTE: This is not recommended)
I read it here. That i need to compile my kernel using 4.7.
How can i choose the version of toolchain during cyanogenmod build ??
I believe you need to setup gcc version 4.7 and use CC variable to set it as a compiler. E.g. make target CC=/bin/gcc4.7
More information here and here.
Thanks to #nopasara and his valuable comment.
So i did little research further and discovered that the kernel is compatiable with arm-eabi tool chain not arm-linux-androideabi toolchain. So here is the command i used
export PATH=$PATH:~/android/system/prebuilts/gcc/linux-x86/arm/arm-linux-eabi-4.7/bin/ && export ARCH=arm && export SUBARCH=arm && export CROSS_COMPILE=arm-linux-eabi- && make msm8226_defconfig O=~/android/system/out/target/product/E6790/obj/KERNEL_OBJ
and
make O=~/android/system/out/target/product/E6790/obj/KERNEL_OBJ zImage -j4
To do with this Cyanogenmod add following line to your BoardConfig.mk
TARGET_KERNEL_CROSS_COMPILE_PREFIX := arm-eabi-
and either use
export TARGET_LEGACY_GCC_VERSION=4.7
Or edit ~/android/system/build/core/combo/TARGET_linux-arm.mk and set version in
$(combo_2nd_arch_prefix)TARGET_LEGACY_GCC_VERSION := 4.7

How to cross compile alljoyn standard core and service framework?

I have one wifi camera with armv5 processor and want to cross compile and alljoyn standard core, service framework and want to make notification producer application.
But I am stuck while cross compiling alljoyn. I am compiling alljoyn with codesourcery arm cross compiler with gcc version 4.3.3
Initially I have used same command, used to compile standard core and service framework. Just added CROSS_COMPILE and CPU flag for arm and crosscompiler. Here is the command used, compilation process fails with some error related to -std=c++11
command:
scons BINDINGS=cpp WS=off BT=off ICE=off OS=linux CPU=arm CROSS_COMPILE="/home/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-" SERVICES="about,notification,controlpanel,config,onboarding,sample_apps"
error:
....
prints for copying header files to 'build' dir
....
/* On compilation of first cc file */
cc1plus: error: unrecognized command line option "-std=c++11"
scons: ***
[build/linux/arm/debug/obj/services/config/cpp/samples/ConfigClientSample/ConfigClientMain.o] Error 1
After this failure I found following link,
https://wiki.allseenalliance.org/develop/building_and_running
It says that we can compile alljoyn for openwrt on cross compiling. So I have prepared and executed following command:
scons BINDINGS=cpp WS=off BT=off ICE=off OS=openwrt CPU=openwrt TARGET_PATH=/home/CodeSourcery/Sourcery_G++_Lite/bin/ TARGET_CC=arm-none-linux-gnueabi-gcc TARGET_CFLAGS="-std=c++0x" TARGET_CPPFLAGS="-std=c++0x" TARGET_CXX=arm-none-linux-gnueabi-g++ TARGET_LINK=arm-none-linux-gnueabi-gcc TARGET_LINKFLAGS="" TARGET_AR="" TARGET_RANLIB="" STAGING_DIR=/usr/lib/x86_64-linux-gnu SERVICES="about,notification,controlpanel,config,onboarding,sample_apps"
But getting error before compilation starts,
scons: Reading SConscript files ...
Checking c++ compiler support for -std=c++11 flag... no
Checking c++ compiler support for -std=c++0x flag... no
*** Compiler too old to build AllJoyn. Aborting.
So here is my questions,
1. Is it possible to cross compile alljoyn standard client and services without using openwrt?
2. Does cross compiling using openwrt affect any functionality of alljoyn?
3. What should I do to overcome c++11/c++0x error, should I find new gcc version for cross compiling my code.
Please let me know if some one has cross compiled alljoyn standard core and service framework for any platform, please provide me steps/command for that.
Thanks in advance.
Pratik
These steps to cross compile AllJoyn worked for me.
http://itisprakash.blogspot.com/2016/05/cross-compile-alljoyn-for-raspberrypi.html

error: invalid argument '-std=gnu99' not allowed with 'C++/ObjC++'

I am trying to compile C library called DevIL on OSX Maverick with Clang.I ran configure file then 'make' .I am getting the following error:
error: invalid argument '-std=gnu99' not allowed with 'C++/ObjC++'
Does it mean I am trying to compile C code with C++ compiler?How can I tell Clang to compile it as C lib?
My standard answer to such problems is to use MacPorts. Once MacPorts is installed, it's as simple as:
$ sudo port install libdevil

Error in compiling when installing Stan for R and when using Rcpp

I need to install Rstan for a data analysis class. The instructions are posted here http://code.google.com/p/stan/wiki/RStanGettingStarted. I'm running Mac OS 10.5.8 and R 2.15.1 GUI 1.52 Leopard build 32-bit (6188). I just installed Xcode version 3.1.4, the Xcode c++ compiler that is compatible with leopard (I had to get a mac developer account to do this).
Per the Stan installation instruction, I entered the following code to see if my compiler was working:
library(inline)
library(Rcpp)
src <- '
std::vector<std::string> s;
s.push_back("hello");
s.push_back("world");
return Rcpp::wrap(s);
'
hellofun <- cxxfunction(body = src, includes = '', plugin = 'Rcpp', verbose = FALSE)
cat(hellofun(), '\n')
It returns the following error:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created!
Library/Frameworks/R.framework/Versions/2.15/Resources/library/
Rcpp/include/Rcpp/internal/export.h: In function ‘void
Rcpp::internal::export_range__dispatch(SEXPREC*, InputIterator,
Rcpp::traits::r_type_primitive_tag)’:
/Library/Frameworks/R.framework/Versions/2.15/Resources/
library/Rcpp/include/Rcpp/internal/export.h:56: internal
compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for
instructions.
make: *** [file795214e66510.o] Error 1
In addition: Warning message:
running command '/Library/Frameworks/R.framework/Resources/bin/
R CMD SHLIB file795214e66510.cpp 2>
file795214e66510.cpp.err.txt' had status 1
When I try to install stan:
install.packages('rstan', type = 'source') ]
I get this warning:
Warning message:
In install.packages("rstan", type = "source") :
installation of package ‘rstan’ had non-zero exit status
I have no idea how C++ works. All of my coding experience is in R and has not before required compiling into C++. I've been trying really hard to figure out what's wrong for the last 4 hours or so, googling these error messages over and over without much luck. Any help would be greatly appreciated and would also help about 10 other students in my class who are having identical or analogous problems. Thank you very, very much.
This looks to me like an issue with the installation of your C++ compiler or with your installation of the Rcpp package, rather than an issue with the rstan package. However, if g++ is causing an intractable problem for you, an alternative is the clang compiler, which should work with Rcpp and rstan if you create $HOME/.R/Makevars with these two lines
CC=clang
CXX=clang++
As mentioned in another answer, the first step is to get Rcpp working on your Mac (i.e,. at least pass the hello world example).
A similar issue for Rcpp previously:
https://stat.ethz.ch/pipermail/r-sig-mac/2010-July/007574.html
In addition, from this webpage http://useyourloaf.com/blog/2011/03/21/compiler-options-in-xcode-gcc-or-llvm.html, it seems that gcc 4.2 and 4.0 are both in Xcode 3.14 (not sure as it does not say it's 3.14). So try to make sure gcc 4.2.1 is used by R is important. Executing the following in a terminal will show what is the current version of gcc.
$ g++ -v

llvm-gcc Error:Incompatible plugin

I am new to llvm.When I try to compile c programs using llvm-gcc i get following error:
$ llvm-gcc test.c
Incompatible plugin version
cc1: error: Fail to initialize plugin /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/plugin/dragonegg.so
I am using ubuntu-11.04,and llvm-gcc-4.5
Please help.
Thanks
That means your dragonegg install is broken; compile your own, and/or complain to Ubuntu.
You can use dpkg-buildpackage to build your own llvm-gcc-4.5 and dragonegg debs. Another thing you may need to remember is changing the version in the debian/changelog file.