Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ninja compilation fails after using include path file instead of "-I" option #4130

Closed
liruncong opened this issue Apr 8, 2022 · 10 comments
Closed

Comments

@liruncong
Copy link

git repository: https://github.com/liruncong/NinJaTest.git bsp: beaglebone
mingw: https://download-sh-cmcc.rt-thread.org:9151/www/aozima/env_released_1%20.2.0.7z gcc position : env\tools\gnu_gcc\arm_gcc\mingw\bin
python: 3.8.5(anaconda)
platform: win11
scons: https://github.com/SCons/scons.git

Directly using the "scons" command can compile successfully, but using "scons --experimental=ninja" will fail to compile, the log is as follows:

D:\work\gitee\rt-thread_ninja\bsp\beaglebone>set path=D:\MYBIN\scons-local\;D:\MYBIN\Anaconda3\;D:\MYBIN\env\tools\gnu_gcc\arm_gcc\mingw\bin;%path%

D:\work\gitee\rt-thread_ninja\bsp\beaglebone>set RTT_EXEC_PATH=D:\MYBIN\env\tools\gnu_gcc\arm_gcc\mingw\bin

D:\work\gitee\rt-thread_ninja\bsp\beaglebone>set RTT_ROOT=D:\work\gitee\rt-thread_ninja

D:\work\gitee\rt-thread_ninja\bsp\beaglebone>scons -j%NUMBER_OF_PROCESSORS% --verbose --experimental=ninja
scons: Reading SConscript files ...
Newlib version:2.4.0
scons: done reading SConscript files.
scons: Building targets ...
Generating: build.ninja
Executing: run_ninja_env.bat




D:\work\gitee\rt-thread_ninja\bsp\beaglebone>set SystemDrive=C:



D:\work\gitee\rt-thread_ninja\bsp\beaglebone>set SystemRoot=C:\Windows



D:\work\gitee\rt-thread_ninja\bsp\beaglebone>set TEMP=C:\Users\ARCHYI~1\AppData\Local\Temp



D:\work\gitee\rt-thread_ninja\bsp\beaglebone>set TMP=C:\Users\ARCHYI~1\AppData\Local\Temp



D:\work\gitee\rt-thread_ninja\bsp\beaglebone>set USERPROFILE=C:\Users\archyizimi



D:\work\gitee\rt-thread_ninja\bsp\beaglebone>set COMSPEC=C:\Windows\system32\cmd.exe



D:\work\gitee\rt-thread_ninja\bsp\beaglebone>set PATH=D:\MYBIN\env\tools\gnu_gcc\arm_gcc\mingw\bin;D:\MYBIN\scons-local\;D:\MYBIN;D:\MYBIN\Anaconda3\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\bin;C:\Program Files\dotnet\;C:\Program Files\IDM Computer Solutions\UltraEdit;C:\Program Files\IDM Computer Solutions\UltraCompare;C:\Users\archyizimi\AppData\Local\Microsoft\WindowsApps;C:\Users\archyizimi\.dotnet\tools;c:\MinGW\bin



D:\work\gitee\rt-thread_ninja\bsp\beaglebone>set PATHEXT=.COM;.EXE;.BAT;.CMD



D:\work\gitee\rt-thread_ninja\bsp\beaglebone>D:\MYBIN\Anaconda3\lib\site-packages\ninja\data\bin\ninja.exe -f D:\work\gitee\rt-thread_ninja\bsp\beaglebone\build.ninja

[1/55] Compiling build\applications\main.o�[2K
FAILED: build/applications/main.o

arm-none-eabi-gcc @build\applications\main.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[2/55] Compiling build\kernel\components\dfs\src\dfs_posix.o�[2K
FAILED: build/kernel/components/dfs/src/dfs_posix.o

arm-none-eabi-gcc @build\kernel\components\dfs\src\dfs_posix.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[3/55] Compiling build\drivers\gpio.o�[2K
FAILED: build/drivers/gpio.o

arm-none-eabi-gcc @build\drivers\gpio.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[4/55] Compiling build\kernel\components\dfs\src\dfs_file.o�[2K
FAILED: build/kernel/components/dfs/src/dfs_file.o

arm-none-eabi-gcc @build\kernel\components\dfs\src\dfs_file.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[5/55] Compiling build\kernel\components\dfs\src\dfs_fs.o�[2K
FAILED: build/kernel/components/dfs/src/dfs_fs.o

arm-none-eabi-gcc @build\kernel\components\dfs\src\dfs_fs.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[6/55] Compiling build\kernel\components\dfs\src\dfs.o�[2K
FAILED: build/kernel/components/dfs/src/dfs.o

arm-none-eabi-gcc @build\kernel\components\dfs\src\dfs.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[7/55] Compiling build\kernel\components\drivers\ipc\completion.o�[2K
FAILED: build/kernel/components/drivers/ipc/completion.o

arm-none-eabi-gcc @build\kernel\components\drivers\ipc\completion.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[8/55] Compiling build\kernel\components\dfs\filesystems\devfs\devfs.o�[2K
FAILED: build/kernel/components/dfs/filesystems/devfs/devfs.o

arm-none-eabi-gcc @build\kernel\components\dfs\filesystems\devfs\devfs.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[9/55] Compiling build\kernel\components\finsh\msh_file.o�[2K
FAILED: build/kernel/components/finsh/msh_file.o

arm-none-eabi-gcc @build\kernel\components\finsh\msh_file.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[10/55] Compiling build\kernel\components\drivers\ipc\waitqueue.o�[2K
FAILED: build/kernel/components/drivers/ipc/waitqueue.o

arm-none-eabi-gcc @build\kernel\components\drivers\ipc\waitqueue.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[11/55] Compiling build\kernel\components\drivers\ipc\ringblk_buf.o�[2K
FAILED: build/kernel/components/drivers/ipc/ringblk_buf.o

arm-none-eabi-gcc @build\kernel\components\drivers\ipc\ringblk_buf.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[12/55] Compiling build\applications\board.o�[2K
FAILED: build/applications/board.o

arm-none-eabi-gcc @build\applications\board.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[13/55] Compiling build\kernel\components\drivers\serial\serial.o�[2K
FAILED: build/kernel/components/drivers/serial/serial.o

arm-none-eabi-gcc @build\kernel\components\drivers\serial\serial.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[14/55] Compiling build\kernel\components\drivers\ipc\dataqueue.o�[2K
FAILED: build/kernel/components/drivers/ipc/dataqueue.o

arm-none-eabi-gcc @build\kernel\components\drivers\ipc\dataqueue.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[15/55] Compiling build\drivers\uart.o�[2K
FAILED: build/drivers/uart.o

arm-none-eabi-gcc @build\drivers\uart.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[16/55] Compiling build\kernel\components\drivers\ipc\pipe.o�[2K
FAILED: build/kernel/components/drivers/ipc/pipe.o

arm-none-eabi-gcc @build\kernel\components\drivers\ipc\pipe.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[17/55] Compiling build\kernel\components\finsh\shell.o�[2K
FAILED: build/kernel/components/finsh/shell.o

arm-none-eabi-gcc @build\kernel\components\finsh\shell.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[18/55] Compiling build\kernel\components\drivers\ipc\workqueue.o�[2K
FAILED: build/kernel/components/drivers/ipc/workqueue.o

arm-none-eabi-gcc @build\kernel\components\drivers\ipc\workqueue.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[19/55] Compiling build\kernel\components\finsh\cmd.o�[2K
FAILED: build/kernel/components/finsh/cmd.o

arm-none-eabi-gcc @build\kernel\components\finsh\cmd.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[20/55] Compiling build\kernel\components\finsh\msh.o�[2K
FAILED: build/kernel/components/finsh/msh.o

arm-none-eabi-gcc @build\kernel\components\finsh\msh.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[21/55] Compiling build\kernel\components\drivers\ipc\ringbuffer.o�[2K
FAILED: build/kernel/components/drivers/ipc/ringbuffer.o

arm-none-eabi-gcc @build\kernel\components\drivers\ipc\ringbuffer.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[22/55] Compiling build\kernel\libcpu\arm\am335x\mmu.o�[2K
FAILED: build/kernel/libcpu/arm/am335x/mmu.o

arm-none-eabi-gcc @build\kernel\libcpu\arm\am335x\mmu.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[23/55] Compiling build\kernel\libcpu\arm\am335x\interrupt.o�[2K
FAILED: build/kernel/libcpu/arm/am335x/interrupt.o

arm-none-eabi-gcc @build\kernel\libcpu\arm\am335x\interrupt.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[24/55] Compiling build\kernel\components\libc\compilers\common\stdlib.o�[2K
FAILED: build/kernel/components/libc/compilers/common/stdlib.o

arm-none-eabi-gcc @build\kernel\components\libc\compilers\common\stdlib.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[25/55] Compiling build\kernel\libcpu\arm\common\backtrace.o�[2K
FAILED: build/kernel/libcpu/arm/common/backtrace.o

arm-none-eabi-gcc @build\kernel\libcpu\arm\common\backtrace.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[26/55] Compiling build\kernel\libcpu\arm\am335x\cpu.o�[2K
FAILED: build/kernel/libcpu/arm/am335x/cpu.o

arm-none-eabi-gcc @build\kernel\libcpu\arm\am335x\cpu.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[27/55] Compiling build\kernel\components\libc\compilers\newlib\syscalls.o�[2K
FAILED: build/kernel/components/libc/compilers/newlib/syscalls.o

arm-none-eabi-gcc @build\kernel\components\libc\compilers\newlib\syscalls.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[28/55] Compiling build\kernel\components\drivers\misc\pin.o�[2K
FAILED: build/kernel/components/drivers/misc/pin.o

arm-none-eabi-gcc @build\kernel\components\drivers\misc\pin.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[29/55] Compiling build\kernel\components\libc\compilers\common\time.o�[2K
FAILED: build/kernel/components/libc/compilers/common/time.o

arm-none-eabi-gcc @build\kernel\components\libc\compilers\common\time.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[30/55] Compiling build\kernel\libcpu\arm\am335x\stack.o�[2K
FAILED: build/kernel/libcpu/arm/am335x/stack.o

arm-none-eabi-gcc @build\kernel\libcpu\arm\am335x\stack.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[31/55] Compiling build\kernel\libcpu\arm\am335x\trap.o�[2K
FAILED: build/kernel/libcpu/arm/am335x/trap.o

arm-none-eabi-gcc @build\kernel\libcpu\arm\am335x\trap.o.rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[32/55] Compiling build\kernel\libcpu\arm\common\div0.o�[2K
FAILED: build/kernel/libcpu/arm/common/div0.o

arm-none-eabi-gcc @build\kernel\libcpu\arm\common\div0.o.scons: *** [build.ninja] CalledProcessError : Command 'ninja' returned non-zero exit status 1.
Traceback (most recent call last):
  File "D:\MYBIN\scons-local\scons-local-4.3.1\SCons\Action.py", line 1295, in execute
    result = self.execfunction(target=target, source=rsources, env=env)
  File "D:\MYBIN\scons-local\scons-local-4.3.1\SCons\Tool\ninja\__init__.py", line 108, in ninja_builder
    for output in execute_ninja():
  File "D:\MYBIN\scons-local\scons-local-4.3.1\SCons\Tool\ninja\__init__.py", line 105, in execute_ninja
    raise subprocess.CalledProcessError(return_code, 'ninja')
subprocess.CalledProcessError: Command 'ninja' returned non-zero exit status 1.
rsp

arm-none-eabi-gcc: error: @build/__cpp_path.txt: No such file or directory

[33/55] Building build\kernel\libcpu\arm\am335x\context_gcc.o�[2K
[34/55] Building build\kernel\libcpu\arm\am335x\cp15_gcc.o�[2K
ninja: build stopped: subcommand failed.scons: building terminated because of errors.
@bdbaddog
Copy link
Contributor

bdbaddog commented Apr 8, 2022

Once again you IGNORE THE REQUIREMENT TO BRING YOUR ISSUE TO THE USERS MAILING LIST, IRC, or DISCORD SERVER BEFORE FILING AN ISSUE!

@bdbaddog
Copy link
Contributor

bdbaddog commented Apr 8, 2022

Are you not seeing this bit of text each and every time you file an issue?

Please bring your issue to the SCons users mailing list before filing an issue here

See: https://scons.org/bugs.html

or join our Discord server : https://discord.gg/bXVpWAy

@dmoody256
Copy link
Contributor

Hey @liruncong I have a few questions.

First can you give me the output of one of the response files? You can run ninja with the option -d keeprsp and it will keep the response file for review. So an example how to see it would be this set of commands:

  • ninja -d keeprsp build/kernel/components/libc/compilers/common/stdlib.o
  • cat build/kernel/components/libc/compilers/common/stdlib.o.rsp

Also my first guess at what is happening here is that a double response file situation is occuring. Are you using response files manually in your build in anyway? A response file is a file which contains the commandline for gcc to process: https://gcc.gnu.org/wiki/Response_Files

@bdbaddog
Copy link
Contributor

bdbaddog commented Apr 8, 2022

Why are you doing this?
https://github.com/liruncong/NinJaTest/blob/NinjaTest/bsp/beaglebone/SConstruct#L40

If all you're doing is adding a couple paths to CPPPATH and then swapping \ for /, there's far better ways to do it.

I can almost guarantee that since you don't have anything depend on the generated file, it's not happening before it's being referenced..

This is a USER ERROR and not a SCons error.
Issue like this are why we request that you bring such issue to the users mailing list, IRC, or discord server before filing an issue.

@bdbaddog
Copy link
Contributor

bdbaddog commented Apr 8, 2022

You should change this line

env["_CPPINCFLAGS"] = "@%s" % (incPathsFile)

to

def _my_concat(prefix, items_iter, suffix, env, f=lambda x: x, target=None, source=None, affect_signature=True):
    concat_out = env['_concat'](prefix, items_iter, suffix, env, f, target, source, affect_signature)
    concat_out = concat_out.replace('\\','/')
    return concat_out

env['_my_concat'] = _my_concat
env["_CPPINCFLAGS"] ='${_my_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE, affect_signature=False)}'

By adding to the path when you generate your cpp_list file, you aren't adding those paths to SCons' awareness of c preprocessor search path, which may further hamper getting proper build dependencies.

@bdbaddog
Copy link
Contributor

bdbaddog commented Apr 8, 2022

Closing this issue.
Please bring your issue to the users mailing list, IRC, or discord server.

@bdbaddog bdbaddog closed this as completed Apr 8, 2022
@liruncong
Copy link
Author

Are you not seeing this bit of text each and every time you file an issue?

Please bring your issue to the SCons users mailing list before filing an issue here

See: https://scons.org/bugs.html

or join our Discord server : https://discord.gg/bXVpWAy

I see "So please make sure you send email with the problem or feature request to the SCons user's mailing list", but the gz file at "https://pairlist4.pair.net/pipermail/scons-users/", I Can't open with winrar, showing file corrupt.I am in windows environment, I don't know what tool to use to open it?

@bdbaddog
Copy link
Contributor

bdbaddog commented Apr 9, 2022

I don't know what you're talking about a gzip file?
https://scons.org/lists.html

click here: http://four.pairlist.net/mailman/listinfo/scons-users
sign up for the mailing list
Then send an email
Or
ask on IRC
or
join our discord server at: https://discord.com/invite/bXVpWAy and ask there.
JUST LIKE IT SAYS IN THE TEXT YOU SEE WHEN YOU TRY TO FILE AN ISSUE!

@liruncong
Copy link
Author

Hello,below is the stdlib.o.rsp file:

"-o" "build/kernel/components/libc/compilers/common/stdlib.o" "-c" "-Wall" "-march=armv7-a" "-mtune=cortex-a8" "-ftree-vectorize" "-ffast-math" "-mfpu=vfpv3-d16" "-mfloat-abi=softfp" "-O0" "-gdwarf-2" "-Wall" "-MMD" "-MF" "build/kernel/components/libc/compilers/common/stdlib.o.d" "-DHAVE_CCONFIG_H" "-D__RTTHREAD__" "-DRT_USING_NEWLIB" "-D_POSIX_C_SOURCE=1" "@build/__cpp_path.txt" "D:/work/gitee/rt-thread_ninja/components/libc/compilers/common/stdlib.c"

Due to the length limit of the windows command line, in our actual project, the command will exceed the length limit of the windows command line, so this test case uses the "@file" option.

@bdbaddog
Copy link
Contributor

bdbaddog commented Apr 9, 2022

Closing and locking this issue.
I've pointed out the proper ways to ask for help on this.
Github Issues is not the place for non-scons issues.

@SCons SCons locked as off-topic and limited conversation to collaborators Apr 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants