CMake/CPack变量之CMAKE_INSTALL_PREFIX

本文详细介绍了CMake中CMAKE_INSTALL_PREFIX变量的作用及其默认值,并解释了如何使用DESTDIR机制来改变安装位置,特别是在不同操作系统上的应用。此外,还提到了安装前缀如何被加入到CMAKE_SYSTEM_PREFIX_PATH中以辅助查找其他软件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

CMAKE_INSTALL_PREFIX

Install directory used by install.

If “make install” is invoked or INSTALL is built, this directory is prepended onto all install directories. This variable defaults to /usr/local on UNIX and c:/Program Files on Windows.

On UNIX one can use the DESTDIR mechanism in order to relocate the whole installation. DESTDIR means DESTination DIRectory. It is commonly used by makefile users in order to install software at non-default location. It is usually invoked like this:

make DESTDIR=/home/john install

which will install the concerned software using the installation prefix, e.g. “/usr/local” prepended with the DESTDIR value which finally gives “/home/john/usr/local”.

WARNING: DESTDIR may not be used on Windows because installation prefix usually contains a drive letter like in “C:/Program Files” which cannot be prepended with some other prefix.

The installation prefix is also added to CMAKE_SYSTEM_PREFIX_PATH so that find_package, find_program, find_library, find_path, and find_file will search the prefix for other software.

华为云Ascend C算子开发 环境搭(MindSpore) [ma-user SigmoidCustom]$bash build.sh using ASCEND_HOME_PATH: /home/ma-user/Ascend/ascend-toolkit/latest Preset CMake variables: ASCEND_COMPUTE_UNIT:STRING="ascend310b;ascend910b" ASCEND_PYTHON_EXECUTABLE:STRING="python3" CMAKE_BUILD_TYPE:STRING="Release" CMAKE_CROSS_PLATFORM_COMPILER:PATH="/usr/bin/aarch64-linux-gnu-g++" CMAKE_INSTALL_PREFIX:PATH="/home/ma-user/work/SigmoidCustom/SigmoidCustom/build_out" ENABLE_BINARY_PACKAGE:BOOL="True" ENABLE_CROSS_COMPILE:BOOL="False" ENABLE_SOURCE_PACKAGE:BOOL="True" ENABLE_TEST:BOOL="True" vendor_name:STRING="customize" -- The C compiler identification is GNU 7.3.0 CMake Warning (dev) at /home/ma-user/work/cmake-3.28.3-linux-aarch64/share/cmake-3.28/Modules/CMakeFindBinUtils.cmake:224 (find_program): Policy CMP0109 is not set: find_program() requires permission to execute but not to read. Run "cmake --help-policy CMP0109" for policy details. Use the cmake_policy command to set the policy and suppress this warning. The file /usr/bin/ld is executable but not readable. CMake is ignoring it for compatibility. Call Stack (most recent call first): /home/ma-user/work/cmake-3.28.3-linux-aarch64/share/cmake-3.28/Modules/CMakeDetermineCCompiler.cmake:196 (include) CMakeLists.txt:2 (project) This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning (dev) at /home/ma-user/work/cmake-3.28.3-linux-aarch64/share/cmake-3.28/Modules/CMakeFindBinUtils.cmake:224 (find_program): Policy CMP0109 is not set: find_program() requires permission to execute but not to read. Run "cmake --help-policy CMP0109" for policy details. Use the cmake_policy command to set the policy and suppress this warning. The file /bin/ld is executable but not readable. CMake is ignoring it for compatibility. Call Stack (most recent call first): /home/ma-user/work/cmake-3.28.3-linux-aarch64/share/cmake-3.28/Modules/CMakeDetermineCCompiler.cmake:196 (include) CMakeLists.txt:2 (project) This warning is for project developers. Use -Wno-dev to suppress it. -- The CXX compiler identification is GNU 7.3.0 CMake Warning (dev) at /home/ma-user/work/cmake-3.28.3-linux-aarch64/share/cmake-3.28/Modules/CMakeFindBinUtils.cmake:224 (find_program): Policy CMP0109 is not set: find_program() requires permission to execute but not to read. Run "cmake --help-policy CMP0109" for policy details. Use the cmake_policy command to set the policy and suppress this warning. The file /usr/bin/ld is executable but not readable. CMake is ignoring it for compatibility. Call Stack (most recent call first): /home/ma-user/work/cmake-3.28.3-linux-aarch64/share/cmake-3.28/Modules/CMakeDetermineCXXCompiler.cmake:202 (include) CMakeLists.txt:2 (project) This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning (dev) at /home/ma-user/work/cmake-3.28.3-linux-aarch64/share/cmake-3.28/Modules/CMakeFindBinUtils.cmake:224 (find_program): Policy CMP0109 is not set: find_program() requires permission to execute but not to read. Run "cmake --help-policy CMP0109" for policy details. Use the cmake_policy command to set the policy and suppress this warning. The file /bin/ld is executable but not readable. CMake is ignoring it for compatibility. Call Stack (most recent call first): /home/ma-user/work/cmake-3.28.3-linux-aarch64/share/cmake-3.28/Modules/CMakeDetermineCXXCompiler.cmake:202 (include) CMakeLists.txt:2 (project) This warning is for project developers. Use -Wno-dev to suppress it. -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Opbuild generating sources -- Opbuild generating sources - done -- Configuring done (3.3s) -- Generating done (0.0s) CMake Warning: Manually-specified variables were not used by the project: CMAKE_CROSS_PLATFORM_COMPILER -- Build files have been written to: /home/ma-user/work/SigmoidCustom/SigmoidCustom/build_out [ 7%] Building CXX object op_host/CMakeFiles/cust_optiling.dir/sigmoid_custom.cpp.o [ 14%] Building CXX object framework/tf_plugin/CMakeFiles/cust_tf_parsers.dir/tensorflow_sigmoid_custom_plugin.cc.o [ 21%] Generating scripts/install.sh, scripts/upgrade.sh [ 28%] Building CXX object op_host/CMakeFiles/cust_opapi.dir/__/autogen/aclnn_sigmoid_custom.cpp.o [ 28%] Built target gen_version_info [ 57%] Building CXX object op_host/CMakeFiles/cust_op_proto.dir/__/autogen/op_proto.cc.o [ 57%] Generating tbe/op_info_cfg/ai_core/ascend310b/aic-ascend310b-ops-info.json [ 57%] Generating tbe/.impl_timestamp [ 64%] Building CXX object op_host/CMakeFiles/cust_op_proto.dir/sigmoid_custom.cpp.o [ 64%] Generating tbe/op_info_cfg/ai_core/ascend910b/aic-ascend910b-ops-info.json [ 71%] Generating tbe/op_info_cfg/ai_core/npu_supported_ops.json /home/ma-user/work/SigmoidCustom/SigmoidCustom/build_out/autogen /home/ma-user/work/SigmoidCustom/SigmoidCustom/build_out/op_kernel/tbe/op_info_cfg/ai_core [ 71%] Built target modify_vendor ==============check valid for ops info start============== ==============check valid for ops info end================ ==============check valid for ops info start============== ==============check valid for ops info end================ Compile op info cfg successfully. Compile op info cfg successfully. [ 71%] Built target ops_info_gen_ascend310b [ 71%] Built target ops_info_gen_ascend910b [INFO] Succed generated /home/ma-user/work/SigmoidCustom/SigmoidCustom/build_out/op_kernel/tbe/op_info_cfg/ai_core/npu_supported_ops.json [ 71%] Built target ascendc_impl_gen [ 71%] Built target npu_supported_ops [ 78%] Linking CXX shared library libcust_opapi.so [ 78%] Built target cust_opapi [ 85%] Linking CXX shared library libcust_tf_parsers.so [ 85%] Built target cust_tf_parsers [ 92%] Linking CXX shared library libcust_opsproto_rt2.0.so [100%] Linking CXX shared library libcust_opmaster_rt2.0.so [100%] Built target cust_op_proto [100%] Built target cust_optiling [100%] Built target optiling_compat Run CPack packaging tool... CPack: Create package using External CPack: Install projects CPack: - Run preinstall target for: opp CPack: - Install project: opp [] CPack: Create package About to compress 596 KB of data... Adding files to archive named "custom_opp_euleros_aarch64.run"... ./help.info ./install.sh ./packages/vendors/customize/framework/tensorflow/libcust_tf_parsers.so ./packages/vendors/customize/framework/tensorflow/npu_supported_ops.json ./packages/vendors/customize/op_api/include/aclnn_sigmoid_custom.h ./packages/vendors/customize/op_api/lib/libcust_opapi.so ./packages/vendors/customize/op_impl/ai_core/tbe/config/ascend310b/aic-ascend310b-ops-info.json ./packages/vendors/customize/op_impl/ai_core/tbe/config/ascend910b/aic-ascend910b-ops-info.json ./packages/vendors/customize/op_impl/ai_core/tbe/customize_impl/dynamic/sigmoid_custom.cpp ./packages/vendors/customize/op_impl/ai_core/tbe/customize_impl/dynamic/sigmoid_custom.py ./packages/vendors/customize/op_impl/ai_core/tbe/kernel/ascend310b/sigmoid_custom/ ./packages/vendors/customize/op_impl/ai_core/tbe/kernel/ascend910b/sigmoid_custom/ ./packages/vendors/customize/op_impl/ai_core/tbe/kernel/config/ascend310b/ ./packages/vendors/customize/op_impl/ai_core/tbe/kernel/config/ascend910b/ ./packages/vendors/customize/op_impl/ai_core/tbe/op_tiling/lib/linux/aarch64/libcust_opmaster_rt2.0.so ./packages/vendors/customize/op_impl/ai_core/tbe/op_tiling/liboptiling.so ./packages/vendors/customize/op_proto/inc/op_proto.h ./packages/vendors/customize/op_proto/lib/linux/aarch64/libcust_opsproto_rt2.0.so ./packages/vendors/customize/version.info ./upgrade.sh CRC: 1499435367 SHA256: 132259459f6127571b863c6b1d537ab0b4bc03d419dcefd6159d37927d379782 Skipping md5sum at user request Self-extractable archive "custom_opp_euleros_aarch64.run" successfully created. Copy /home/ma-user/work/SigmoidCustom/SigmoidCustom/build_out/_CPack_Packages/Linux/External/custom_opp_euleros_aarch64.run/custom_opp_euleros_aarch64.run to /home/ma-user/work/SigmoidCustom/SigmoidCustom/build_out/ CPack: - package: /home/ma-user/work/SigmoidCustom/SigmoidCustom/build_out/custom_opp_euleros_aarch64.run.json generated. CPack: - package: /home/ma-user/work/SigmoidCustom/SigmoidCustom/build_out/custom_opp_euleros_aarch64.run generated. Verifying archive integrity... 100% SHA256 checksums are OK. All good. Uncompressing version:1.0 100% [ops_custom] [2025-06-23 23:33:13] [INFO] copy uninstall sh success [ops_custom] [2025-06-23 23:33:13] [INFO] upgrade framework tensorflow [ops_custom] [2025-06-23 23:33:13] [INFO] replace or merge old ops framework files .g..... [ops_custom] [2025-06-23 23:33:13] copy new ops framework files ...... [ops_custom] [2025-06-23 23:33:14] [INFO] upgrade op proto inc lib [ops_custom] [2025-06-23 23:33:14] [INFO] replace or merge old ops op_proto files .g..... [ops_custom] [2025-06-23 23:33:14] copy new ops op_proto files ...... [ops_custom] [2025-06-23 23:33:14] [INFO] upgrade op impl ai_core [ops_custom] [2025-06-23 23:33:14] [INFO] replace or merge old ops op_impl files .g..... [ops_custom] [2025-06-23 23:33:14] copy new ops op_impl files ...... [ops_custom] [2025-06-23 23:33:14] [INFO] upgrade op api include lib [ops_custom] [2025-06-23 23:33:14] [INFO] replace or merge old ops op_api files .g..... [ops_custom] [2025-06-23 23:33:14] copy new ops op_api files ...... [ops_custom] [2025-06-23 23:33:14] [INFO] upgrade version.info [ops_custom] [2025-06-23 23:33:14] copy new version.info files ...... [ops_custom] [2025-06-23 23:33:14] [INFO] no need to upgrade custom.proto files [ops_custom] [2025-06-23 23:33:14] [INFO] using requirements: when custom module install finished or before you run the custom module, execute the command [ export LD_LIBRARY_PATH=/home/ma-user/Ascend/ascend-toolkit/latest/opp/vendors/customize/op_api/lib/:${LD_LIBRARY_PATH} ] to set the environment path SUCCESS [100%] Built target ascendc_impl_gen [100%] Built target ascendc_bin_ascend910b_sigmoid_custom_copy [100%] Built target ascendc_bin_ascend310b_sigmoid_custom_copy [100%] Built target ascendc_bin_ascend910b [100%] Built target ascendc_bin_ascend310b [Ascend310B1] Generating SigmoidCustom_a3c9eb1f1b227778957282b95ed93786 ... [Ascend910B1] Generating SigmoidCustom_a3c9eb1f1b227778957282b95ed93786 ... [ERROR] TBE(123105,python3):2025-06-23-23:33:18.348.085 [../../../opc_tool/opc_common.py:218][_log_error] Traceback (most recent call last): File "/home/ma-user/Ascend/ascend-toolkit/8.0.RC1.alpha002/python/site-packages/opc_tool/op_compilation.py", line 417, in get_op_func_attr opm = importlib.import_module(op_module) File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 680, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 850, in exec_module [ERROR] TBE(123105,python3):2025-06-23-23:33:18.348.235 [../../../opc_tool/opc_common.py:218][_log_error] File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "/home/ma-user/work/SigmoidCustom/SigmoidCustom/build_out/op_kernel/binary/ascend910b/src/SigmoidCustom.py", line 14, in <module> from tbe.tikcpp.compile_op import CommonUtility, AscendCLogLevel ImportError: cannot import name 'CommonUtility' from 'tbe.tikcpp.compile_op' (/home/ma-user/Ascend/ascend-toolkit/8.0.RC1.alpha002/python/site-packages/tbe/tikcpp/compile_op.py) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/ma-user/Ascend/ascend-toolkit/8.0.RC1.alpha002/python/site-packages/opc_tool/op_compilation.py", line 559, in single_op_compilation self.__op_compile_by_json_info(json_dict) [ERROR] TBE(123105,python3):2025-06-23-23:33:18.348.409 [../../../opc_tool/op_compilation.py:562][single_op_compilation] Compile failed, reason is: import src.SigmoidCustom error, reason:cannot import name 'CommonUtility' from 'tbe.tikcpp.compile_op' (/home/ma-user/Ascend/ascend-toolkit/8.0.RC1.alpha002/python/site-packages/tbe/tikcpp/compile_op.py).. [ERROR] TBE(123105,python3):2025-06-23-23:33:18.348.498 [../../../opc_tool/opc.py:696][main] Opc tool compile failed. Opc tool start working now, please wait for a moment. /home/ma-user/work/SigmoidCustom/SigmoidCustom/build_out/op_kernel/binary/ascend910b/bin/sigmoid_custom/SigmoidCustom_a3c9eb1f1b227778957282b95ed93786.json not generated! gmake[3]: *** [op_kernel/CMakeFiles/ascendc_bin_ascend910b_sigmoid_custom_0.dir/build.make:70: op_kernel/CMakeFiles/ascendc_bin_ascend910b_sigmoid_custom_0] Error 1 gmake[2]: *** [CMakeFiles/Makefile2:645: op_kernel/CMakeFiles/ascendc_bin_ascend910b_sigmoid_custom_0.dir/all] Error 2 gmake[2]: *** Waiting for unfinished jobs.... [ERROR] TBE(123103,python3):2025-06-23-23:33:18.302.945 [../../../opc_tool/opc_common.py:218][_log_error] Traceback (most recent call last): File "/home/ma-user/Ascend/ascend-toolkit/8.0.RC1.alpha002/python/site-packages/opc_tool/op_compilation.py", line 417, in get_op_func_attr opm = importlib.import_module(op_module) File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 680, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 850, in exec_module [ERROR] TBE(123103,python3):2025-06-23-23:33:18.303.138 [../../../opc_tool/opc_common.py:218][_log_error] File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "/home/ma-user/work/SigmoidCustom/SigmoidCustom/build_out/op_kernel/binary/ascend310b/src/SigmoidCustom.py", line 14, in <module> from tbe.tikcpp.compile_op import CommonUtility, AscendCLogLevel ImportError: cannot import name 'CommonUtility' from 'tbe.tikcpp.compile_op' (/home/ma-user/Ascend/ascend-toolkit/8.0.RC1.alpha002/python/site-packages/tbe/tikcpp/compile_op.py) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/ma-user/Ascend/ascend-toolkit/8.0.RC1.alpha002/python/site-packages/opc_tool/op_compilation.py", line 559, in single_op_compilation self.__op_compile_by_json_info(json_dict) [ERROR] TBE(123103,python3):2025-06-23-23:33:18.303.315 [../../../opc_tool/op_compilation.py:562][single_op_compilation] Compile failed, reason is: import src.SigmoidCustom error, reason:cannot import name 'CommonUtility' from 'tbe.tikcpp.compile_op' (/home/ma-user/Ascend/ascend-toolkit/8.0.RC1.alpha002/python/site-packages/tbe/tikcpp/compile_op.py).. [ERROR] TBE(123103,python3):2025-06-23-23:33:18.303.558 [../../../opc_tool/opc.py:696][main] Opc tool compile failed. Opc tool start working now, please wait for a moment. /home/ma-user/work/SigmoidCustom/SigmoidCustom/build_out/op_kernel/binary/ascend310b/bin/sigmoid_custom/SigmoidCustom_a3c9eb1f1b227778957282b95ed93786.json not generated! gmake[3]: *** [op_kernel/CMakeFiles/ascendc_bin_ascend310b_sigmoid_custom_0.dir/build.make:70: op_kernel/CMakeFiles/ascendc_bin_ascend310b_sigmoid_custom_0] Error 1 gmake[2]: *** [CMakeFiles/Makefile2:514: op_kernel/CMakeFiles/ascendc_bin_ascend310b_sigmoid_custom_0.dir/all] Error 2 gmake[1]: *** [CMakeFiles/Makefile2:416: op_kernel/CMakeFiles/binary.dir/rule] Error 2 gmake: *** [Makefile:306: binary] Error 2 [ERROR] Kernel compile failed, the run package will not be generated.
最新发布
06-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值