[Scons-users] Getting builds to work with the -j flag

Steve Robinson steven.robinson at motorolasolutions.com
Fri Feb 19 11:44:20 EST 2016


Thanks Pavel, your line fixed the problem in that simple example!  So when
I started learning SCons I made little examples that built a program, built
a static library, built a shared library, build a library, link that
library to a program, setup out-of-source builds, forced 32-bit build on
Windows, etc...  I'd be very interested in adding to the SCons recipes with
these simple tasks where the code has been reviewed by the community and
deemed the best way to go about these tasks.  I can't think of a better way
to get started with SCons or any tool for that matter.  Is there a process
to follow for such additions?

Ok, back to the original problem.  I made good progress yesterday solving
most of the problems I hit when using the -j flag.

This error:
midl\oleaut32.dll : error MIDL2020 : error generating type library :
SaveAllChanges Failed : .\vc120.tlb (0x80070005)
LINK : fatal error LNK1240: failed to compile IDL content

Was caused by multiple targets writing to the same vc120.tlb file.  There
were two scenarios where this happened:

1) Some targets used the SCons TypeLibrary command to generate the .tlb
file from a specified .idl.  If you don't have the compiler flag -Fd set to
provide a name (-Fdname-of-target), it will default to vc followed by the
version of Visual Studio.  I plan on wrapping the TypeLIbrary function so
that we always set the -Fd flag to the target name to hopefully avoid this
problem again.

2) The MIDL compiler is called by the Visual C++ linker when linking
projects that have the module attribute. (Source:
https://msdn.microsoft.com/en-us/library/cf540x82.aspx).  If you don't have
the -IDLOUT linker flag set, it will output to the default file, which
again was not unique among the targets.  I already have the SharedLibrary,
StaticLibrary, and Program functions wrapped with my own code so I'll add
append this flag in those functions.

I have a variant_dir set in SCons, but these files all went to my current
working directory.  I think there's definitely some opportunities to make
some changes to SCons TypeLibrary, StaticLibrary, SharedLibrary, and
Program to save us from ourselves :)  I'm deep in making major improvements
to this build system, but I'd like to contribute down the line.  If someone
doesn't want to take on these changes in the short-term, is there a place
we can post this information that's easily internet-searchable?  I'd hate
for someone to have to struggle like I did.

Thanks for all the responses.  Along with liking SCons, I'm happy it has a
responsive and helpful community!!


On Fri, Feb 19, 2016 at 4:16 AM, William Blevins <wblevins001 at gmail.com>
wrote:

> This seems to be a discrepancy between linker behavior and SCons
> dependency generation behavior with regards to LIBPATH since some linkers
> are automatically checking "." after evaluating LIBPATH contents. I imagine
> that fixing something like this would require changes on a per linker
> basis? This isn't explicitly a failure but it's peculiar I suppose.
>
> On Fri, Feb 19, 2016 at 6:48 AM, Paweł Tomulik <ptomulik at meil.pw.edu.pl>
> wrote:
>
>> Actually, I've tested it with GCC. The problem with -j was initially the
>> same, and LIBPATH solved it.
>>
>>
>> W dniu 18.02.2016 o 23:57, William Blevins pisze:
>> > And Pawel probably wins the gold star!
>> >
>> > I assume this is a difference in the default LIBPATH assumptions between
>> > SCons and VS that the link occurs at all.
>> >
>> > On Thu, Feb 18, 2016 at 10:33 PM, Paweł Tomulik <
>> ptomulik at meil.pw.edu.pl
>> > <mailto:ptomulik at meil.pw.edu.pl>> wrote:
>> >
>> >     W dniu 18.02.2016 o 00:40, Steve Robinson pisze:
>> >     > SharedLibrary('add', 'add.cpp')
>> >     > Program('main', 'main.cpp', LIBS='add')
>> >
>> >
>> >     Try:
>> >
>> >     Program('main', 'main.cpp', LIBS=['add'], LIBPATH=['.'])
>> >
>> >     --
>> >     Pawel Tomulik
>> >     _______________________________________________
>> >     Scons-users mailing list
>> >     Scons-users at scons.org <mailto:Scons-users at scons.org>
>> >     https://pairlist4.pair.net/mailman/listinfo/scons-users
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__pairlist4.pair.net_mailman_listinfo_scons-2Dusers&d=CwMFaQ&c=q3cDpHe1hF8lXU5EFjNM_A&r=QAOsy4tIVkKeZXD_uUwK1SpaRkBlycQsQnnLO6UQm7gJri9VDujPIuih5pu8f-Ff&m=yM6vspet6jcIB_VShL6rJLGcti-LT6trJz2JChREhTg&s=hPB-gPqMcilN-rV8W7kXSJYbsTznY22FEijGrkCgZes&e=>
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > Scons-users mailing list
>> > Scons-users at scons.org
>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__pairlist4.pair.net_mailman_listinfo_scons-2Dusers&d=CwMFaQ&c=q3cDpHe1hF8lXU5EFjNM_A&r=QAOsy4tIVkKeZXD_uUwK1SpaRkBlycQsQnnLO6UQm7gJri9VDujPIuih5pu8f-Ff&m=yM6vspet6jcIB_VShL6rJLGcti-LT6trJz2JChREhTg&s=hPB-gPqMcilN-rV8W7kXSJYbsTznY22FEijGrkCgZes&e=>
>> >
>>
>>
>> --
>> Pawel Tomulik
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__pairlist4.pair.net_mailman_listinfo_scons-2Dusers&d=CwMFaQ&c=q3cDpHe1hF8lXU5EFjNM_A&r=QAOsy4tIVkKeZXD_uUwK1SpaRkBlycQsQnnLO6UQm7gJri9VDujPIuih5pu8f-Ff&m=yM6vspet6jcIB_VShL6rJLGcti-LT6trJz2JChREhTg&s=hPB-gPqMcilN-rV8W7kXSJYbsTznY22FEijGrkCgZes&e=>
>>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20160219/11794121/attachment-0001.html>


More information about the Scons-users mailing list