All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Martin <s.martin49@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] yajl: fix static linking in a parallel build
Date: Sat, 2 Apr 2016 19:43:37 +0200	[thread overview]
Message-ID: <CAHXCMMLOeZQj83aKwszLwVZv_cP-fWeHzF28SQ6=L4wfCJbT3A@mail.gmail.com> (raw)
In-Reply-To: <1459617080.18262.5.camel@embedded.rocks>

On Sat, Apr 2, 2016 at 7:11 PM, J?rg Krause <joerg.krause@embedded.rocks> wrote:
> On Sa, 2016-04-02 at 19:05 +0200, Samuel Martin wrote:
>> On Sat, Apr 2, 2016 at 6:29 PM, J?rg Krause <joerg.krause@embedded.ro
>> cks> wrote:
>> >
>> > On Sa, 2016-04-02 at 17:13 +0200, Thomas Petazzoni wrote:
>> > >
>> > > Hello,
>> > >
>> > > On Fri,  1 Apr 2016 21:18:12 +0200, J?rg Krause wrote:
>> > >
>> > > >
>> > > >
>> > > > + FOREACH (test ${TESTS})
>> > > > +   GET_FILENAME_COMPONENT(testProg ${test} NAME_WE)
>> > > > +   ADD_EXECUTABLE(${testProg} ${test})
>> > > > +-  TARGET_LINK_LIBRARIES(${testProg} yajl m)
>> > > > ++  TARGET_LINK_LIBRARIES(${testProg} yajl_s m)
>> > > I am not sure to understand why this would fix the parallel build
>> > > issue. The parallel build problem comes from the fact that the
>> > > library
>> > > and tests sit in different directories, and that they are built
>> > > in
>> > > parallel with each other. Both the yajl and yajl_s libraries are
>> > > built
>> > > in the same directory, separate from the tests directory. So I
>> > > don't
>> > > quite see how changing from using yajl to yajl_s is going to make
>> > > a
>> > > difference here. But maybe I'm missing something.
>> > The issue is that we patch yajl (#0002) to build only the static
>> > library in a static build. So there is no shared library target for
>> > CMake to use as a dependency.
>> hmm... with that explaination, I nack this.
>> IMHO, the correct way to fix this would rather be:
>>
>> IF(BUILD_SHARED_LIBS)
>>   TARGET_LINK_LIBRARIES(${testProg} yajl m)
>> ELSE()
>>   TARGET_LINK_LIBRARIES(${testProg} yajl_s m)
>> ENDIF()
>>
>
> Yes, this would probably be best. However, the static library is build
> in shared and static builds.

I'm aware of that. Unfortunately, CMake is not equivalent to autotools
on that point.
CMake only provide one boolean flag to control the shared libs. build,
instead of a tristate option allowing building: shared libs only, or
static libs only, or shared and static libs.
That's why I made the choice of always building the static libs, and
keep BUILD_SHARED_LIBS driving the shared libs. build.

Though the static libs are always built, if the shared libs are built
as well, I'd tend to use the *.so at least to reduce the footprint...

Side note, this is breaking test. We usually don't care much about
building tests...

Regards,

-- 
Samuel

  reply	other threads:[~2016-04-02 17:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 19:18 [Buildroot] [PATCH] yajl: fix static linking in a parallel build Jörg Krause
2016-04-02 15:13 ` Thomas Petazzoni
2016-04-02 16:29   ` Jörg Krause
2016-04-02 17:05     ` Samuel Martin
2016-04-02 17:11       ` Jörg Krause
2016-04-02 17:43         ` Samuel Martin [this message]
2016-04-02 18:18           ` Jörg Krause

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHXCMMLOeZQj83aKwszLwVZv_cP-fWeHzF28SQ6=L4wfCJbT3A@mail.gmail.com' \
    --to=s.martin49@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.