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.
Related
i've installed in my windows 10 system GTK3.0 for mingw64 by MSYS2 but i've got a problem with pkg-config. When i write in the shell:
$ pkg-config --cflags --libs gtk+-3.0
I got the following error:
Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gtk+-3.0', required by 'virtual:world', not found
What's the deal?
I need to make an php extension(.so) file which can be made portable. The created library works fine on one of my machines, but, when I send it to other machine, it does not load properly as a dependency of cJSON is missing on the target machine. I do not have accessibility to install the cJSON library on the machine, though I can copy all the required files.
My current libtool command is :
/bin/bash /home/ubuntu/php-extension/libtool --mode=link cc -DPHP_ATOM_INC -I/home/ubuntu/php-extension/include
-I/home/ubuntu/php-extension/main -I/home/ubuntu/php-extension -static -I/usr/include/php/20170718
-I/usr/include/php/20170718/main
-I/usr/include/php/20170718/TSRM
-I/usr/include/php/20170718/Zend
-I/usr/include/php/20170718/ext
-I/usr/include/php/20170718/ext/date/lib
-I/usr/local/include
-L/usr/local/lib -lcjson
-DHAVE_CONFIG_H -g -O2
-o myextension.la -export-dynamic -avoid-version -prefer-pic -module -rpath /home/ubuntu/php-extension/modules
myextension.lo
How should I build the extension so it contains all the dependent libraries and there is no need to install library on target machine?
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.
I've used linuxbrew to install gcc 5.3 on a machine on which I don't have sudo access. I now want to link with X11:
> gcc test.c -lX11
ld: cannot find -lX11
I've checked that libX11.so exists in /usr/lib64/ which is on the compiler's LIBRARY_PATH. If I use the system's gcc it works fine, but I need a newer version to compile my actual program.
use -L flag, like this -L/usr/lib64, or you can specify full path to library like this gcc test.c /usr/lib64/libX11.so
According to this comment by a linuxbrew developer,
linuxbrewed gcc removes /usr/lib64 from the library path because mixing system libraries with brewed libraries creates havoc.
The solution is to brew install linuxbrew/xorg/xorg.
Just installed librsync using apt-get install librsync-dev on ubuntu. I can link other libraries like this pkg-config --libs --cflags glib-2.0 but I can't find librsync using pkg-config. How can I link it?
UPDATE: I very new to C and all this compiling linking stuff. Just learned how to find and link using pkg-config. But this librsync seems to be developed using different thing.
Your problem is not with C. The problem is most likely due to librsync NOT providing a package config file. Try:
pkg-config --list-all | grep -i rsync
If you get no response, librsync has no pkgconfig file available to the system. Instead of using pkg-config to link librsync, just add -lrsync to your gcc command line. E.g.:
gcc -Wall -o mynewprog mynewprog.c -lrsync