Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing `pkg-config` as command line argument under cygwin/msys bash
    primarykey
    data
    text
    <p>I'm trying to use cygwin as a build environment under Windows. I have some dependencies on 3rd party packages, for example, GTK+. </p> <p>Normally when I build under Linux, in my Makefile I can add a call to pkg-config as an argument to gcc, so it comes out like so:</p> <pre> gcc example.c `pkg-config --libs --cflags gtk+-2.0` </pre> <p>This works fine under Linux, but in cygwin I get:</p> <pre> :Invalid argument make: *** [example] Error 1 </pre> <p>Right now, I am just manually running pkg-config and pasting the output into the Makefile, which is truly terrible. Is there a good way to workaround or fix for this issue?</p> <p>Make isn't the culprit. I can copy and paste the command line that make uses to call gcc, and that by itself will run gcc, which halts with ": Invalid argument". </p> <p>I wrote a small test program to print out command line arguments:</p> <pre><code>for (i = 0; i &lt; argc; i++) printf("'%s'\n", argv[i]); </code></pre> <p>Notice the single quotes.</p> <pre> $ pkg-config --libs gtk+-2.0 -Lc:/mingw/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpang owin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule- 2.0 -lglib-2.0 -lintl </pre> <p>Running through the test program:</p> <pre> $ ./t `pkg-config --libs gtk+-2.0` 'C:\cygwin\home\smo\pvm\src\t.exe' '-Lc:/mingw/lib' '-lgtk-win32-2.0' '-lgdk-win32-2.0' '-latk-1.0' '-lgdk_pixbuf-2.0' '-lpangowin32-1.0' '-lgdi32' '-lpangocairo-1.0' '-lpango-1.0' '-lcairo' '-lgobject-2.0' '-lgmodule-2.0' '-lglib-2.0' '-lintl' ' </pre> <p>Notice the one single quote on the last line. It looks like argc is one greater than it should be, and argv[argc - 1] is null. Running the same test on Linux does not have this result.</p> <p>That said, is there, say, some way I could have the Makefile store the result of pkg-config into a variable, and then use that variable, rather than using the back-tick operator?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload