Skip to content

[onert] Fix compilation on Ubuntu 25.10 with GCC 15.2.0#16356

Open
arkq wants to merge 1 commit intoSamsung:masterfrom
arkq:fix-tests
Open

[onert] Fix compilation on Ubuntu 25.10 with GCC 15.2.0#16356
arkq wants to merge 1 commit intoSamsung:masterfrom
arkq:fix-tests

Conversation

@arkq
Copy link
Contributor

@arkq arkq commented Jan 27, 2026

Trying to compile generated tests on Ubuntu 25.10 results in a compilation error due to name clash between test case namespace and function from the standard library:

In file included from ../../../../runtime/tests/nnapi/src/generated/all_generated_V1_2_cts_tests.cpp:182:
../../../../runtime/tests/nnapi/src/generated/tests/rsqrt.mod.py.cpp:5:11: error: ‘namespace rsqrt { }’ redeclared as different kind of entity
5 | namespace rsqrt {
| ^~~~~
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/15/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/15/bits/c++config.h:727,
from /usr/include/c++/15/cstddef:51,
from ../../../../runtime/externals/GTEST-1.15.2/googletest/include/gtest/gtest.h:52,
from ../../../../runtime/tests/nnapi/src/generated/tests/../../TestGenerated.h:21,
from ../../../../runtime/tests/nnapi/src/generated/tests/abs_1D_float_nnfw.mod.py.cpp:3,
from ../../../../runtime/tests/nnapi/src/generated/all_generated_V1_2_cts_tests.cpp:4:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:206:1: note: previous declaration ‘double rsqrt(double)’

ONE-DCO-1.0-Signed-off-by: Arkadiusz Bokowy a.bokowy@samsung.com

Copilot AI review requested due to automatic review settings January 27, 2026 13:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a compilation error on Ubuntu 25.10 with GCC 15.2.0 caused by a namespace collision. The standard library now includes a rsqrt() function, which conflicts with test case namespaces named rsqrt. The fix adds a prefix to all generated test namespaces to avoid such collisions.

Changes:

  • Modified test generators to add namespace prefixes: vts_gen_ for VTS tests and cts_gen_ for CTS tests
  • Updated all namespace references in generated test templates to use the prefixed names
  • Added Samsung copyright notice to modified shell script

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
runtime/tests/nnapi/specs/generate_vts_test.sh Updated shell script to generate namespaces with vts_gen_ prefix and reference them correctly
runtime/tests/nnapi/nnapi_test_generator/android-10/vts_generator.py Modified VTS test generator to use vts_gen_ namespace prefix in generated code
runtime/tests/nnapi/nnapi_test_generator/android-10/cts_generator.py Modified CTS test generator to use namespace prefix (contains critical typo: ctc_gen_ instead of cts_gen_)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Trying to compile generated tests on Ubuntu 25.10 results in a
compilation error due to name clash between test case namespace
and function from the standard library:

> In file included from ../../../../runtime/tests/nnapi/src/generated/all_generated_V1_2_cts_tests.cpp:182:
> ../../../../runtime/tests/nnapi/src/generated/tests/rsqrt.mod.py.cpp:5:11: error: ‘namespace rsqrt { }’ redeclared as different kind of entity
>     5 | namespace rsqrt {
>       |           ^~~~~
> In file included from /usr/include/features.h:523,
>                  from /usr/include/x86_64-linux-gnu/c++/15/bits/os_defines.h:39,
>                  from /usr/include/x86_64-linux-gnu/c++/15/bits/c++config.h:727,
>                  from /usr/include/c++/15/cstddef:51,
>                  from ../../../../runtime/externals/GTEST-1.15.2/googletest/include/gtest/gtest.h:52,
>                  from ../../../../runtime/tests/nnapi/src/generated/tests/../../TestGenerated.h:21,
>                  from ../../../../runtime/tests/nnapi/src/generated/tests/abs_1D_float_nnfw.mod.py.cpp:3,
>                  from ../../../../runtime/tests/nnapi/src/generated/all_generated_V1_2_cts_tests.cpp:4:
> /usr/include/x86_64-linux-gnu/bits/mathcalls.h:206:1: note: previous declaration ‘double rsqrt(double)’

ONE-DCO-1.0-Signed-off-by: Arkadiusz Bokowy <a.bokowy@samsung.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant