Error when compiling llvm in FreeBSD 8.4 - llvm

I am trying to build LLVM from source in FreeBSD 8.4.
Here are the steps i carried out
Downloaded the source from http://llvm.org/releases/3.8.0/llvm-3.8.0.src.tar.xz
Extracted the source into a folder.
Created a build directory and inside it ran $ cmake
../llvm-3.8.0.src
Started the build using $cmake --build .
It throws the following error
/home/spangeni/llvm/llvm-3.8.0.src/lib/TableGen/TGLexer.cpp: In member function 'llvm::tgtok::TokKind llvm::TGLexer::LexNumber()':
/home/spangeni/llvm/llvm-3.8.0.src/lib/TableGen/TGLexer.cpp:393:48: error: 'strtoll' was not declared in this scope
CurIntVal = strtoll(NumStart, nullptr, 16);
^
/home/spangeni/llvm/llvm-3.8.0.src/lib/TableGen/TGLexer.cpp:398:60: error: 'strtoull' was not declared in this scope
CurIntVal = (int64_t)strtoull(NumStart, nullptr, 16);
^
/home/spangeni/llvm/llvm-3.8.0.src/lib/TableGen/TGLexer.cpp:414:47: error: 'strtoll' was not declared in this scope
CurIntVal = strtoll(NumStart, nullptr, 2);
^
/home/spangeni/llvm/llvm-3.8.0.src/lib/TableGen/TGLexer.cpp:429:44: error: 'strtoll' was not declared in this scope
CurIntVal = strtoll(TokStart, nullptr, 10);
GCC Version = 4.9.2
CMAKE version = 3.2.3
I also tried to include stdlib.h in the file llvm-3.8.0.src/lib/TableGen/TGLexer.cpp. This din't help.
Is there any configuration I am missing ?

The ports system exists for a good reason - many (pretty much all nontrivial) software needs patches and build tweaks to build and work properly. So my advice would be just that: use Ports.
Not sure if ports actually supports FreeBSD 8.4, though. Do you have any particular reason to use such an old release?

Related

Is it possible to use Kotlin Native on macOS 10.12?

I'm trying to port a simple Go macOS application over to Kotlin Native. After struggling with various errors I decided to take a step back, and have a look at the official examples provided with Kotlin Native.
I found a basic OpenGL example here:
https://github.com/JetBrains/kotlin-native/tree/master/samples/opengl
But so far I haven't been able to get this to compile.
I tried downloading the complete sources for Kotlin, but that wont build. I followed a few suggestions generated at build time, including the change to 'ignoreXcodeVersionCheck' and downloading prebuilt binaries for the compiler, but at this point I'm wondering if this just isn't supported by my environment? I do understand that this is all experimental.
I've attached a sample of errors below, but I'm not sure whats relevant.
Question: Does anyone else have this setup / environment working please? can I expect to get it working?
macos 10.12.4, kotlin 1.3.11, xcode 8.2.1
.konan/dependencies/clang-llvm-6.0.1-darwin-macos/include/c++/v1/cmath:551:28: error: expected a qualified name after 'typename'
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
.konan/dependencies/clang-llvm-6.0.1-darwin-macos/include/c++/v1/cstddef:44:15: fatal error: 'stddef.h' file not found
#include_next <stddef.h>
A problem occurred evaluating root project 'kotlin-native-master'.
expected Xcode version 10.1, got 8.2.1, consider updating Xcode or use "ignoreXcodeVersionCheck" variable in konan.properties
kotlin-native-master/runtime/src/main/cpp/ObjCExportErrors.mm:73:23: error: no type or protocol named 'NSErrorUserInfoKey'
NSMutableDictionary<NSErrorUserInfoKey, id>* userInfo = [[NSMutableDictionary new] autorelease];
.konan/dependencies/clang-llvm-6.0.1-darwin-macos/include/c++/v1/cmath:313:9: error: no member named 'signbit' in the global namespace
using ::signbit;
I did manage to get a "hello world" working under the above environment, but I have given up with the OpenGL stuff. I cant update my environment currently, and I guess this issue doesn't affect many people. So I'm going to close it with this 'answer'.

wurfl nginx build errors

I am getting build errors when trying to build Nginx with Wurfl. I am running in a Centos7 VM, combining nginx with other modules and specifying other flags doesn't seem to be causing any problems for me. However when I try to bundle with the wurfl module it fails. It gives errors such as:
-o objs/addon/src/ngx_http_wurfl_module.o \
../src/ngx_http_wurfl_module.c
../src/ngx_http_wurfl_module.c:63:5: error: unknown type name ‘wurfl_useragent_priority’
wurfl_useragent_priority useragent_priority;
^
../src/ngx_http_wurfl_module.c:86:15: error: ‘WURFL_UPDATER_FREQ_DAILY’ undeclared here (not in a function)
{"DAILY", WURFL_UPDATER_FREQ_DAILY},
^
../src/ngx_http_wurfl_module.c:86:5: error: missing initializer for field ‘value’ of ‘nginx_wurfl_updater_frequency_t {aka const struct <anonymous>}’ [-Werror=missing-field-initializers]
{"DAILY", WURFL_UPDATER_FREQ_DAILY},
^
../src/ngx_http_wurfl_module.c:82:15: note: ‘value’ declared here
const int value;
^
../src/ngx_http_wurfl_module.c:87:16: error: ‘WURFL_UPDATER_FREQ_WEEKLY’ undeclared here (not in a function)
{"WEEKLY", WURFL_UPDATER_FREQ_WEEKLY},
^
../src/ngx_http_wurfl_module.c:87:5: error: missing initializer for field ‘value’ of ‘nginx_wurfl_updater_frequency_t {aka const struct <anonymous>}’ [-Werror=missing-field-initializers]
{"WEEKLY", WURFL_UPDATER_FREQ_WEEKLY},
^
../src/ngx_http_wurfl_module.c:82:15: note: ‘value’ declared here
const int value;
^
In file included from src/core/ngx_core.h:58:0,
from ../src/ngx_http_wurfl_module.c:22:
../src/ngx_http_wurfl_module.c: In function ‘ngx_http_wurfl_init_main_conf’:
../src/ngx_http_wurfl_module.c:694:93: error: implicit declaration of function ‘wurfl_get_api_version’ [-Werror=implicit-function-declaration]
ngx_log_error(NGX_LOG_NOTICE, cf->log, 0, "WURFL: Engine created - API version %s", wurfl_get_api_version()
I am trying to build with the latest stable nginx, and a pulled wurfl from yesterday, and gcc 5.3.1. I am more or less using the generic build script provided by WURFL.
Anyone have any thoughts?
So there are a couple of components to the WURFL module and it looks like the issue could be a mismatch on the different components. I would make sure that your libwurfl and wurfl infuze version numbers are the same (the latest version is 1.8.4). Check out the first section of the documentation for more information on how to install libwurfl.
Next I would make sure that your nginx.conf file is appropriate for the version of wurfl you are using. There have been some big changes in the last few versionsof wurfl that may affect how it performs. You can check the documentation for an example configuration file for the latest version of wurfl. If you are using an older version, you can check the readme provided with the release.
If fixing these doesn't help, let me know what infuze version number you are working with so I can try to replicate your issue.

How do I tell the C++ compiler on a supercomputer that my R package requires C++0x?

I have written and built an R package that depends on Rcpp and requires the C++0x standard (for using the tgamma function in C++). I have tested the package on various desktop computers and operating systems, and it always seems to install and work fine. However, I would also like to use the package on an HPC server. When I try to install the package there in my local R library tree using R CMD INSTALL test (where test is the name of the package), I get the following error message from the compiler:
/usr/include/c++/4.4.7/c++0x_warning.h(31): catastrophic error: #error directive: This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
#error This file requires compiler and library support for the upcoming \
^
compilation aborted for Metropolis_Sampler_Beta_Edgewise_Cpp_Statistics.cpp (code 4)
make: *** [Metropolis_Sampler_Beta_Edgewise_Cpp_Statistics.o] Error 4
ERROR: compilation failed for package ‘test’
It basically tells me that I should enable C++0x support when the compiler is called (as in this post). Yet, I thought adding the statement CXX_STD = CXX11 to the src/Makevars file in the R package would actually tell the compiler that this version needs to be used. And indeed that seems to be the case on various desktop computers I have tried. So my question is: how can I tell the compiler on the server that this C++ version should be used for compilation? Alternatively, how else can I install the package?
On the server, I load the module for R by entering module load math/R on the terminal before trying to install the package, and it reports back that the following modules were loaded:
Loading module dependency 'compiler/intel/13.1'.
Loading module dependency 'numlib/mkl/11.0.5'.
Edit 1: The server is a German university cluster called bwUniCluster. It is based on KITE 2.0/RHEL6.5/Lustre 2.5.2. As far as I can tell from the module message reported above, it seems to be the Intel C++ Compiler XE (ICPC) version 13.1.3. But actually I have no clue about compilers, so if you need to know anything more specific, please let me know.
Edit 2 It's also possible to execute module load compiler/gnu/4.9 on the terminal before I try to install the package. This results in the following error message (similar as the one above), which leads me to think that this is not a version problem:
/pfs/data1/software_uc1/bwhpc/common/compiler/gnu/4.9.2/bin/../include/c++/4.9.2/bits/c++0x_warning.h(32): catastrophic error: #error directive: This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
compilation aborted for Metropolis_Sampler_Beta_Edgewise_Cpp_Statistics.cpp (code 4)
make: *** [Metropolis_Sampler_Beta_Edgewise_Cpp_Statistics.o] Error 4
ERROR: compilation failed for package ‘test’
Edit 3: One of the comments suggests that both the R package and R itself need to be compiled using the same compiler version. Is this correct? R was built using g++ 4.4.7 on this machine. Does this mean that the only feasible solution is to convince the sys admin to recompile R with the other 4.9.2 compiler and provide it as a new module? I find this hard to believe, given the following sentence in the "Writing R Extensions" manual:
On these platforms, it is necessary to select a different compiler for C++11, via personal or site Makevars files.
The solution was indeed to recompile R on the server with a newer compiler, in this case Intel 14 (as discussed in Edit 3 in the original post). The sys admin was so kind to set up a new module for this R version.

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