diff --git a/recipes-openharmony/openharmony/openharmony-standard-3.1/foundation_graphic_standard-flexlexer-h.patch b/recipes-openharmony/openharmony/openharmony-standard-3.1/foundation_graphic_standard-flexlexer-h.patch
new file mode 100644
index 0000000000000000000000000000000000000000..0bc8a388ba6fbf4ab2680c8e4c989ec70c118c2c
--- /dev/null
+++ b/recipes-openharmony/openharmony/openharmony-standard-3.1/foundation_graphic_standard-flexlexer-h.patch
@@ -0,0 +1,52 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+Fix host OS dependency on flex package by copying the FlexLexer.h file from recipe-sysroot-native.
+
+Apply to foundation/graphic/standard repository.
+
+Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
+Upstream-Status: Pending
+
+diff --git a/utils/lex_yacc/gen_flexlexer_header.py b/utils/lex_yacc/gen_flexlexer_header.py
+index cde71464bfe8..f32c7e68184d 100755
+--- a/utils/lex_yacc/gen_flexlexer_header.py
++++ b/utils/lex_yacc/gen_flexlexer_header.py
+@@ -22,10 +22,11 @@ import sys
+ def parse_args(args):
+     parser = optparse.OptionParser()
+     parser.add_option("--output")
++    parser.add_option("--includedir", default="/usr/include")
+     opts, _ = parser.parse_args(args)
+     return opts
+ 
+ if __name__ == '__main__':
+     options = parse_args(sys.argv[1:])
+     parse_scripts = subprocess.check_call(
+-        ["cp", "-f", "/usr/include/FlexLexer.h", options.output])
++        ["cp", "-f", "%s/FlexLexer.h"%(options.includedir,), options.output])
+diff --git a/utils/lex_yacc/lex_yacc.gni b/utils/lex_yacc/lex_yacc.gni
+index 5c27743c507e..905252a93cf7 100644
+--- a/utils/lex_yacc/lex_yacc.gni
++++ b/utils/lex_yacc/lex_yacc.gni
+@@ -15,6 +15,10 @@ import("//build/ohos.gni")
+ 
+ gni_filepath = "//foundation/graphic/standard/utils/lex_yacc"
+ 
++declare_args() {
++  flex_includedir = "/usr/include"
++}
++
+ template("lex_yacc") {
+   lex_name = invoker.lex
+   yacc_name = invoker.yacc
+@@ -33,6 +37,8 @@ template("lex_yacc") {
+     args = [
+       "--output",
+       flexlexer_pathname,
++      "--includedir",
++      rebase_path(flex_includedir)
+     ]
+   }
+ 
diff --git a/recipes-openharmony/openharmony/openharmony-standard_3.1.bb b/recipes-openharmony/openharmony/openharmony-standard_3.1.bb
index 40014b5236284959d500344f07de87c8e3249c6b..60d06e91c943412053c1bae6fde6fccdaa52d205 100644
--- a/recipes-openharmony/openharmony/openharmony-standard_3.1.bb
+++ b/recipes-openharmony/openharmony/openharmony-standard_3.1.bb
@@ -66,6 +66,7 @@ SRC_URI += "file://developtools_hdc_standard-gcc.patch;patchdir=${S}/developtool
 SRC_URI += "file://foundation_graphic_standard-hdi-display-layer.patch;patchdir=${S}/foundation/graphic/standard"
 SRC_URI += "file://third_party_weston-hdi-display-layer.patch;patchdir=${S}/third_party/weston"
 SRC_URI += "file://third_party_selinux-flex-bison-path.patch;patchdir=${S}/third_party/selinux"
+SRC_URI += "file://foundation_graphic_standard-flexlexer-h.patch;patchdir=${S}/foundation/graphic/standard"
 SRC_URI += "file://features.json;subdir=${OHOS_BUILD_CONFIGS_DIR}"
 
 # Patch to allow /system/profile and /system/usr to be symlinks to /usr/lib/openharmony
@@ -114,6 +115,7 @@ GN_ARGS += 'host_toolchain="//oniro:clang_x64"'
 GN_ARGS += 'install_oniro_third_party=false'
 GN_ARGS += 'flex_path="${RECIPE_SYSROOT_NATIVE}/usr/bin/flex"'
 GN_ARGS += 'bison_path="${RECIPE_SYSROOT_NATIVE}/usr/bin/bison"'
+GN_ARGS += 'flex_includedir="${RECIPE_SYSROOT_NATIVE}/usr/include"'
 
 # OpenHarmony unit tests are statically linked and therefore not stripped
 # binaries sum up to almost 80GB which makes it difficult to build OpenHarmony