Samsung / ONE

On-device Neural Engine
Other
427 stars 151 forks source link

Fix build error in tizen w.r.t RISC-V #12337

Open chunseoklee opened 8 months ago

chunseoklee commented 8 months ago
```diff diff --git [a/compiler/pp/include/pp/IndentedStringBuilder.h](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=compiler/pp/include/pp/IndentedStringBuilder.h;h=2655aff055a72e8954d2b28288de7e534958b740;hb=bec0df756731c2185402f42148127c024f7ac087) [b/compiler/pp/include/pp/IndentedStringBuilder.h](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=compiler/pp/include/pp/IndentedStringBuilder.h;h=4dfd9436dab65d5a9491eb57938add73cba6c06c;hb=d44185dba35beb4f2dbb9fcf91513e48bac1108c) index [2655aff](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=compiler/pp/include/pp/IndentedStringBuilder.h;h=2655aff055a72e8954d2b28288de7e534958b740;hb=bec0df756731c2185402f42148127c024f7ac087)..[4dfd943](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=compiler/pp/include/pp/IndentedStringBuilder.h;h=4dfd9436dab65d5a9491eb57938add73cba6c06c;hb=d44185dba35beb4f2dbb9fcf91513e48bac1108c) 100644 (file) --- a/[compiler/pp/include/pp/IndentedStringBuilder.h](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=compiler/pp/include/pp/IndentedStringBuilder.h;h=2655aff055a72e8954d2b28288de7e534958b740;hb=bec0df756731c2185402f42148127c024f7ac087) +++ b/[compiler/pp/include/pp/IndentedStringBuilder.h](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=compiler/pp/include/pp/IndentedStringBuilder.h;h=4dfd9436dab65d5a9491eb57938add73cba6c06c;hb=d44185dba35beb4f2dbb9fcf91513e48bac1108c) @@ [-18,6](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=compiler/pp/include/pp/IndentedStringBuilder.h;h=2655aff055a72e8954d2b28288de7e534958b740;hb=bec0df756731c2185402f42148127c024f7ac087#l18) [+18,7](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=compiler/pp/include/pp/IndentedStringBuilder.h;h=4dfd9436dab65d5a9491eb57938add73cba6c06c;hb=d44185dba35beb4f2dbb9fcf91513e48bac1108c#l18) @@ #define __PP_INDENTED_STRING_BUILDER_H__ #include "pp/Format.h" +#include namespace pp { diff --git [a/infra/cmake/modules/ExternalBuildTools.cmake](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=infra/cmake/modules/ExternalBuildTools.cmake;h=557e6f47de36dc8cae7d89861ae5febfe3c30d87;hb=bec0df756731c2185402f42148127c024f7ac087) [b/infra/cmake/modules/ExternalBuildTools.cmake](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=infra/cmake/modules/ExternalBuildTools.cmake;h=45f32ea91726a8e6e7a1d2e9f14a93944f13ebd7;hb=d44185dba35beb4f2dbb9fcf91513e48bac1108c) index [557e6f4](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=infra/cmake/modules/ExternalBuildTools.cmake;h=557e6f47de36dc8cae7d89861ae5febfe3c30d87;hb=bec0df756731c2185402f42148127c024f7ac087)..[45f32ea](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=infra/cmake/modules/ExternalBuildTools.cmake;h=45f32ea91726a8e6e7a1d2e9f14a93944f13ebd7;hb=d44185dba35beb4f2dbb9fcf91513e48bac1108c) 100644 (file) --- a/[infra/cmake/modules/ExternalBuildTools.cmake](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=infra/cmake/modules/ExternalBuildTools.cmake;h=557e6f47de36dc8cae7d89861ae5febfe3c30d87;hb=bec0df756731c2185402f42148127c024f7ac087) +++ b/[infra/cmake/modules/ExternalBuildTools.cmake](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=infra/cmake/modules/ExternalBuildTools.cmake;h=45f32ea91726a8e6e7a1d2e9f14a93944f13ebd7;hb=d44185dba35beb4f2dbb9fcf91513e48bac1108c) @@ [-54,7](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=infra/cmake/modules/ExternalBuildTools.cmake;h=557e6f47de36dc8cae7d89861ae5febfe3c30d87;hb=bec0df756731c2185402f42148127c024f7ac087#l54) [+54,7](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=infra/cmake/modules/ExternalBuildTools.cmake;h=45f32ea91726a8e6e7a1d2e9f14a93944f13ebd7;hb=d44185dba35beb4f2dbb9fcf91513e48bac1108c#l54) @@ function(ExternalBuild_CMake) -G "${CMAKE_GENERATOR}" -DCMAKE_INSTALL_PREFIX=${ARG_INSTALL_DIR} -DCMAKE_BUILD_TYPE=Release - -DCMAKE_CXX_FLAGS=${ARG_BUILD_FLAGS} + -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} ${ARG_BUILD_FLAGS} ${ARG_EXTRA_OPTS} ${ARG_CMAKE_DIR} OUTPUT_FILE ${BUILD_LOG_PATH} diff --git [a/infra/nncc/cmake/buildtool/config/config_linux.cmake](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=infra/nncc/cmake/buildtool/config/config_linux.cmake;h=d7b17cfef0396d9feb1f90f8e0bf581031451199;hb=bec0df756731c2185402f42148127c024f7ac087) [b/infra/nncc/cmake/buildtool/config/config_linux.cmake](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=infra/nncc/cmake/buildtool/config/config_linux.cmake;h=b30345162e6108d47633d52d0f1da9632cdd24f2;hb=d44185dba35beb4f2dbb9fcf91513e48bac1108c) index [d7b17cf](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=infra/nncc/cmake/buildtool/config/config_linux.cmake;h=d7b17cfef0396d9feb1f90f8e0bf581031451199;hb=bec0df756731c2185402f42148127c024f7ac087)..[b303451](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=infra/nncc/cmake/buildtool/config/config_linux.cmake;h=b30345162e6108d47633d52d0f1da9632cdd24f2;hb=d44185dba35beb4f2dbb9fcf91513e48bac1108c) 100644 (file) --- a/[infra/nncc/cmake/buildtool/config/config_linux.cmake](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=infra/nncc/cmake/buildtool/config/config_linux.cmake;h=d7b17cfef0396d9feb1f90f8e0bf581031451199;hb=bec0df756731c2185402f42148127c024f7ac087) +++ b/[infra/nncc/cmake/buildtool/config/config_linux.cmake](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=infra/nncc/cmake/buildtool/config/config_linux.cmake;h=b30345162e6108d47633d52d0f1da9632cdd24f2;hb=d44185dba35beb4f2dbb9fcf91513e48bac1108c) @@ [-7,5](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=infra/nncc/cmake/buildtool/config/config_linux.cmake;h=d7b17cfef0396d9feb1f90f8e0bf581031451199;hb=bec0df756731c2185402f42148127c024f7ac087#l7) [+7,10](https://review.tizen.org/gerrit/gitweb?p=platform/core/ml/nnfw.git;a=blob;f=infra/nncc/cmake/buildtool/config/config_linux.cmake;h=b30345162e6108d47633d52d0f1da9632cdd24f2;hb=d44185dba35beb4f2dbb9fcf91513e48bac1108c#l7) @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_G list(APPEND FLAGS_CXXONLY "-Wno-psabi") endif() +# Build fail on memcpy (ex. compute/cker/include/cker/Shape.h:211:16) +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 12.0) + list(APPEND FLAGS_CXXONLY "-Wno-error=stringop-overflow -Wno-error=array-bounds") +endif() + # lib pthread as a variable (pthread must be disabled on android) set(LIB_PTHREAD pthread) ```
hseok-oh commented 8 months ago

I'll check.

hseok-oh commented 8 months ago

Patch

diff --git a/compiler/pp/include/pp/IndentedStringBuilder.h b/compiler/pp/include/pp/IndentedStringBuilder.h
index 9b398594e..9bb8124af 100644
--- a/compiler/pp/include/pp/IndentedStringBuilder.h
+++ b/compiler/pp/include/pp/IndentedStringBuilder.h
@@ -19,6 +19,8 @@

 #include "pp/Format.h"

+#include <cstdint>
+
 namespace pp
 {

diff --git a/infra/cmake/packages/FlatBuffers-2.0/FlatBuffersConfig.cmake b/infra/cmake/packages/FlatBuffers-2.0/FlatBuffersConfig.cmake
index b7ae666b8..99da30803 100644
--- a/infra/cmake/packages/FlatBuffers-2.0/FlatBuffersConfig.cmake
+++ b/infra/cmake/packages/FlatBuffers-2.0/FlatBuffersConfig.cmake
@@ -22,6 +22,9 @@ function(_FlatBuffers_build)
   if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
     set(ADDITIONAL_CXX_FLAGS "-Wno-error=class-memaccess")
   endif()
+  if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 12.0)
+    set(ADDITIONAL_CXX_FLAGS "-Wno-error=stringop-overflow")
+  endif()

   nnas_include(ExternalBuildTools)
   ExternalBuild_CMake(CMAKE_DIR   ${FlatBuffersSource_DIR}
hseok-oh commented 8 months ago

Test

  1. Update gbs.conf
    
    diff --git a/infra/nnfw/config/gbs.conf b/infra/nnfw/config/gbs.conf
    index 3e5b3545c..f15d26841 100644
    --- a/infra/nnfw/config/gbs.conf
    +++ b/infra/nnfw/config/gbs.conf
    @@ -8,6 +8,9 @@ repos = repo.base, repo.unified
    [profile.tizen_8]
    repos = repo.base_8, repo.unified_8

+[profile.tizen-dev] +repos = repo.base-dev, repo.unified-dev + [repo.unified] url = http://download.tizen.org/snapshots/TIZEN/Tizen-7.0/Tizen-7.0-Unified/latest/repos/standard/packages/

@@ -19,3 +22,9 @@ url = http://download.tizen.org/snapshots/TIZEN/Tizen-8.0/Tizen-8.0-Unified/late

[repo.base_8] url = http://download.tizen.org/snapshots/TIZEN/Tizen-8.0/Tizen-8.0-Base/latest/repos/standard/packages/ + +[repo.unified-dev] +url = http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Unified-Dev/latest/repos/standard/packages/ + +[repo.base-dev] +url = http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Base-Dev/latest/repos/standard/packages/


2. Build with `tizen-dev` profile

$ gbs -c infra/nnfw/config/gbs.conf build -A armv7l --include-all --profile=profile.tizen-dev

chunseoklee commented 8 months ago

Also, we need to SBS this patch :

Tizen-Unified / Tizen-Unified-RISCV에 SBS 요청 드립니다.

chunseoklee commented 8 months ago

For risc-v build,

https://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Unified-RISCV/latest/repos/standard/packages/
https://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Base-RISCV/latest/repos/standard/packages/
hseok-oh commented 8 months ago

Our package may empty on RISC-V target.

https://github.com/Samsung/ONE/blob/8533c5a001b129b7aea2161eb820cd0ff3430ccc/packaging/nnfw.spec#L208-L209

chunseoklee commented 8 months ago

Our package may empty on RISC-V target.

https://github.com/Samsung/ONE/blob/8533c5a001b129b7aea2161eb820cd0ff3430ccc/packaging/nnfw.spec#L208-L209

I haven't try to build for riscv in gbs . I will find the way .

hseok-oh commented 8 months ago

Our package may empty on RISC-V target. https://github.com/Samsung/ONE/blob/8533c5a001b129b7aea2161eb820cd0ff3430ccc/packaging/nnfw.spec#L208-L209

I haven't try to build for riscv in gbs . I will find the way .

Please refer PR #12343

chunseoklee commented 8 months ago

I will SBS to RISCV quickbuild at https://quickbuild.tizen.org/build/382461 -> accepted. (build success, submitted) -> accepted.