Skip to content
Advertisement

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

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement