HarmonyOS 鸿蒙Next full sdk:ld.lld: error: unable to find library -lGL

发布于 1周前 作者 caililin 来自 鸿蒙OS

HarmonyOS 鸿蒙Next full sdk:ld.lld: error: unable to find library -lGL 在根据文档 https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/full-sdk-compile-guide.md 编译3.2B5的full SDK,运行命令./build.sh --product-name ohos-sd时,出现以下错误:

[OHOS INFO] [349/12111] ACTION //foundation/arkui/ace_engine/frameworks/core/components/transition:ace_core_components_transition_windows__notice(//build/toolchain/mingw:mingw_x86_64)
[OHOS INFO] [350/12111] CXX clang_x64/obj/foundation/arkui/napi/native_engine/impl/ark/native_value/ace_napi_impl_ark/ark_native_value.o
[OHOS INFO] [351/12111] CXX clang_x64/obj/foundation/arkui/ace_engine/interfaces/napi/kits/prompt/prompt_static_linux/js_prompt.o
[OHOS INFO] [352/12111] CXX clang_x64/obj/tools_previewer/rich_previewer/RichPreviewer.o
[OHOS INFO] [353/12111] CXX clang_x64/obj/foundation/arkui/ace_engine/interfaces/napi/kits/utils/napi_utils_static_linux/napi_utils.o
[OHOS ERROR] [348/12111] SOLINK clang_x64/thirdparty/flutter/libskia_shared.so
[OHOS ERROR] FAILED: clang_x64/thirdparty/flutter/libskia_shared.so clang_x64/lib.unstripped/clang_x64/thirdparty/flutter/libskia_shared.so 
[OHOS ERROR] /usr/bin/env "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="nm" --strip=../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-strip  --sofile="clang_x64/lib.unstripped/clang_x64/thirdparty/flutter/libskia_shared.so"  --output="clang_x64/thirdparty/flutter/libskia_shared.so" --mini-debug -- ../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang++ -shared -Wl,--fatal-warnings -Wl,--build-id=md5 -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--as-needed -fuse-ld=lld -Wl,--icf=all -Wl,--color-diagnostics -m64 -Werror -Wl,-O2 -Wl,--gc-sections -rdynamic -o "clang_x64/lib.unstripped/clang_x64/thirdparty/flutter/libskia_shared.so" @"clang_x64/thirdparty/flutter/libskia_shared.so.rsp" -Wl,-soname="libskia_shared.so"
[OHOS ERROR] ld.lld: error: unable to find library -lGL
[OHOS ERROR] clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
[OHOS ERROR] Traceback (most recent call last):
[OHOS ERROR]   File "/home/a/fullSDK/build/hb/services/ninja.py", line 48, in _execute_ninja_cmd
[OHOS ERROR]     SystemUtil.exec_command(
[OHOS ERROR]   File "/home/a/fullSDK/build/hb/util/system_util.py", line 63, in exec_command
[OHOS ERROR]     raise OHOSException(
[OHOS ERROR] exceptions.ohos_exception.OHOSException: Please check build log in /home/a/fullSDK/out/sdk/build.log
[OHOS ERROR] 
[OHOS ERROR] During handling of the above exception, another exception occurred:
[OHOS ERROR] 
[OHOS ERROR] Traceback (most recent call last):
[OHOS ERROR]   File "/home/a/fullSDK/build/hb/containers/status.py", line 47, in wrapper
[OHOS ERROR]     return func(*args, **kwargs)
[OHOS ERROR]   File "/home/a/fullSDK/build/hb/modules/ohos_build_module.py", line 67, in run
[OHOS ERROR]     raise exception
[OHOS ERROR]   File "/home/a/fullSDK/build/hb/modules/ohos_build_module.py", line 65, in run
[OHOS ERROR]     super().run()
[OHOS ERROR]   File "/home/a/fullSDK/build/hb/modules/interface/build_module_interface.py", line 72, in run
[OHOS ERROR]     raise exception
[OHOS ERROR]   File "/home/a/fullSDK/build/hb/modules/interface/build_module_interface.py", line 70, in run
[OHOS ERROR]     self._target_compilation()
[OHOS ERROR]   File "/home/a/fullSDK/build/hb/modules/ohos_build_module.py", line 103, in _target_compilation
[OHOS ERROR]     self.target_compiler.run()
[OHOS ERROR]   File "/home/a/fullSDK/build/hb/services/ninja.py", line 37, in run
[OHOS ERROR]     self._execute_ninja_cmd()
[OHOS ERROR]   File "/home/a/fullSDK/build/hb/services/ninja.py", line 51, in _execute_ninja_cmd
[OHOS ERROR]     raise OHOSException('ninja phase failed', '4000')
[OHOS ERROR] exceptions.ohos_exception.OHOSException: ninja phase failed
[OHOS ERROR] 
[OHOS ERROR] Code:      4000
[OHOS ERROR] 
[OHOS ERROR] Reason:    ninja phase failed
[OHOS ERROR] 
[OHOS ERROR] Solution:  Please check the compile log at out/{compiling product}/build.log, If you could analyze build logs. 
[OHOS ERROR]            Or you can try the following steps to solve this problem:
[OHOS ERROR]              1. cd to OHOS root path
[OHOS ERROR]              2. run 'hb clean --all' or 'rm -rf out build/resources/args/*.json'.
[OHOS ERROR]              3. repo sync
[OHOS ERROR]              4. repo forall -c 'git lfs pull'
[OHOS ERROR]              5. bash build/prebuilts_download.sh
[OHOS ERROR]              6. rebuild your product or component
[OHOS ERROR] 
[OHOS ERROR]            If you still cannot solve this problem, you could post this problem on: 
[OHOS ERROR]              https://gitee.com/openharmony/build/issues
[OHOS ERROR] 
=====build  error=====

但在我的库文件夹中已经存在上述缺失库:

a@lb_ohos_lab:~/fullSDK$ find /usr/lib/ -name libGL*
/usr/lib/x86_64-linux-gnu/libGLX.so.0.0.0
/usr/lib/x86_64-linux-gnu/libGLdispatch.so.0
/usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0.0.0
/usr/lib/x86_64-linux-gnu/libGLX_indirect.so.0
/usr/lib/x86_64-linux-gnu/libGLdispatch.so.0.0.0
/usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0
/usr/lib/x86_64-linux-gnu/libGL.so.1
/usr/lib/x86_64-linux-gnu/libGLX.so.0
/usr/lib/x86_64-linux-gnu/libGL.so.1.0.0
a@lb_ohos_lab:~/fullSDK$ 

更多关于HarmonyOS 鸿蒙Next full sdk:ld.lld: error: unable to find library -lGL的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html

2 回复

我的ubuntu版本为18.04Server

更多关于HarmonyOS 鸿蒙Next full sdk:ld.lld: error: unable to find library -lGL的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


针对帖子标题“HarmonyOS 鸿蒙Next full sdk:ld.lld: error: unable to find library -lGL”的问题,直接回答如下:

在HarmonyOS鸿蒙系统中遇到链接器(ld.lld)报告无法找到-lGL库的错误,通常意味着链接器在尝试链接OpenGL相关的库时未能找到它。在HarmonyOS的开发环境中,OpenGL库可能不是默认提供的,或者其命名和路径与传统系统有所不同。

  1. 确认OpenGL支持:首先确认HarmonyOS的版本和SDK是否支持OpenGL。由于HarmonyOS主要面向物联网和嵌入式设备,可能并不完全支持桌面级的图形库。

  2. 库文件路径:检查-lGL库的路径是否已正确配置在链接器的搜索路径中。这通常涉及修改编译器的链接选项,如添加-L(指定库搜索路径)和-l(指定库名)选项。

  3. 替代库:如果HarmonyOS不支持OpenGL,考虑使用其他图形库,如Vulkan(如果支持)或其他鸿蒙系统专用的图形API。

  4. 系统配置:检查系统配置和文档,确认是否有关于图形库支持的特别说明或配置要求。

如果问题依旧没法解决请联系官网客服,官网地址是:https://www.itying.com/category-93-b0.html

回到顶部