How can I link with libquadmath? - gcc

When I try to build my application by gfortran 4.6 I get the following error:
profcn103.for:(.text+0x7e76b): undefined reference to log10q_
I tried to specify -lquadmath option it didn't help.
When I look at library by nm I get the following:
log10q.o: 00000000 T log10q
I use Ubuntu 10.10 (i686). I tried manually compiled gcc-4.6.2 and gcc-4.6 from ppa repository.
It looks like a problem with mangling of names. What can I do with it?

What platform, and where did you get your copy of gfortran? In case you use windows, the equation.com builds are known to be broken wrt quadmath. Otherwise, it should work.
And no, you don't need to explicitly add -lquadmath; the gfortran driver does it automatically.

It's my fault. I had to use usual log10 and not log10q because gfortran automatically invoke needed functions.

Related

GCC compiler cannot be spawned

I was trying to run c program but this problem arise.. I don't know what it's trying to convey.. need help here
It looks like a pop up from some application rather than GCC. It says that it couldn't find the GCC on your computer, or may be GCC is installed but isn't included in your PATH environment variable.
You can find and install GCC here
https://gcc.gnu.org/wiki/InstallingGCC

cannot use ceres solver,glog

I install ceres in ubuntu and use the all of the command line in http://ceres-solver.org/installation.html Linux part from
sudo apt-get install libgoogle-glog-dev
all the way to
make install
Seems I have installed ceres solver and it dependency without problem.
But when I try to run the test file
bin/simple_bundle_adjuster ../ceres-solver-1.12.0/data/problem-16-22106-pre.txt
It shows
unable to open file ../ceres-solver-1.9.0/data/problem-16-22106-pre.tx
Then I try to compile helloworld in tutorial use command
g++ -I/usr/include/eigen3 helloworld.cpp -o helloworld
It gives me a bunch of problems.
undefined reference to google::InitGoogleLogging(char const*)'
helloworld.cpp:(.text+0x104): undefined reference toceres::Problem::Problem()'
helloworld.cpp:(.text+0x155): undefined reference to `ceres::Problem::AddResidualBlock(ceres::CostFunction*, ceres::LossFunction*, double*)'
I didn't list them all. But seems it cannot find things about google at all.
Hope you can help me!!
it gives me a mountain of problems.
Sounds like you're not linking to the library; this would cause references to be undefined. If you are calling the linker (G++ can be the linker), then add -lglog add the end, it should then link it to glog.
Similarly, you should also link to ceres.
Here's a snippet from the things I need to link to use a library which uses Ceres. In CMake. I suggest you start at the bottom/end and add things to the top to fix, you may need to prefix with -l to indicate that you need to link them.
I recommend using cmake, so that you can simply paste this list in a target_link_libraries(myexecutable listhere) and remove unnecessary/unused libraries;
umfpack
cxsparse
stlplus
glog
gomp
ccolamd
btf
klu
cholmod
lapack
blas
camd
amd
pthread
ceres

Compile cgo lib on Cygwin64: "ld: cannot find -lmingw32"

I'm trying to use a cgo library on Windows, namely github.com/mattn/go-sqlite3
I use Cygwin64 and installed with all "Development" packages, so gcc is availabe.
But running go get github.com/mattn/go-sqlite3 results in:
/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lmingwex
/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lmingw32
If I search for "mingwex" and "mingw32" in the Cygwin installer, I get no results. Am I looking for the wrong names or are they not available on 64 bit systems?
Or is there a better way to use the library on Windows?
Note that the README states that
However, if you install go-sqlite3 with go install
github.com/mattn/go-sqlite3, you don't need gcc to build your app
anymore
but I get the same error message if I use go install.
$ go version
go version go1.6.2 windows/amd64
What finally worked for me (instead of Cygwin) is to download TDM MinGW-w64 from http://tdm-gcc.tdragon.net/download and set the PATH such that gcc from C:\TDM-GCC-64\bin is used.
You can also install package mingw64-i686-gcc-core from Cygwin.
The binary will be /usr/bin/i686-w64-mingw32-gcc.exe so you probably need to copy it as /usr/bin/gcc.exe.
I have encountered the same issue as well. It seems to me that cygwin is not fully compatible with cgo. Instead, I have used https://mingw-w64.org.
From the cgo documentation https://github.com/golang/go/wiki/cgo:
In order to use cgo on Windows, you'll also need to first install a gcc compiler (for instance, mingw-w64) and have gcc.exe (etc.) in your PATH environment variable before compiling with cgo will work.

g++ 4.4.x bug?

I have build a g++ v4.4 from source by using the archives provided by gcc.gnu.org.
But the resulting g++ cannot compile some of our projects c++ files. I am receiving a message simply saying: assembler error. It turned out that the assembler chokes on some extremely long symbol names, e.g. symbols names with a length of more then 2k.
Am I missing something to get it to work?
I would very appreciate an advice on how to get this working!
Environment: Debian-Lenny 64bit
EDIT: The mentioned c++ files are compiling fine with g++ versions v4.2 and v4.3. So I don't think it is a bug in the assembler (from binutils v2.18). Just to be sure I have also tried with binutils v2.20 - but I got the identical error message.
EDIT: I need g++ v4.4.x for the purpose of comparing the output of different g++ versions (and there is no g++ v4.4 in the official lenny repositories)
If your analysis is correct, it seems the proper course of action would be to file a bug for binutils. Or gcc, if it turns out the long symbol names are due to a bug in gcc's name mangling.
Of course, a (preferably reduced) testcase will help the developers fix your problem. Heck, it could have helped SO readers to verify your problems.
You're going to have to compile the corresponding gas instead of depending on what lenny has in his refrigerator (/usr/bin).
Why don't a) upgrade or b) use the backports archive or c) rebuild from current Debian sources on your box? I happily run testing with g++ 4.2, 4.3 and 4.4.
Worst case, you could install a new Debian release in a virtual environment such as a chroot, a Xen or Kvm instance, or inside VirtualBox.

Change GCC version used by bjam

I am trying to build a library (luabind) with bjam. I came across an error and it seems like the problem is that I need to compile with gcc 4.2, but the default on this computer (Mac OSX) is 4.0. I would prefer not to go around changing links in system directories, is there a way to specify to bjam to use gcc4.2 rather than just gcc?
I think it's described in the documentation. You should have:
using gcc : 4.2 : g++-42 ;
in your user-config.jam and "bjam toolset=gcc-4.2" on the command line
Try running bjam with these options:
--toolset=gcc --toolset-root=/path/to/gcc/4.2

Resources