Out of tree builds with waf?

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Nov 9 07:35:20 UTC 2020


On 05/11/2020 19:02, Sebastian Huber wrote:

> On 05/11/2020 18:27, Sebastian Huber wrote:
>
>>
>> On 05/11/2020 18:22, Sebastian Huber wrote:
>>> On 05/11/2020 18:16, Andrew Butterfield wrote:
>>>
>>>>  I'm not a waf expert, but might this section in their book help?
>>>>
>>>> https://waf.io/book/#_fundamental_waf_commands 
>>>> <https://waf.io/book/#_fundamental_waf_commands>
>>>>
>>>> Can variables `top` and `out` in the example there be manipulated 
>>>> to do want you want?
>>>
>>> Yes, the --top and --out options works somehow, but I get a warning 
>>> like this:
>>>
>>> Waf: Entering directory 
>>> `/home/EB/sebastian_h/src/rtems-source-builder/tmp/build/sparc/erc32'
>>> CWD /home/EB/sebastian_h/src/rtems-source-builder/tmp is not under 
>>> /home/EB/sebastian_h/src/rtems, forcing --targets=* (run distclean?)
>>>
>>> Also the documentation says "Though Waf may be called from any 
>>> folder containing a /wscript/ file,", so I am not sure if this is 
>>> really supported what I am doing.
>>
>> What works is something like this:
>>
>> ./waf configure --out $PWD/tmp/xxx/build
>>
>> called from the source tree. However, this has some side-effects.
>>
>> 1. A .waf* directory is created in the source tree (this is an issue 
>> with a read-only source tree).
>>
>> 2. Waf somehow remembers this configuration. You can call "./waf" to 
>> build it. So, there must be some hidden state in the source tree. 
>> This is not really an out of tree build. You cannot have multiple 
>> independent build trees.
>
> This happens if I use a read-only source tree:
>
> ~/tmp/out-of-tree > pwd
> /home/EB/sebastian_h/tmp/out-of-tree
> ~/tmp/out-of-tree > ~/src/rtems/waf --top $HOME/src/rtems-read-only 
> --out $PWD/build configure --rtems-config $PWD/config.ini
> Setting top to                           : 
> /home/EB/sebastian_h/src/rtems-read-only
> Setting out to                           : 
> /home/EB/sebastian_h/tmp/out-of-tree/build
> Configure board support package (BSP)    : sparc/erc32
> Checking for program 'sparc-rtems6-gcc'  : 
> /opt/rtems/6/bin/sparc-rtems6-gcc
> Checking for program 'sparc-rtems6-g++'  : 
> /opt/rtems/6/bin/sparc-rtems6-g++
> Checking for program 'sparc-rtems6-ar'   : 
> /opt/rtems/6/bin/sparc-rtems6-ar
> Checking for program 'sparc-rtems6-ld'   : 
> /opt/rtems/6/bin/sparc-rtems6-ld
> Checking for program 'ar'                : 
> /opt/rtems/6/bin/sparc-rtems6-ar
> Checking for program 'g++, c++'          : 
> /opt/rtems/6/bin/sparc-rtems6-g++
> Checking for program 'ar'                : 
> /opt/rtems/6/bin/sparc-rtems6-ar
> Checking for program 'gas, gcc'          : 
> /opt/rtems/6/bin/sparc-rtems6-gcc
> Checking for program 'ar'                : 
> /opt/rtems/6/bin/sparc-rtems6-ar
> Checking for program 'gcc, cc'           : 
> /opt/rtems/6/bin/sparc-rtems6-gcc
> Checking for program 'ar'                : 
> /opt/rtems/6/bin/sparc-rtems6-ar
> Checking for asm flags '-MMD'            : yes
> Checking for c flags '-MMD'              : yes
> Checking for cxx flags '-MMD'            : yes
> Traceback (most recent call last):
>   File 
> "/home/EB/sebastian_h/src/rtems/.waf-2.0.20-36f5354d605298f6a89c09e0c7ef6c1d/waflib/Scripting.py", 
> line 119, in waf_entry_point
>     run_commands()
>   File 
> "/home/EB/sebastian_h/src/rtems/.waf-2.0.20-36f5354d605298f6a89c09e0c7ef6c1d/waflib/Scripting.py", 
> line 182, in run_commands
>     ctx=run_command(cmd_name)
>   File 
> "/home/EB/sebastian_h/src/rtems/.waf-2.0.20-36f5354d605298f6a89c09e0c7ef6c1d/waflib/Scripting.py", 
> line 173, in run_command
>     ctx.execute()
>   File 
> "/home/EB/sebastian_h/src/rtems/.waf-2.0.20-36f5354d605298f6a89c09e0c7ef6c1d/waflib/Configure.py", 
> line 101, in execute
>     env.store(os.path.join(Context.run_dir,Options.lockfile))
>   File 
> "/home/EB/sebastian_h/src/rtems/.waf-2.0.20-36f5354d605298f6a89c09e0c7ef6c1d/waflib/ConfigSet.py", 
> line 146, in store
>     Utils.writef(filename,''.join(buf))
>   File 
> "/home/EB/sebastian_h/src/rtems/.waf-2.0.20-36f5354d605298f6a89c09e0c7ef6c1d/waflib/Utils.py", 
> line 160, in writef
>     with open(fname,m)as f:
> IOError: [Errno 13] Permission denied: 
> '/home/EB/sebastian_h/src/rtems-read-only/.lock-waf_linux2_build'

This error can be fixed with the "--no-lock-in-top --no-lock-in-run" 
options. The

CWD /home/EB/sebastian_h/src/rtems-source-builder/tmp is not under 
/home/EB/sebastian_h/src/rtems, forcing --targets=* (run distclean?)

warning can be avoided using "--targets=*". So, with a couple of extra 
options it seems to be possible to do an out of tree build with 
read-only sources.

-- 
embedded brains GmbH
Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
Phone: +49-89-18 94 741 - 16
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

embedded brains GmbH
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier: https://embedded-brains.de/datenschutzerklaerung/



More information about the devel mailing list