RT-Thread / RT-Thread/rt-thread
building: DefineGroup not support LIBRARY with LOCAL FLAGS
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 12.2k
- Forks
- 5.4k
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 40
Description
Description:
when use LIBRARY in DefineGroup with LOCAL FLAGS in SConscript, like:
group = DefineGroup('tensorflow-lite-for-mcu', src, depend = ['USING_TENSORFLOWLITEMICRO'], CPPPATH = CPPPATH, LOCAL_CPPDEFINES = CPPDEFINES, LIBRARY = True)
it will cause two actions:
scons: *** Two environments with different actions were specified for the same target: /Users/libao/Projects/myrtt/xuos-intelligence/framework/tensorflow-lite/tensorflow-lite-for-mcu/source/tensorflow/lite/micro/all_ops_resolver.o
(action 1: arm-none-eabi-g++ -o all_ops_resolver.o -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g -std=c++11 -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g -DHAVE_CCONFIG_H -DSTM32F407xx -D__RTTHREAD__ -DRT_USING_NEWLIB -DUSE_HAL_DRIVER all_ops_resolver.cc)
(action 2: arm-none-eabi-g++ -o all_ops_resolver.o -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g -std=c++11 -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g -DHAVE_CCONFIG_H -DSTM32F407xx -D__RTTHREAD__ -DRT_USING_NEWLIB -DUSE_HAL_DRIVER -DCMSIS_NN all_ops_resolver.cc)
Analyse
in tools/building.py, DefineGroup return Env.Library to objs and library source files will not be removed from objs. and then in DoBuilding, when call local_group, library source files action conflict with default Environment.
Maybe need to set a new Environment for Library.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect tools/building.py, especially DefineGroup and DoBuilding, starting with how LIBRARY sources remain in objs and are passed to local_group. Reproduce the SConscript example with LIBRARY=True and LOCAL_CPPDEFINES, then verify that the library sources produce one consistent action while retaining their local flags.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- build-system, embedded-iot, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100