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
Related
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).
How do I find out the version of GNU Radio that I have installed?
I would like the use their messaging libraries, but they are available on newer versions of gnuradio only and for some reason I'm getting a compilation error when I try to use the following code:
message_port_register_out(pmt::mp("out_message"));
I get the following error on compilation:
error: ‘message_port_register_out’ was not declared in this scope
It's supposed to be part of the gr_basic_block, which all blocks inherit from, but it's not compiling.
You can get the version number using python.
from gnuradio import gr
gr.version()
If you installed the complete package - not only the library - in a terminal window:
$ gnuradio-companion --version
GNU Radio Companion 3.7.2.1
or
$ gnuradio-config-info --version
3.7.2.1
According to the docs, message_port_register_out is a member of gr_basic_block. Based on the compilation error you have posted and the code snippet, I'd assume you need an instance to work with. It's hard to tell without more context however.
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
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.
I have a C++ routine that I would like to pack in a Simulink S-Function. This C++ routines calls other routines that are in several other C++ files.
I could manage to have everything compiled (i.e. the mexglx file is generated) using the legacy_code tool. However, the following warning is issued:
Warning: You are using gcc version "4.4.4-14ubuntu5)". The earliest gcc version
supported with mex is "4.1". The latest version tested for use with mex
is "4.2". To download a different version of gcc, visit http://gcc.gnu.org
The problem arises when I try to generate the S-Function block by issuing the command:
legacy_code('slblock_generate', def);
At this point, the following error mentioning the GLIBCXX version is raised:
??? Error using ==> iAddSfunctionBlock at 183
Error due to multiple causes.
Error in ==>
/opt/matlab/toolbox/simulink/simulink/+legacycode/#LCT/generateslblock.p>
generateslblock at 55
Error in ==> /opt/matlab/toolbox/simulink/simulink/legacy_code.p>legacy_code at
160
Caused by:
Error using ==> iAddSfunctionBlock at 183
Invalid MEX-file 'sfun_vectorRotation_b.mexglx':
/opt/matlab/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6: version
`GLIBCXX_3.4.11' not found (required by sfun_vectorRotation_b.mexglx).
Error using ==> iAddSfunctionBlock at 183
Error while obtaining sizes from MEX S-function 'sfun_vectorRotation_b' in
'untitled1/sfun_vectorRotation_b'. MATLAB error message:
Invalid MEX-file 'sfun_vectorRotation_b.mexglx':
/opt/matlab/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6: version
`GLIBCXX_3.4.11' not found (required by sfun_vectorRotation_b.mexglx).
Honestly I am a bit lost at this point. I do not know if downgrading the g++ compilator would be enough or if I have to do some other things. Do you have a possible solution for this issue?
I am using Matlab 2009b in an Ubuntu 10.10 OS, and the g++ version is:
g++ (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
Thanks a lot in advance
Miquel
Finally I could solve the problem myself. Just download and install (via ./configure, make and make install) a supported version of gcc (anyone between 4.1 and 4.2 will do). In my case I tried gcc-4.2 and it works fine.
Thanks anyway!
Miquel