ld cannot find libjasper library - c

I am trying to link an application with gc on Ubuntu 18.04. ld cannot find the libjasper library. I installed it manually with these commands:
sudo apt update
sudo apt install libjasper1 libjasper-dev
but got this error:
/usr/bin/ld: cannot find -llibjasper
I tried this command to add the library but didn't work:
gcc -o cnn connected_layer.c connected_layer.h convolutional_layer.c convolutional_layer.h image.c image.h maxpool_layer.c maxpool_layer.h network.c network.h tests.c -Wall `pkg-config --cflags --libs opencv` -flto -ffast-math -L /usr/lib/x86_64-linux-gnu -l libjasper

Replace
-l libjasper
by
-l jasper
lib is just a mandatory suffix to library files, which is ignored when specifying the name to the linker.

Related

Find CFLAGS and LDFLAGS equivalent in linux

I'm trying to figure out what is the equivalent paths of these in Linux.
I downloaded the openssl package sudo apt-get install libssl-dev
//#cgo windows CFLAGS: "-IC:/Program Files/OpenSSL-Win64/include"
//#cgo windows LDFLAGS: "-LC:/Program Files/OpenSSL-Win64/lib" -llibcrypto
Assuming you want to find flags needed to build using that installed package, then pkg-config:
]$ pkg-config --cflags openssl
]$ pkg-config --libs openssl
-lssl -lcrypto
So you don't need any special -I nor -L flags, because the includes and libraries are already in the system paths, you only need -l flags.
If that's not what you want, then you can just query the content of the package and see where the files are:
]$ dpkg-query -L libssl-dev
/.
/usr
/usr/include
/usr/include/openssl
/usr/include/openssl/aes.h
/usr/include/openssl/asn1.h
...
and do with that information whatever you need.

windows crosscompiling from linux entry point not found curl_easy_cleanup could not located

I am unsure of what could be causing this as I have tried recompiling libcurl and using pre-compiled binaries.
My compiler command
x86_64-w64-mingw32-gcc -Wall -Lwin-lib -Iwin-lib -I./ -D WIN32 -D CURL_STATICLIB -mwindows ... -o win-export/SLM.exe -lm -lraylib -ltmx -lxml2 -lzlibstatic -lcurl
There aren't any compiler errors or linker errors. Is this a problem with my compiler? Or one the other libraries I am using?

Statically cross compiling openssl on linux for windows

I'm trying to compile an app with static openssl. I compiled openssl with mingw options and now my lib directory has: libcrypto.a libssl.a libcrypto.dll.a libssl.dll.a
I used the correct -L compiler options and still I get these errors:
x86_64-w64-mingw32-gcc main.c -lws2_32 -s -ffunction-sections -fdata-sections -Wno-write-strings -fno-exceptions -fmerge-all-constants -static-libstdc++ -static-libgcc -static -L/rw/usrlocal/lib/ -I/rw/usrlocal/include/ -lssl -lcrypto
~~~~~~~~^~~~~
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /rw/usrlocal/lib//libssl.a when searching for -lssl
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lssl
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /rw/usrlocal/lib//libcrypto.a when searching for -lcrypto
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
Can someone here tell me why mingw is using the libcrypto.a and not libcrypto.dll.a? And what's more important: How I can change that?
Greetings
It literally says "skipping incompatible", which leads me to think the libraries are not targetting the same platform. Are you sure you're not mixing 32-bit and 64-bit Windows?
Run the file command with the .dll file of openssl to see if they are also targetting x86_64.
When building openssl you should specify mingw64 with the ./Configure command.

gcc cannot find -lglfw3 && i was unable to add the path

I am running CentOS 6.4, I have just installed GLFW 3.0.4 for some software package for CFD L-B visualisation. That's not my issue, the issue is that I was following instructions to test of GLFW was installed properly, I ran into some issues.
I began by
g++ -c main.cpp
Which has outputted main.o file, and went onto run this with the help of advice of another thread :
g++ main.o -o main.exec `pkg-config --libs glfw3` -lGL -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi -ldlD
which has then given me this error code:
Package glfw3 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glfw3.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glfw3' found
/usr/bin/ld: cannot find -lglfw3
collect2: ld returned 1 exit status
Have tried adding -L or -B to the path of glfw3.pc and no use,
Can you please advise on how I can get this to work properly?

Can't compile a file with SDL library linked on Ubuntu

We have an assignment to compile a file with SDL library linked. The file itself shouldn't contain any errors since almost everyone managed to compile it. I've installed SDL 1.2 on Ubuntu 12.04 with the following commands:
sudo apt-get install libsdl1.2-dev
sudo apt-get install libsdl-image1.2-dev
sudo apt-get install libsdl-mixer1.2-dev
sudo apt-get install libsdl-ttf2.0-dev
I'm compiling it with the following command:
gcc -o sdl_introduction sdl_introduction.c `sdl-config --cflags --libs`
I'm using with gcc 4.6.3
and I'm getting this error:
/usr/local/lib/libSDL.so: undefined reference to `_XGetRequest'
collect2: ld returned 1 exit status
What could cause the problem?
I have faced the same problem as you, it is caused by the SDL library needing other libraries to link with on ubuntu(or linux generally)
I recommend copiling it with :
gcc -o sdl_introduction sdl_introduction.c -lX11 -pthread `sdl-config --cflags --libs`
Notice the added -lX11 and -pthread.
EDIT:
My bad I forgot that you must add -lX11 and -pthread after the other flags.
Resulting in:
gcc -o sdl_introduction sdl_introduction.c `sdl-config --cflags --libs` -lX11 -pthread

Resources