GNAT-GPS tutorial link error - gnat-gps

I am getting a link error when trying to build the sdc tutorial file. I've installed the gnat gpl using the install script. And the .o files exist in /usr/lib/x86_64-linux-gnu.
How do I configure to get the linker to see? I've tried adding to the path.
here's the output:
gnatmake -d -P/home/steve/workspace/ada/tutorial/sdc.gpr -XBuild=DEBUG sdc.adb
gnatbind -static -x /home/steve/workspace/ada/tutorial/obj/sdc.ali
gnatlink /home/steve/workspace/ada/tutorial/obj/sdc.ali -g -o /home/steve/workspace/ada/tutorial/obj/sdc
/usr/gnat/libexec/gcc/x86_64-pc-linux-gnu/4.7.4/ld: cannot find crt1.o: No such file or directory
/usr/gnat/libexec/gcc/x86_64-pc-linux-gnu/4.7.4/ld: cannot find crti.o: No such file or directory
/usr/gnat/libexec/gcc/x86_64-pc-linux-gnu/4.7.4/ld: cannot find -lc
/usr/gnat/libexec/gcc/x86_64-pc-linux-gnu/4.7.4/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
gnatlink: error when calling /usr/gnat/bin/gcc
gnatmake: *** link failed.
[2013-11-29 08:47:55] process exited with status 4 (elapsed time: 00.21s)

This is in general a sign that there was a problem during the installation. Removing your install (/usr/gnat) and reinstalling might fix the issue.
The answer comes late, but hopefully will be useful to someone else seeing the same issue later on.

Related

Error message when building WxWidgets sample program

I was trying to follow the instructions here to setup WxWidgets.
I've managed to run the commands wx-config --version and wx-config --list but not the commands to compile the minimal example, which are:
cd gtk-build/samples/minimal
make
./minimal
After lots of display messages I arrive at:
/usr/bin/ld: cannot find -lwxtiff-3.1
/usr/bin/ld: cannot find -lwxjpeg-3.1
/usr/bin/ld: cannot find -lwxregexu-3.1
collect2: error: ld returned 1 exit status
make: *** [minimal] Error 1
Makefile:149: recipe for target 'minimal' failed
The command '/bin/sh -c make' returned a non-zero code: 2
Did I miss the installation of some library?
There is a similar question for windows here, but the answers there seem not to apply for linux.
First of all, please look at the official instructions rather than the wiki which may, or not, be up to date.
Second, by running make clean you removed the libraries used by the in-tree makefiles. So, unsurprisingly, you can't use them any more, but you can use makefile.unx from the source tree, i.e. if wx-config is in your PATH, just use make -f makefile.unx in $wx/samples/minimal (and not under gtk-build/samples/minimal).

libSOIL Linker Error In XCode

So, I downloaded libSoil from https://github.com/smibarber/libSOIL and ran make, then sudo make install in Terminal. No errors, seemed to go fine.
But when I try and add libSOIL.dylib to the "Link Binary With Libraries" list in my XCode project, I get a linker error when I try to compile.
It says:
ld: library not found for -lSOIL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I managed to install and link GLFW3 to my project without any problems, so I'm not sure what the problem is here.
I figured out the problem: my header search path was at /usr/local/Cellar/glfw3/3.1/include instead of /usr/local/include

How to properly configure Clang?

I've just compiled latest reps of LLVM, Clang and libc++. Now however I have no idea how to configure the environment to use them. I've added in $PATH the one to compiled binaries and have set the
$D_LIBRARY_PATH=$(llvm-config --libdir)
but anyway when I test run 'clang' with example file it uses some '/usr/bin/ld' linker which I have no idea what is it (as I've uninstalled 'g++' because thought it was the problem (before 'clang' used some linker from it) and I don't have any other C++ compilers).
So now how do I point out the right 'llvm-ld', libc++ include and library paths? I don't want to pass some complex arguments every-time. Perhaps I should set some environment variables.
I'm also using KDevelop with the same effect.
Don't judge me if this sounds stupid but it's my first time with Linux (have always used Windows before). I'm using latest 'OpenSUSE' dist.
Update - here is the output window of CodeLite using clang compiler:
/bin/sh -c 'make -j 2 -e -f Makefile'
----------Building project:[ ClangTest - Debug ]---------- make[1]: Entering directory
'/run/media/bs_ld/8688602a-296d-40e1-bd37-c90e69f45769/Workspace/CL_C++_WP/ClangTest'
clang++ -c
"/run/media/bs_ld/8688602a-296d-40e1-bd37-c90e69f45769/Workspace/CL_C++_WP/ClangTest/main.cpp"
-stdlib=libc++ -o ./Debug/main.cpp.o -I. -I/run/media/bs_ld/8688602a-296d-40e1-bd37-c90e69f45769/Build/include/c++/v1/
clang++ -o ./Debug/ClangTest #"ClangTest.txt" -L.
-L/run/media/bs_ld/8688602a-296d-40e1-bd37-c90e69f45769/Build/lib/ /usr/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/bin/ld: cannot find -lstdc++ /usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find -lgcc clang-3.7: error: linker command failed
with exit code 1 (use -v to see invocation) ClangTest.mk:76: recipe
for target 'Debug/ClangTest' failed make[1]: * [Debug/ClangTest]
Error 1 make[1]: Leaving directory
'/run/media/bs_ld/8688602a-296d-40e1-bd37-c90e69f45769/Workspace/CL_C++_WP/ClangTest'
Makefile:4: recipe for target 'All' failed make: * [All] Error 2 0
errors, 0 warnings
You should be able to run make install with perhaps an optional DESTDIR=/...... so that it doesn't clobber your system files.
Since you're on OpenSUSE, you might as well use your distribution's build services, and install the SVN version of LLVM-Clang from here. You should be able to find libc++ and LLVM itself as well.
Otherwise, make install DESTDIR=/opt/llvm should work, and then you can add /opt/llvm/bin/ to PATH and use libc++ by adding this compile and link option: -stdlib=libc++. You'll need something like /opt/llvm/lib in LD_LIBRARY_PATH as well to find the libc++ so.
This should work pretty much out of the box, but I have only ever used my distribution's packages, not a self-built Clang to do this.
Note that Clang still uses your system linker, ld, and this is fine. Currently, LLVM does not yet provide a fully functional alternative to this program, but they are working on it.
EDIT: It seems you uninstalled too much: Clang also uses the GCC crtbegin and crtend object files. So just install GCC again along with glibc and its dev package.

Installing Moses Translation Software. Error message: "ld: library not found for -lboost_thread"

I am installing the Moses Translation Software on my Mac OS X 10.9.5 with Xcode 6.1. The instructions say that I need g++ and Boost installed. Once I do that, I git clone, "cd" into the directory, and then type ./bjam -j8. First, I verified I have the prerequisites. First, g++ (I just clicked the TAB to see what was available):
$ g++
g++ g++-4.9
Then boost:
$ brew install boost
Warning: boost-1.56.0 already installed
Then I tried installing:
$ ./bjam -j8
Tip: install tcmalloc for faster threading. See BUILD-INSTRUCTIONS.txt for more information.
mkdir: bin: File exists
...patience...
...patience...
...found 4469 targets...
...updating 155 targets...
darwin.link lm/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/query
ld: library not found for -lboost_thread
clang: error: linker command failed with exit code 1 (use -v to see invocation)
// Additional error messages...
...failed darwin.link mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/util_test...
...skipped <pmert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi>util_test.passed for lack of <pmert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi>util_test...
darwin.link mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/vocabulary_test
ld: library not found for -lboost_thread
clang: error: linker command failed with exit code 1 (use -v to see invocation)
"g++" -o "mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/vocabulary_test" "mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/VocabularyTest.o" "mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/libmert_lib.a" -lboost_unit_test_framework -llzma -lbz2 -ldl -lboost_system -lz -lboost_thread -lm -liconv -g -Wl,-dead_strip -no_dead_strip_inits_and_terms
...failed darwin.link mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/vocabulary_test...
...skipped <pmert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi>vocabulary_test.passed for lack of <pmert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi>vocabulary_test...
...failed updating 72 targets...
...skipped 83 targets...
The build failed. If you need support, run:
./jam-files/bjam -j8 --debug-configuration -d2 |gzip >build.log.gz
then attach build.log.gz to your e-mail.
You MUST do 3 things before sending to the mailing list:
1. Subscribe to the mailing list at http://mailman.mit.edu/mailman/listinfo/moses-support
2. Attach build.log.gz to your e-mail
3. Say what is the EXACT command you executed when you got the error
ERROR
There's a ton of error messages not shown (condensed into "// Additional error messages"), and they are all of the form "ld: library not found for -lboost_thread". So it's clear that something can't find a boost-related library, but I don't know how to fix this. Does anyone have suggestions? I literally just copied a couple of lines from the installation instructions, and Moses is popular enough such that an obvious error in the installation instructions would have been caught long ago.
Additional comment: On the installation instructions page, they list a command where they can force an installer to find the boost library:
./bjam --with-boost=~/workspace/temp/boost_1_55_0 -j8
My boost is in
/usr/local/Cellar/boost/1.56.0/
I tried substituting the --with-boost= argument with the above file path, but that did not work either (I got the same errors).
I'm going to post this on the Moses mailing list but I'd also want to ask here because I have gotten this same error ("library not found ... clang: error: linker command failed with exit code 1") with other software and it would be helpful for me to learn a general strategy for making sure that clang can find my libraries.
This package expects a non-standard layout of boost (or maybe that's the standard liayout for installed boost on many systems, but it certainly isn't the default layout for boost in my working directories):
bjam --help says:
--with-boost=/path/to/boost
If Boost is in a non-standard location, specify it here. This directory is
expected to contain include and lib or lib64.
When my Boost build tree is in
/home/sehe/custom/boost/boost // headeers
/home/sehe/custom/boost/stage
/home/sehe/custom/boost/stage/lib // libraries
I have created a "forwarding" directory - so I'm not required to install boost:
mkdir /tmp/boost-moses
cd /tmp/boost-moses/
ln -sfv /home/sehe/custom/boost/stage/lib lib
ln -sfv /home/sehe/custom/boost include
Now I could trigger a build in the mosesdecoder directory with
./bjam --with-boost=/tmp/boost-moses
It's not said here which Moses version ComputerScientist compiled, but his last comment hit the nail. When I was about to compile version 2.1.1, I needed to rewrite Jamroot file and jam-files/boost-build/tools/mpi.jam and change all the boost_mpi mentions to boost_mpi-mt. It seems to me that boost-1.55 used different library style then boost-1.56 and Moses was in that version adapted to 1.55.
However I am not able to compile Moses 3.0 with either boost-1.55 or boost-1.56 now because of undefined reference to boost::filesystem::path::stem().
Unfortunatelly I can not post this as a comment to previous answer...

C++/Eclipse Shared Library: Why can g++ not find this library?

I am following the instructions on
http://tayefeh.wordpress.com/2009/07/06/creating-and-using-a-c-shared-library-with-eclipse-cdt-galileo-and-gnu-c-compiler-and-linker/
to build a shared library.
I have got to Step II, bullet point 16 but my attempts to build the project fail with the following error:
**** Build of configuration Debug for project UseDLL ****
make all
Building target: UseDLL
Invoking: GCC C++ Linker
g++ -L"/home/ken/workspace/testlib/Debug" -o"UseDLL" ./src/UseDLL.o -ltestlib -l/home/ken/workspace/testlib/Debug
/usr/bin/ld: cannot find -l/home/ken/workspace/testlib/Debug
collect2: ld returned 1 exit status
make: *** [UseDLL] Error 1
Can anyone advise why the build is failing? The directory does exist and ls shows
[ken#localhost Debug]$ ls /home/ken/workspace/testlib/Debug/
libtestlib.so TestClass.o
If it helps, I am running CentOS 6.3.
Thanks,
Ken
You should remove this:
-l/home/ken/workspace/testlib/Debug
It makes g++ look for a library of that name.