0

Problem

I need my code to compile on a machine that cannot leverage apt-get to install nonstandard C++ libraries but my C++ program has a single #include for an external library that I must use. That library includes many headers and other libraries, meaning that my makefile has many -l and -I to /usr/include/... and /usr/lib/... pointing to my apt-get installed libraries.

What I want

Rather than manually going through and grabbing all of these libraries so that I can include them in my project directory, I am hoping there is a command or flag for make or g++ that will dump all the libraries and headers into a directory for me.

Progress

This and this have helped because adding the -MMD flag to my g++ compile command will dump out a list of about 100 header file locations. But I would like g++ to go one step further and actually do the work of gathering them all together for me, if that feature exists.

Community
  • 1
  • 1
Mike S
  • 11,329
  • 6
  • 41
  • 76
  • Some libraries have `my-lib-config` where you pass `--lib` or `--include` to have the required gcc flags. – Jarod42 Feb 25 '16 at 19:07
  • @Jarod42 true but that doesn't grab all the files and output them to a directory for you. – Mike S Feb 25 '16 at 22:22
  • Gathering the header files sounds straightforward, but I don't see a way to identify the libraries automatically. – Beta Feb 26 '16 at 00:14
  • @Beta I was worried about that. I noticed the `-MM` flag did not help with the libraries. So as far as you know, is my only option to `grep` or `find` the libraries and manually grab each one? – Mike S Feb 26 '16 at 05:18
  • Grabbing all libraries in a directory tree automatically is straightforward. Identifying the libraries that are actually necessary... You might be able to parse the makefile, extract the `-l` flags, but Make would have to delegate that job to something like a Perl script. – Beta Feb 26 '16 at 06:00

0 Answers0