I am trying to compile my programs using icc and not gcc, using the GNU Scientific Library (gsl). For the previous year, this worked perfectly, but when I had to reinstall icc when I renewed my license, I was unable to link gsl at compile time. However, with gcc it works perfectly fine. I don't really know what is going on, I have tried reinstalling gsl, icc, and everything but nothing seems to work. Upon trying to link gsl, I get the following error
ld: library not found for -lgsl
Related
The following packages were installed from repositories on CentOS 7.6:
clang-3.4.2-9.el7.x86_64
libcxx-3.8.0-3.el7.x86_64
libcxx-devel-3.8.0-3.el7.x86_64
Trying to build a simple C++ program:
clang++ -std=c++11 -stdlib=libc++ junk.cpp
This results in a bunch of linker errors, an example is:
/bin/../lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc++.so: undefined reference to `__cxa_throw'
AFAIK, this seems to be a problem of missing C++ ABI library, but I can't figure out how to install one that would provide the needed symbols. I could probably build one from source, but would like to stick with what's available from trustworthy repositories.
Any ideas on how to fix this?
I can build the program just fine if -stdlib=libc++ is omitted, in which case libstdc++ is used.
Try passing -lc++abi manually. This problem is fixed in modern installations, but the Linux packages aren't modern. Consider using apt.llvm.org
I got my self an ARM based development board (NVIDIA Jetson K1).
The thing is already equipped with Ubuntu system. I was able to use gcc 4.8 directly on the device, but it doesn't contain g++. Installing g++ with apt-get as usual wouldn't work because nobody ever bothered to maintain a complete ppa supporting ARM architecture.
Now I tried to compile the latest GCC manually. Everything went smooth when I compile and installed the requirements (MPC, MPFR, GMP). But I failed building GCC itself, and found out that the mad error in config.log telling me that a working C++ compiler can not be found.
I believe there must be a way to get a working g++ compiler working on the device itself rather than having to cross compile. Does anyone have a clue on how this can be done?
The message is right. GCC 4.8 is written in C++ so it needs to be compiled with a C++ (cross) compiler.
I am having a problem with cross compiling google v8 libraries for raspberry pi, and constantly getting "Illegal instruction" error when compiling official sample from site. These are the steps i followed:
Downloaded cross compile https://github.com/raspberrypi/tools/
Cloned v8 git https://chromium.googlesource.com/v8/v8.git
Exported CXX LINK point to arm-linux-gnueabihf-g++ from cross compile tools.
run make arm.release armv7=false hardfp=on snapshot=off armfpu=vfp armfloatabi=hard -j5
Copied generated executable shell and d8 from out/arm.release directory to pi (Raspbian kernel version 3.6.11) and it WORKS.
These steps prove that cross compilation toolchain is functional.
Problem occurs when trying to run other cross-compiled software that is linked to v8 libraries. For example sample code from https://developers.google.com/v8/get_started#intro.
Code is cross-compiled with this command (same as example, just changed compiler)
arm-linux-gnueabihf-g++ -I. hello_world.cc -o hello_world -Wl,--start-group out/x64.release/obj.target/{tools/gyp/libv8_{base,libbase,snapshot,libplatform},third_party/icu/libicu{uc,i18n,data}}.a -Wl,--end-group -lrt -pthread
When i copy that code to pi and run it i get SIGILL (Illegal instruction).
Note: cross compiled software that doesn't use v8 libraries works fine. Also x64 v8 libraries on host computer work fine.
On newer kernel versions shell and d8 were also throwing SIGILL but than i switched to older version 3.6.11 (problems with newer kernel https://groups.google.com/forum/#!topic/v8-users/IPT9EeYK9bg) and they started working, but compiled sample code is still showed same issues.
Did anyone have similar experience? Any suggestion on how to overcome this problem?
I found a solution thanks to post on v8 google group. https://groups.google.com/forum/#!topic/v8-users/LTppUbqNrzI
Problem was in make arguments it should be.
make arm arm_version=6 armfpu=vfp armfloatabi=hard
I installed clang to compare its use with g++ (gcc) for some C++ programs; as in, I compared compilation time, error feedback, etc,. for the same programs. I did this mainly for the official LLVM tutorial (implementing a compiler using LLVM).
At one point, I needed to install the LLVM libraries (v. 2.9.), while before I had only downloaded clang. Subsequent to this, compilation with clang++ doesn't seem to work for the following tutorial code; while g++ appears to work with LLVM directives (e.g., 'llvm-config --libs`, etc.). Concurrent to installation of the libraries, I had to also go from the old tutorial I was reading (llvm 2.2., suggesting clang++ syntax), to one for 3.0. (suggesting g++ syntax), as the library include locations had changed.
My questions to explain the changes after downloading the llvm libs:
(1) When I now type 'g++', am I still actually working with gcc, or has llvm/clang set itself as a new default mimicking the gcc syntax? If yes, how can I make sure that I actually use gcc, not clang, when I want to?
(2) If g++ still is gcc, any opinions/guesses why the official clang/llvm tutorial switches from suggesting the use of its own competing compiler back to gcc? (c., eg, here)
My System:
Ubuntu 12.04.
llvm 2.9.
gcc 4.6.3.
clang 3.0.
In order for typing g++ to execute a clang compiler, you'd probably be looking at either a symbolic link called g++ to clang, earlier in your $PATH than the path to the real g++, or else an alias named g++, along the lines of alias g++='clang++'.
You can check for the alias (although I imagine it's unlikely) by typing alias g++, which will let you know if you have any alias set up (and if so, what to)
In order to change the $PATH issue, if it occurs, you'd have to either remove the symbolic link (seems sensible, given if you wanted clang, you could just type clang++ instead of g++) or change the position of the symbolic link in the PATH variable, but since they're likely to exist in /usr/local/bin or something similar, that would render a symbolic link unlikely too!
Given this, probably g++ still calls the gcc g++ compiler, and someone was just a little careless when typing the tutorial - I see only the one mention of g++ on the page you linked, near the bottom?
I am getting a
fortran/arith.o: In function gfc_mpfr_to_mpz(__mpz_struct*,
__mpfr_struct*, locus*)': arith.c:(.text+0x1169): undefined reference tompfr_get_z_2exp'
from gcc 4.7.1 build process. I am following
gcc-wiki
However, I have made a little change to the
download_prequisites
script. And that is I am downloading the latest releases of all the prequisites for gcc where the original one was downloading a bit older ones since the above link was given for gcc 4.6. However, it can not find some symbols related to mpfr library.
A related google search gives me this thread however it also did not help me, maybe someone else could understand that differently than me:
A similar thread
Any hints on how to resolve this problem?
I recently built gcc 4.7.1 for Mountain Lion and followed a very nice tutorial of how to do a gcc build. In it, it describes all the necessary lib compilations, include mpfr, gmp and others. If you're running linux, I think it will work for you as well, give it a try:
http://solarianprogrammer.com/2012/07/21/compiling-gcc-4-7-1-mac-osx-lion/
Let me know if that helps.