Qt Creator compile error "cannot find -lGL". Other solutions are not working - linux

I have installed QT5 that also comes with QT creator on an amd machine running ubuntu 12.04. My grapics driver is a radeon r9270x if that matters.
When I try to compile a basic "hello world" type Qt program I get the error message "cannot find -lGL". I have searched around and here( Qt: can't find -lGL error ) it says to use "sudo apt-get install libgl1-mesa-dev" but when I do I already have that installed. Here ( Installing Qt on linux, cannot find -lGL ) it says to install "sudo apt-get install libgl-dev" but that only gets me
"Reading package lists... Done Building dependency tree Reading
state information... Done Package libgl-dev is a virtual package
provided by: libgl1-mesa-swx11-dev 8.0.4-0ubuntu0.7
libgl1-mesa-dev-lts-trusty 10.1.3-0ubuntu0.1~precise1
libgl1-mesa-dev-lts-saucy 9.2.1-1ubuntu3~precise1
libgl1-mesa-dev-lts-raring 9.1.7-1ubuntu2~precise1
libgl1-mesa-dev-lts-quantal 9.0.3-0ubuntu0.4~precise1
libgl1-mesa-dev 8.0.4-0ubuntu0.7 You should explicitly select one to
install.
E: Package 'libgl-dev' has no installation candidate"
Various other resources that I have used say to do similar things but I get this error still. Any ideas?
As a side not, not knowing the relevance, I could not get QT creator to launch for the longest time. It would always seg fault and core dump. I finally updated my amd catylist control center/video drivers and that fixed the problem.
Here is the compile output from qt creator:
02:34:21: Running steps for project myHelloWorld... 02:34:21:
Configuration unchanged, skipping qmake step. 02:34:21: Starting:
"/usr/bin/make" g++
-Wl,-rpath,/media/UsbExternalDrive/DesignTools/Qt5.3/5.3/gcc_64 -Wl,-rpath,/media/UsbExternalDrive/DesignTools/Qt5.3/5.3/gcc_64/lib -o myHelloWorld main.o
-L/media/UsbExternalDrive/DesignTools/Qt5.3/5.3/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread /usr/bin/ld: cannot find -lGL collect2: ld returned 1 exit status make: *** [myHelloWorld]
Error 1 02:34:21: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project myHelloWorld (kit: Desktop Qt
5.3 GCC 64bit) When executing step "Make" 02:34:21: Elapsed time: 00:00.

Try running this, restart Qt creator and try a clean build.
sudo apt-get install mesa-common-dev
EDIT:
Could be that you just miss Mesa package. Take a look at XCB dependencies listed here and install what’s missing.
I’ve seen this error also mentioned in a different case, but I don’t remember the solution there. I think I had solved the problem by installing the “libglu1-mesa-dev” package.
sudo apt-get install libglu1-mesa-dev -y
But I am not entirely sure if just this had fixed the issue or I had to install anything else.

So what I found worked for me, I manual added the path to the library and compiled. Then I was able to remove the manually added path. I assume somewhere on the backend it was not searching the correct place and once it was shown it remembered and kept the correct location.

Related

Error /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found

firstly, I google'd a lot but nothing I found related to my case, I have an ELF executable file I'm trying to run it in my Ubuntu WSL, I've changed the permissions (chmod +x file), when I run it, this error shows up
/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by myFile)
and when I use ld command this shows up to me
myFile(.eh_frame); no .eh_frame_hdr table will be created
and when I tried to upgrade GLIBC it says it's up-do-date
Reading package lists... Done
Building dependency tree
Reading state information... Done
libc6 is already the newest version (2.31-0ubuntu9.7).
libc6 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 215 not upgraded.
and then I tried manually installing the deb file from https://packages.ubuntu.com/impish/amd64/libc6/download but this shows up to me :
dpkg: regarding libc6_2.34-0ubuntu3.2_amd64.deb containing libc6:amd64:
libc6:amd64 breaks fakeroot (<< 1.25.3-1.1ubuntu2~)
fakeroot (version 1.24-1) is present and installed.
dpkg: error processing archive libc6_2.34-0ubuntu3.2_amd64.deb (--install):
installing libc6:amd64 would break fakeroot, and
deconfiguration is not permitted (--auto-deconfigure might help)
Errors were encountered while processing:
libc6_2.34-0ubuntu3.2_amd64.deb
DISCLAIMER: I am not a linux professional, just found a way for my own problem with glibc not found error msg:
maybe you cannot use the binary since it was compiled with gcc-11 and your gcc version of your linux distribution and version only is gcc-9 and therefore only provides glibc_2.31 (I guess).
you can try to compile the program yourself from source. I had to do this with the new stockfish version 15, which also uses updated glibc_2.32/2.33/2.34 and my linux-mint does not provide that.
But compiling from source worked like a charm. Maybe this is an option for you.
I have some similar situation,
I copyed my executed file from a centos VM1 to another centos VM2,then I got the same question,I just copy the source code to VM2,and recompile it,then the question is solved.
I got a makefile and a shell script to compile it,so the compilation process is simple,update glibc may cause other problem and is more complicated,and i am a caiji,hope to help u
I've got this error with buildroot-2022.11 when executing make.
Ubuntu 20.04 - added this repo as described in the link
sudo apt update
sudo apt install libc6
It automatically installed 2.35 for me.

Aseprite ninja build error "cannot find -lSKIA_OPENGL_LIBRARY-NOTFOUND"

While trying to build Aseprite on Debian 10 (amd64) virtualbox VM, after building Skia, the ninja aseprite command returns the error:
/usr/bin/ld: cannot find -lSKIA_OPENGL_LIBRARY-NOTFOUND
[1/1] Linking CXX executable bin/aseprite
FAILED: bin/aseprite
: && /usr/bin/c++ -Wall -Wno-switch -O2 -g -DNDEBUG src/CMakeFiles/aseprite.dir/main/main.cpp.o -o bin/aseprite lib/libapp-lib.a lib/libclip.a -lxcb -lpthread lib/libdio-lib.a lib/libfilters-lib.a lib/libflic-lib.a lib/libtga-lib.a lib/librender-lib.a lib/libdoc-lib.a lib/libfixmath-lib.a lib/libui-lib.a lib/liblaf-os.a lib/liblaf-gfx.a lib/liblaf-ft.a /root/deps/skia/out/Release-x64/libskia.a -lSKIA_OPENGL_LIBRARY-NOTFOUND /usr/lib/x86_64-linux-gnu/libfontconfig.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libXcursor.so /root/deps/skia/out/Release-x64/libskshaper.a lib/libobs.a lib/libundo.a lib/libcmark.a lib/libjpeg.a lib/libgiflib.a lib/libwebpdemux.a lib/libwebpmux.a lib/libwebp.a -lpthread -lm lib/libfreetype.a lib/libharfbuzz.a lib/libfreetype.a lib/libharfbuzz.a lib/libpng16.a -lm lib/libjson11.a lib/libarchive.a /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/x86_64-linux-gnu/libexpat.so /usr/lib/x86_64-linux-gnu/libssl.so lib/libfmt.a lib/libtinyexpr.a lib/liblauxlib.a lib/liblua.a lib/liblualib.a lib/libupdater-lib.a lib/libcfg-lib.a lib/libver-lib.a lib/libtinyxml.a lib/libnet-lib.a lib/liblaf-base.a lib/libmodpbase64.a /usr/lib/x86_64-linux-gnu/libdl.so lib/libcurl.a lib/libz.a -ldl && :
/usr/bin/ld: cannot find -lSKIA_OPENGL_LIBRARY-NOTFOUND
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
How may I solve this?
It appears that CMake is looking for OpenGL and failing... Aseprite doesn't seem to use OpenGL anyway, so disabling that altogether by clearing the cache variable SKIA_OPENGL_LIBRARY should work:
cd aseprite/build
cmake -DSKIA_OPENGL_LIBRARY="" ..
ninja aseprite
I have tested it on Windows, but I'm not entirely sure if it will work on Linux...
For anyone still looking for an answer to this. I got it to build on Ubuntu 20.04.
Follow the instructions to build skia over at the skia git repository. Make a note of which folder you cloned the repository into, you will need it later. I tried using the pre-built binaries but I must have been doing something wrong and could just never get it work.
When the build is complete you will see a note about 32-byte alignment, and if you check the out\Release-x64 folder you will see a libskia.a file. Now you know that skia was built succesfully.
Install the aseprite linux build dependencies with sudo apt-get install -y g++ cmake ninja-build libx11-dev libxcursor-dev libxi-dev libgl1-mesa-dev libfontconfig1-dev. You will find these instructions at the aseprite git repository.
Follow the instruction further down that page for the linux install but pay attention to the parameters you need to change regarding the location of that libskia.a file mentioned in point 2.
Before you start building (and why you're here) you need to enter #Ben_'s command given above to unlink the dependency to OPENGL (cmake -DSKIA_OPENGL_LIBRARY="" ..)
Now proceed to build aseprite with as the rest of the build instructions given on its repo page with ninja aseprite
Now go to aseprite/build/bin and find the aseprite executable.
You can copy this bin folder to another folder, and run aseprite from there. You can then delete all of the sources you downloaded.
There will be a bunch of errors during the python step, and you'll notice it complains about not being able to find some repositories, I think common.git is one of them. You may safely ignore this warning.
If you want to keep supporting development of the application I do recommend you spend whatever it costs for a license (but it's totally legal to build your own copy like this).

Installing pymc on Mac OS 10.14.5

I'm attempting to install pymc on MacOS 10.14.5 Mojave. However, there seems to be a problem with the gfortran module. The error message is minimally helpful.
I have attempted all the possible ways to install pymc as suggested here: https://pymc-devs.github.io/pymc/INSTALL.html
I first came across a problem with not recognising f951 in my gfortran compiler, but I solved that by adding the path to f951 explicitly to my PATH.
Now I come across the following after a bunch of warning messages in pymc.flib.f:
ld: unknown option: -idsym
error: Command "/usr/local/bin/gfortran -Wall -g -m64 -Wall -g -undefined dynamic_lookup -bundle build/temp.macosx-10.7-x86_64-3.7/cephes/i0.o build/temp.macosx-10.7-x86_64-3.7/cephes/c2f.o build/temp.macosx-10.7-x86_64-3.7/cephes/chbevl.o build/temp.macosx-10.7-x86_64-3.7/build/src.macosx-10.7-x86_64-3.7/pymc/flibmodule.o build/temp.macosx-10.7-x86_64-3.7/build/src.macosx-10.7-x86_64-3.7/build/src.macosx-10.7-x86_64-3.7/pymc/fortranobject.o build/temp.macosx-10.7-x86_64-3.7/pymc/flib.o build/temp.macosx-10.7-x86_64-3.7/pymc/histogram.o build/temp.macosx-10.7-x86_64-3.7/pymc/flib_blas.o build/temp.macosx-10.7-x86_64-3.7/pymc/blas_wrap.o build/temp.macosx-10.7-x86_64-3.7/pymc/math.o build/temp.macosx-10.7-x86_64-3.7/pymc/gibbsit.o build/temp.macosx-10.7-x86_64-3.7/build/src.macosx-10.7-x86_64-3.7/pymc/flib-f2pywrappers.o -L/Users/cameron/anaconda3/lib -L/usr/local/lib/gcc/x86_64-apple-darwin18.5.0/8.3.0 -L/usr/local/lib/gcc/x86_64-apple-darwin18.5.0/8.3.0/../../.. -L/usr/local/lib/gcc/x86_64-apple-darwin18.5.0/8.3.0/../../.. -lmkl_rt -lpthread -lgfortran -o build/lib.macosx-10.7-x86_64-3.7/pymc/flib.cpython-37m-darwin.so" failed with exit status 1
No online searches reveal what might cause the exit status 1 with gfortran.
Many thanks to #mishsx for suggesting re-installing gfortran. This is something I had done previously but this time I used homebrew, as explained here: stackoverflow.com/a/48184252/7841468
I went into my /usr/local/ and /usr/local/bin/ and deleted the gfortran folders since I had not previously installed gfortran with homebrew. One small problem was that the path was not included the first time I used homebrew, so I removed it with brew rm gcc, then reinstalled with brew install gcc.
The pymc installation then went ahead without error.
As mentioned, this can usually be fixed by purging your gfortran install and switching to brew fully.
However, the underlying issue is actually being caused by not having a valid collect2 (part of GCC) available to your gfortran. This causes the spec to pass flags to ld (only collect2 understands -idsym/-dsym).
I'm mostly noting this as a classic broken gfortran example.

Can't install cabal-install

I've just installed Mint 17 on my laptop and followed this with haskell platform generic. (I chose generic instead of using apt-get because it was the only way I could get ghc 7.10) When I try:
cabal install cabal-install
I get this error:
Resolving dependencies...
Configuring cabal-install-1.22.6.0...
Failed to install cabal-install-1.22.6.0
Build log ( /home/william/.cabal/logs/cabal-install-1.22.6.0.log ):
cabal: Error: some packages failed to install:
cabal-install-1.22.6.0 failed during the configure step. The exception was:
user error ('/usr/local/bin/ghc' exited with an error:
/usr/bin/ld: cannot find -lgmp
collect2: error: ld returned 1 exit status
)
Does anyone know how to fix this ?
update:
Fixed by installing libgmp-dev
[edit] You already found that
sudo apt-get install libgmp-dev
should solve your problem (for Mint - for systems without apt-get you would need to use the resident package manager, and in other apt-get based system there could be variation in package names).
If you run into similar errors in the future, here is the reasoning with which to solve the problem: ld is a linker, essentially linking libraries into a program which is being compiled. -lgmp is the argument supplied to ld, telling it to link in the library gmp. It cannot find this library, so either you need to:
(a) tell it about its location in case you know you have the library (the cabal argument --extra-lib-dirs= is useful in this case), or
(b) install the library (google the library name and your system).
GMP is the GNU MP Bignum library which plays a role in providing the Integer and Fractional types.

Trying to compile linux build of project, cannot find library

I am trying to build a project written in c++ on Linux Mint 16, using...
make -f ./Makefile
and I keep getting this error
/usr/bin/ld: cannot find -ludev
collect2: error: ld returned 1 exit status
make: *** [BINARY] Error 1
I was getting a lot more of the /usr/bin/ld: cannot find -foo, but I checked in my Makefile and, using the synaptic package manager, installed all the other necessary libraries, eliminating all but this error. I cant seem to find it anywhere, although perhaps I am not looking in the right places.
Thanks.
I had the some problem, right after updating to Linux Mint 17.1. I was trying to build an application with Qt 5 serial port module. Solved by installing: libudev-dev .
try:
sudo apt-get install udev
I don't know how to do that in synaptic, but it should be easier, right?

Resources