Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Our build system uses pkg-config to build the software, but the linking can take very long (sometimes up to 20 minutes). We identified pkg-config as the guilty tool.

So, is there a faster alternative to pkg-config? Or, are there some settings to use to speed up the linking?

PS I am not sure if this question is relevant for this question.

share|improve this question
2  
Are you certain pkg-config is the problem? That's just used to get build options (usually) which is orders of magnitude faster than actual linking (linking can be very expensive, especially with large-ish C++ code). –  Mat Mar 27 '12 at 11:00
    
@Mat When I do top, I see pkg-config blocking the CPU. I also did vmstat 1 and I see that both high disk access and high CPU usage. The code is large, but I don't think it should take 20 minutes to link an application. It is not that large. And I see it happening randomly. –  BЈовић Mar 27 '12 at 11:09

3 Answers 3

Is pkg-config being invoked multiple times with the same options? This could happen if you have an invocation of it embedded into a Makefile's LDFLAGS variable or similar.

With GNU Make, at least, if you call an external program via backticks, it is recalled every time it is referenced. E.g., in this instance, you'll get two different outputs:

foo = `date`
asdfsdf:
    echo $(foo)
    sleep 4
    echo $(foo)

However if you use the shell function, the result is evaluated only once:

foo = $(shell date)
asdfsdf:
    echo $(foo)
    sleep 4
    echo $(foo)
share|improve this answer

There are other build tools such as scons and cmake which maybe faster.

However, since your performance happens randomly, I would do more investigation before doing a large scale restructure of your build system.

share|improve this answer
    
But even for those, you have to somehow pass compiler/linker options. And for that you need pkg-config (unless you set them in your makefile, or whatever is used). –  BЈовић Mar 27 '12 at 11:56
2  
Have you tried running those pkg-config commands on their own, not as part of the build system? –  Sardathrion Mar 27 '12 at 12:12
    
They still block even if run on their own. –  BЈовић Mar 27 '12 at 12:27
2  
Have you tried to strace them to see where/why they block? –  Sardathrion Mar 27 '12 at 13:06
up vote 0 down vote accepted

My colleague found pykg-config, which proved to be much faster then pkg-config.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.