cannont find lGL - opengl

Question: why can't it find -lGL?
Info: I wrote a program as guided by this site on my netbook this morning and it compiled and ran with no problem. I then proceeded to take the exact same code and try to run it on my desktop. the version my netbook compiled worked, but it yelled at me because my netbook doesn't have a graphics card and my desktop does so it wasn't quite compiled right. still ran though.
But when I tried to compile it on my desktop it failed. at first it was saying "Fatal error: GL/gl.h: no such file or directory" so i thought "wait, i thought opengl came with ubuntu, I mean my netbook worked, maybe I installed something and forgot about it" so i ran through apt and pulled down everything opengl I felt might help. but staring at 212 - 1278 packages (depending on what words i search with) that may or may not be opengl related, I don't know what else to try. I got past the first problem, but now it is complaining that it can't find -lGL, which seems really odd.
any tips, tricks, comments, quips? My end objective is to be able to compile c code from the command line, I've been using the command that I got from the afore mentioned site:
gcc -o gltest gltest.c -lX11 -lGL -lGLU
I run Ubuntu 11.04 desktop, 64-bit. Nvidia GTX465.

try to install the following packages:
apt-get install libgl1-mesa-dev libglu1-mesa-dev libglut3-dev

Your compiler was looking for a lib called libGL.so in /usr/lib, which was a symbolic link to /usr/lib/mesa/libGL.so, Mesa's libGL. You also have the libGL from your nVidia drivers (which are probably in 275.28 version, see the libGL name : libGL.so.275.28). Modifying the symlink to point to nVidia's one gives your compiler no longer the Mesa's one, but the nVidia's one.

Related

CLBlast library not working on Mingw-w64 with Nvidia GPUs

I am trying to run the example samples/sgemm.cpp from the CLBlast repo on
Windows 10 with a Nvidia graphics card. I have obtained the cl.hpp from the link. The makefile is simply as follows:
a.exe: sgemm.cpp
g++ sgemm.cpp -lopencl -clblast -O0 -g -DCL_TARGET_OPENCL_VERSION=300
I have the Nvidia CUDA toolkit v11.6 installed and the include directory is on the environment variable CPATH so that it is found by g++. Furthermore, the compiler is part of a Mingw-w64 installation on which clblast is installed.
The problem is that the compilation seems to succeed, but as soon as I try executing the a.exe it crashes without any error message. Similarly, attaching gdb does not help either, because the program exits immediatedly and gdb prints
During startup the program exited with code 0xc0000135.
What is the problem?
Update
I have opened an issue on the clblas github. Note that I can compile clinfo from here without problems. A missing library therefore should not be the first thing that comes to my mind.
To answer this, this was not a problem with gdb, a.exe or the CUDA toolkit but rather with the installed library which is build with Visual Studio. The resulting binary seems to be incompatible with g++. Therefore, installing the library from source using g++ fixed this.

'CXXABI_1.3.11' not found`

I can't get a cross compiled build running on my Raspberry Pi 1 B+. The error I keep getting is:
ImportError: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version 'CXXABI_1.3.11'
not found. I tried multiple compilers with different settings but I keep getting the same error. Also changing the LD_LIBRARY_PATH to the location of libstdc++ on my Pi didn't work. Today I got a sort of breakthrough finding out that the make process outputs "will change in GCC 7.1" after an argument. I'm not a hundred percent sure that this is what cause the error, but GCC 7.1 comes with version 1.3.11 of CXXABI, so I suspect it to be the cause. Is there anybody that knows how to stop this from happening? I'm building on a VM with Ubuntu 17.10. I'm building using sh autogen.sh; ./configure --host=arm-linux-gnueabihf; make -j8
Thanks
Edit: Found the solution myself, it was: export CXX=/path/to/toolchain/arm-linux-gnueabihf-g++
Your cross-GCC comes with a version of libstdc++.so which is not compatible with the one installed on your system. You can either run compiled program with modified LD_LIBRARY_PATH (or -Wl,-rpath), pointing to directory with cross-compiler's libstdc++.so, or downgrade your cross-compiler to match your distro.

How to statically compile a Fortran code

I compiled a copy of codes on one PC by Intel Fortran with the Lapack library. And then I ran it on another PC (the same OS without having Lapack installed). It failed.
This can be solved by installing Lapack on the other PC. The same problem occurs when using other libraries. This looks like a dynamical compiling issue (I am not sure). My question is how to get a real executable file that can be run on any machine?
I get a quite clear answer now. The direct answer to the question is (as #Vladimir F mentioned & #Ross) use option "-static" for both gfortran and ifort.
Some possibly occurred problems.
The libs for static compiling and dynamical compiling are different. For instance, we may have installed a lib called "LIBNAME" already. However, a similar lib called "LIBNAME-static" may be needed for the "-static" option version. According to the warning of something like:
/usr/bin/ld: cannot find -lLIBNAME
what we need to installed is libLIBNAME. We can install it (Fedora for instance) by
sudo dnf install libLIBNAME.
And
sudo dnf install libLIBNAME-static
may also needed. Just try them.

OpenCV can not find library on launch. Backwards compatibility?

I am trying to build and use a piece of C++ code that uses OpenCV. I am working on Linux, working in Code::Blocks (and the code was originally also developed on a Linux platform using C::B).
I followed this to install OpenCV (Ubuntu 12.04 & OpenCV 2.4.3). The project compiles fine, but when I try to execute it, it crashes on launch, with the following message about how it can not find the library:
(file_address): error while loading shared libraries: libopencv_core.so.2.3:
cannot open shared object file: No such file or directory
Process returned 127 (0x7F) execution time : 0.017 s Press ENTER to continue.
I set all the parameters for the linker according to several Code::Blocks install tutorials.
I also checked in /usr/local/lib/ for my libraries (it is the folder I gave to Code::Blocks' compiler); and while I do have a libopencv_core.so, a libopencv_core.so.2.4 and a libopencv_core.2.4.3, I do not have a libopencv_core.so.2.3.
So I'm wondering what the issue is. Is it about backwards compatibility, i.e. do I have to install the exact same version of OpenCV used to develop the original code? (This would be a bit concerning, since I am trying to make a widely-usable library).
Could I force it to use libopencv_core.so.2.4 instead?
EDIT: I managed to make it work by removing everything and reinstalling with a simple apt-get. Sometimes it's the simplest method that works the best! From now on I'll try to apt-get before following installation tutorials. ;)
Have a nice day!

Getting OpenCL to work on Linux laptop with Optimus technology

I have an installation of Kubuntu 13.10 on my laptop which has an Nvidia GT555m with optimus technology. I am having some trouble getting my C++ code with OpenCL to compile.
The error I keep getting is Cannot find -lOpenCL. Doing a quick search with the GNU find utility gives me the following:
/usr/lib32/nvidia-319/libOpenCL.so.1
/usr/lib32/nvidia-319/libOpenCL.so
/usr/lib32/nvidia-319/libOpenCL.so.1.0
/usr/lib32/nvidia-319/libOpenCL.so.1.0.0
/usr/lib/x86_64-linux-gnu/libOpenCL.so
/usr/lib/nvidia-319/libOpenCL.so.1
/usr/lib/nvidia-319/libOpenCL.so
/usr/lib/nvidia-319/libOpenCL.so.1.0
/usr/lib/nvidia-319/libOpenCL.so.1.0.0
I have the following OpenCL development packages installed:
opencl-headers
nvidia-opencl-dev
I also tried the utility clinfo to see if I get any information, but I get the following error:
clinfo: error while loading shared libraries: libOpenCL.so.1: cannot open shared object file: No such file or directory
Does anyone have any experience setting up a Linux development environment with OpenCL on their optimus laptops?
I was under the impression that I do not need to do anything fancy to get this working.
EDIT: Ok it seems the reason I was not managing to compile was because I was mixing up headers and libraries. Using the following compiles my code well:
g++ -std=c++11 -I /usr/local/cuda-5.5/include vadd.cpp -L /usr/lib/nvidia-331 -lOpenCL
I am getting another error during runtime now (but at least I managed to compile!). The error is as follows:
ERROR: clGetPlatformIDs
-1001
From doing some research this means I probably do not have the ICD portion of nvidias toolkit installed? What I cannot understand is - where to find it!
You should install the Nvidia Cuda SDK. It contains OpenCL development libraries and includes.
You don't need development packages or libraries, (OpenCL is already there, and working, just giving you a runtime error, ICD is present). What you need is a platform ready to execute the OpenCL code, so a GPU + a driver.
You need to install the propietary driver of nVIDIA: Either by using the Ubuntu tools, or by installing the package nvidia-current.
Maybe you have to install bublebee. A library to use Cuda on Nvidia cards with optimus technology.
I do not use Kubuntu yet I got it working under Mageia release 6 Linux so I guess it should be pretty similar. In my case there were Intel and Nvidia (GeForce GTX 980M) graphic cards together in my laptop. My intention was to get running only OpenCL compiled code without any set up of Xorg graphical server.
So, as advised above by DarkZeros I did it by using only a proprietary nvidia driver (in my case downloaded from Nvidia page). Then under root user:
./NVIDIA-Linux-x86_64-375.39.run --no-opengl-files
It asked me if I wanted to modify my Xorg configuration - I said "NO". This delivered nvidia kernel modules. Next, I modified /etc/modules to let the Linux know that it should load them at start up of system (this might be different on Kubuntu)
[root#localhost ~]# cat /etc/modules
nvidia
nvidia-uvm
nvidia-drm
nvidia-modeset
and that was really it. Reboot your system and loading of modules should automatically also create correct nvidia device files under a /dev directory.
[root#localhost ~]# ls /dev/nvidia*
/dev/nvidia0 /dev/nvidiactl /dev/nvidia-uvm /dev/nvidia-uvm-tools
I've got an inspiration from [ftp://download.nvidia.com/XFree86/Linux-x86/295.59/README/optimus.html][1]