Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to find out the compiler options that were used when a .so library was compiled on Linux?

Tags:

c++

linux

g++

I need to know how the library I have has been compiled, i.e. which compiler options were used? Specifically, whether it was compiled with optimization or not, and few other options.

Is there any way to extract this information on linux, x86_64 platform?

like image 222
sandeep Avatar asked Oct 19 '25 12:10

sandeep


1 Answers

I don't believe it's possible to automatically detect compiler options; at least not in a portable way.

What you could do instead is change your build scripts (e.g. your Makefile) to automatically append a define together with the optimization argument (the -D flag).

like image 62
IneQuation Avatar answered Oct 21 '25 00:10

IneQuation



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!