ESP32: gn.py: Could not find checkout in any parent of the current path. This must be run inside a checkout - linux

complying an ESP32 project using the MATTER protocol from the github project: Connectedhomeip (https://github.com/project-chip/connectedhomeip/tree/master/examples/all-clusters-app/esp32)
im using ubuntu 20.02, tried using python 3.8 and 3.9 no difference to error.
i followed the following instructions from the above link, the instruction as pasted below
Building the Example Application
Building the example application requires the use of the Espressif ESP32 IoT Development Framework and the xtensa-esp32-elf toolchain for ESP32 modules or the riscv-esp32-elf toolchain for ESP32C3 modules.
The VSCode devcontainer has these components pre-installed, so you can skip this step. To install these components manually, follow these steps:
Clone the Espressif ESP-IDF and checkout v4.4 release
$ mkdir ${HOME}/tools
$ cd ${HOME}/tools
$ git clone https://github.com/espressif/esp-idf.git
$ cd esp-idf
$ git checkout v4.4
$ git submodule update --init
$ ./install.sh
Install ninja-build
$ sudo apt-get install ninja-build
Currently building in VSCode and deploying from native is not supported, so make sure the IDF_PATH has been exported(See the manual setup steps above).
Setting up the environment
$ cd ${HOME}/tools/esp-idf
$ ./install.sh
$ . ./export.sh
$ cd {path-to-connectedhomeip}
To download and install packages.
$ source ./scripts/bootstrap.sh
$ source ./scripts/activate.sh
If packages are already installed then simply activate them.
$ source ./scripts/activate.sh
Target Set
To set IDF target, run set-target with one of the commands.
$ idf.py set-target esp32
$ idf.py set-target esp32c3
Configuration Options
To build the default configuration (sdkconfig.defaults) skip to building the demo application.
To build a specific configuration (as an example m5stack):
$ rm sdkconfig
$ idf.py -D 'SDKCONFIG_DEFAULTS=sdkconfig_m5stack.defaults' build
Note: If using a specific device configuration, it is highly recommended to
start off with one of the defaults and customize on top of that. Certain
configurations have different constraints that are customized within the
device specific configuration (eg: main app stack size).
To customize the configuration, run menuconfig.
$ idf.py menuconfig
Select ESP32 based Device Type through Demo->Device Type. The device types that are currently supported include ESP32-DevKitC (default), ESP32-WROVER-KIT_V4.1, M5Stack and ESP32C3-DevKitM.
To build the demo application.
$ idf.py build
After building the application, to flash it outside of VSCode, connect your device via USB. Then run the following command to flash the demo application onto the device and then monitor its output. If necessary, replace /dev/tty.SLAB_USBtoUART(MacOS) with the correct USB device name for your system(like /dev/ttyUSB0 on Linux). Note that sometimes you might have to press and hold the boot button on the device while it's trying to connect before flashing. For ESP32-DevKitC devices this is labeled in the functional description diagram.
$ idf.py -p /dev/tty.SLAB_USBtoUART flash monitor
When use >>idf.py to build the project i get the follow error
>>idf.py build
Executing action: all (aliases: build)
Running ninja in directory /home/csir/connectedhomeip/examples/all-clusters-app/esp32/build
Executing "ninja all"...
ninja: warning: bad deps log signature or version; starting over
[0/1] Re-running CMake...
-- Building ESP-IDF components for target esp32
-- Found Python3: /home/csir/.espressif/python_env/idf5.0_py3.8_env/bin/python3.8 (found version "3.8.10") found components: Interpreter
-- Project sdkconfig file /home/csir/connectedhomeip/examples/all-clusters-app/esp32/sdkconfig
Loading defaults file /home/csir/connectedhomeip/examples/all-clusters-app/esp32/sdkconfig.defaults...
-- App "chip-all-clusters-app" version: TE8/rc2-7-gf32685f35-dirty
-- Adding linker script /home/csir/connectedhomeip/examples/all-clusters-app/esp32/build/esp-idf/esp_system/ld/memory.ld
-- Adding linker script /home/csir/esp/esp-idf/components/esp_system/ld/esp32/sections.ld.in
-- Adding linker script /home/csir/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/csir/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /home/csir/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/csir/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script /home/csir/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script /home/csir/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /home/csir/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-time.ld
-- Adding linker script /home/csir/esp/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
-- Components: QRCode app_trace app_update asio bootloader bootloader_support bt chip cmock coap console cxx driver efuse esp-tls esp32 esp32_mbedtls esp_adc_cal esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_lcd esp_local_ctrl esp_netif esp_phy esp_pm esp_ringbuf esp_rom esp_serial_slave_link esp_system esp_timer esp_websocket_client esp_wifi espcoredump esptool_py fatfs freemodbus freertos hal heap http_parser idf_test ieee802154 iperf json led_strip log lwip main mbedtls mdns mqtt newlib nvs_flash openssl openthread partition_table pcap perfmon pid_ctrl protobuf-c protocol_examples_common protocomm pthread qrcode screen-framework sdmmc soc spi_flash spidriver spiffs tcp_transport tcpip_adapter tft tinyusb ulp unity usb vfs wear_levelling wifi_provisioning wpa_supplicant xtensa
-- Component paths: /home/csir/connectedhomeip/examples/common/QRCode /home/csir/esp/esp-idf/components/app_trace /home/csir/esp/esp-idf/components/app_update /home/csir/esp/esp-idf/components/asio /home/csir/esp/esp-idf/components/bootloader /home/csir/esp/esp-idf/components/bootloader_support /home/csir/esp/esp-idf/components/bt /home/csir/connectedhomeip/examples/all-clusters-app/esp32/third_party/connectedhomeip/config/esp32/components/chip /home/csir/esp/esp-idf/components/cmock /home/csir/esp/esp-idf/components/coap /home/csir/esp/esp-idf/components/console /home/csir/esp/esp-idf/components/cxx /home/csir/esp/esp-idf/components/driver /home/csir/esp/esp-idf/components/efuse /home/csir/esp/esp-idf/components/esp-tls /home/csir/esp/esp-idf/components/esp32 /home/csir/connectedhomeip/examples/all-clusters-app/esp32/third_party/connectedhomeip/config/esp32/components/esp32_mbedtls /home/csir/esp/esp-idf/components/esp_adc_cal /home/csir/esp/esp-idf/components/esp_common /home/csir/esp/esp-idf/components/esp_eth /home/csir/esp/esp-idf/components/esp_event /home/csir/esp/esp-idf/components/esp_gdbstub /home/csir/esp/esp-idf/components/esp_hid /home/csir/esp/esp-idf/components/esp_http_client /home/csir/esp/esp-idf/components/esp_http_server /home/csir/esp/esp-idf/components/esp_https_ota /home/csir/esp/esp-idf/components/esp_https_server /home/csir/esp/esp-idf/components/esp_hw_support /home/csir/esp/esp-idf/components/esp_lcd /home/csir/esp/esp-idf/components/esp_local_ctrl /home/csir/esp/esp-idf/components/esp_netif /home/csir/esp/esp-idf/components/esp_phy /home/csir/esp/esp-idf/components/esp_pm /home/csir/esp/esp-idf/components/esp_ringbuf /home/csir/esp/esp-idf/components/esp_rom /home/csir/esp/esp-idf/components/esp_serial_slave_link /home/csir/esp/esp-idf/components/esp_system /home/csir/esp/esp-idf/components/esp_timer /home/csir/esp/esp-idf/components/esp_websocket_client /home/csir/esp/esp-idf/components/esp_wifi /home/csir/esp/esp-idf/components/espcoredump /home/csir/esp/esp-idf/components/esptool_py /home/csir/esp/esp-idf/components/fatfs /home/csir/esp/esp-idf/components/freemodbus /home/csir/esp/esp-idf/components/freertos /home/csir/esp/esp-idf/components/hal /home/csir/esp/esp-idf/components/heap /home/csir/esp/esp-idf/components/http_parser /home/csir/esp/esp-idf/components/idf_test /home/csir/esp/esp-idf/components/ieee802154 /home/csir/esp/esp-idf/examples/common_components/iperf /home/csir/esp/esp-idf/components/json /home/csir/esp/esp-idf/examples/common_components/led_strip /home/csir/esp/esp-idf/components/log /home/csir/esp/esp-idf/components/lwip /home/csir/connectedhomeip/examples/all-clusters-app/esp32/main /home/csir/esp/esp-idf/components/mbedtls /home/csir/esp/esp-idf/components/mdns /home/csir/esp/esp-idf/components/mqtt /home/csir/esp/esp-idf/components/newlib /home/csir/esp/esp-idf/components/nvs_flash /home/csir/esp/esp-idf/components/openssl /home/csir/esp/esp-idf/components/openthread /home/csir/esp/esp-idf/components/partition_table /home/csir/esp/esp-idf/examples/common_components/pcap /home/csir/esp/esp-idf/components/perfmon /home/csir/esp/esp-idf/examples/common_components/pid_ctrl /home/csir/esp/esp-idf/components/protobuf-c /home/csir/esp/esp-idf/examples/common_components/protocol_examples_common /home/csir/esp/esp-idf/components/protocomm /home/csir/esp/esp-idf/components/pthread /home/csir/esp/esp-idf/examples/common_components/qrcode /home/csir/connectedhomeip/examples/common/screen-framework /home/csir/esp/esp-idf/components/sdmmc /home/csir/esp/esp-idf/components/soc /home/csir/esp/esp-idf/components/spi_flash /home/csir/connectedhomeip/examples/common/m5stack-tft/repo/components/spidriver /home/csir/esp/esp-idf/components/spiffs /home/csir/esp/esp-idf/components/tcp_transport /home/csir/esp/esp-idf/components/tcpip_adapter /home/csir/connectedhomeip/examples/common/m5stack-tft/repo/components/tft /home/csir/esp/esp-idf/components/tinyusb /home/csir/esp/esp-idf/components/ulp /home/csir/esp/esp-idf/components/unity /home/csir/esp/esp-idf/components/usb /home/csir/esp/esp-idf/components/vfs /home/csir/esp/esp-idf/components/wear_levelling /home/csir/esp/esp-idf/components/wifi_provisioning /home/csir/esp/esp-idf/components/wpa_supplicant /home/csir/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: /home/csir/connectedhomeip/examples/all-clusters-app/esp32/build
[7/1126] Generating ../../partition_table/partition-table.bin
Partition table binary generated. Contents:
*******************************************************************************
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,24K,
otadata,data,ota,0xf000,8K,
phy_init,data,phy,0x11000,4K,
ota_0,app,ota_0,0x20000,1500K,
ota_1,app,ota_1,0x1a0000,1500K,
ot_storage,data,58,0x317000,8K,
*******************************************************************************
[261/1126] Performing configure step for 'bootloader'
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /home/csir/connectedhomeip/examples/all-clusters-app/esp32/sdkconfig
-- Adding linker script /home/csir/esp/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
-- Adding linker script /home/csir/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/csir/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /home/csir/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/csir/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /home/csir/esp/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.ld
-- Adding linker script /home/csir/esp/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp32 esp_common esp_hw_support esp_rom esp_system esptool_py freertos hal log main micro-ecc newlib partition_table soc spi_flash xtensa
-- Component paths: /home/csir/esp/esp-idf/components/bootloader /home/csir/esp/esp-idf/components/bootloader_support /home/csir/esp/esp-idf/components/efuse /home/csir/esp/esp-idf/components/esp32 /home/csir/esp/esp-idf/components/esp_common /home/csir/esp/esp-idf/components/esp_hw_support /home/csir/esp/esp-idf/components/esp_rom /home/csir/esp/esp-idf/components/esp_system /home/csir/esp/esp-idf/components/esptool_py /home/csir/esp/esp-idf/components/freertos /home/csir/esp/esp-idf/components/hal /home/csir/esp/esp-idf/components/log /home/csir/esp/esp-idf/components/bootloader/subproject/main /home/csir/esp/esp-idf/components/bootloader/subproject/components/micro-ecc /home/csir/esp/esp-idf/components/newlib /home/csir/esp/esp-idf/components/partition_table /home/csir/esp/esp-idf/components/soc /home/csir/esp/esp-idf/components/spi_flash /home/csir/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: /home/csir/connectedhomeip/examples/all-clusters-app/esp32/build/bootloader
[270/1126] Performing build step for 'bootloader'
[1/1] cd /home/csir/connectedhomeip/examples/all-clusters-app/esp32/build/bootloader/esp-idf/esptool_py && /home/csir/.espressif/python_env/idf5.0_py3.8_env/bin/python /home/csir/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 /home/csir/connectedhomeip/examples/all-clusters-app/esp32/build/bootloader/bootloader.bin
Bootloader binary size 0x6360 bytes. 0xca0 bytes (11%) free.
[585/1125] Performing configure step for 'chip_gn'
FAILED: esp-idf/chip/chip_gn-prefix/src/chip_gn-stamp/chip_gn-configure
cd /home/csir/connectedhomeip/examples/all-clusters-app/esp32/build/esp-idf/chip && /home/csir/depot_tools/gn --root=/home/csir/connectedhomeip/config/esp32 gen --check --fail-on-unused-args /home/csir/connectedhomeip/examples/all-clusters-app/esp32/build/esp-idf/chip && /usr/bin/cmake -E touch /home/csir/connectedhomeip/examples/all-clusters-app/esp32/build/esp-idf/chip/chip_gn-prefix/src/chip_gn-stamp/chip_gn-configure
gn.py: Could not find checkout in any parent of the current path.
This must be run inside a checkout.
[586/1125] Building C object esp-idf/esp_serial_slave_link/CMakeFiles/__idf_esp_serial_slave_link.dir/essl_spi.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
I can see that the problem is in the file ~/depot_tools/gn.py
with the line 50: bin_path = gclient_paths.GetBuildtoolsPlatformBinaryPath()
gclient_paths.GetBuildtoolsPlatformBinaryPath() returns "none"
what should the value be?

Some hours ago I had exactly the same problem.
In my case, I didn't run $ source ./scripts/bootstrap.sh because I didn't worked, but I clone the whole git again in my home folder, lauched the command and (after almost an hour) run idf.py set-target esp32 and idf.py build and it finally worked.
I followed more or less the following steps from this issue in Matter repo and it helped a lot:
https://github.com/project-chip/connectedhomeip/issues/15562#issuecomment-1057750597
Hope this works for you!

Related

"gnu/stubs-o32_hard.h: No such file or directory" golang cgo mipsel embedded chip system fatal error:

1. bg: i got a project to develop the embedded camera system, the system is using mips 32bit, i got the toolchain in ubuntu. go version: 1.17.7
2. my question:
2.1) pure golang cross compile into mipsle platform is good and working.the command it use is :
GOOS=linux GOARCH=mipsle CGO_ENABLED=0 go build main.go
2.2) but i got some third-party lib which they offer as xxx.so and xxx.h to me. when i finish coding it into my go project using cgo. i want to cross complie into mips system which i found fail.
3. what i had try:
3.1) i know go is not support cross complie cgo, so i try the normal way which is like this:
GOOS=linux GOARCH=mipsle CGO_ENABLED=1 CC=/opt/mips-gcc720-glibc226/bin/mips-linux-gnu-gcc go build main.go
result:
# runtime/cgo
In file included from /opt/mips-gcc720-glibc226/mips-linux-gnu/libc/usr/include/features.h:447:0,
from /opt/mips-gcc720-glibc226/mips-linux-gnu/libc/usr/include/bits/libc-header-start.h:33,
from /opt/mips-gcc720-glibc226/mips-linux-gnu/libc/usr/include/stdlib.h:25,
from _cgo_export.c:3:
/opt/mips-gcc720-glibc226/mips-linux-gnu/libc/usr/include/gnu/stubs.h:11:11: fatal error: gnu/stubs-o32_hard.h: No such file or directory
# include <gnu/stubs-o32_hard.h>
^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
3.2) i also try gccgo, in ubuntu, i try:
go build -compiler=mipsel-linux-gnu-gccgo main.go
result:
invalid value "mipsel-linux-gnu-gccgo" for flag -compiler: unknown compiler "mipsel-linux-gnu-gccgo"
usage: go build [-o output] [build flags] [packages]
Run 'go help build' for details.
3.3) i had try xgo project to compile, which is can output a result, but when i move to the mipsle system it still can not working.
so , can any body help? if need the toolchain to test, i can send you
cantact me: justforjobonly#126.com
thanks!

Testing a Buildroot external package fails on a defconfig entry

I'm trying to add an br2-external package to a Buildroot build for a sama5d4_xplained board. I'm testing it using the utils/test-pkg utility and with every toolchain it fails on BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y, according to the missing.config file. It's an entry in the sama5d4_xplained_defconfig, which is used in the build.
I attempted to find what does the option mean in the manual and by googling, but any information is nowhere to be found. It doesn't seem to be related to the version of kernel headers installed on my machine, since my headers are 4.15.
The exact command used is:
./utils/test-pkg -c ../../config/sama5d4_xplained_defconfig -p {package}
The sama5d4_xplained_defconfig has the problematic entry:
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y
logfile content:
#
# configuration written to /home/bartlomiej/br-test-pkg/br-arm-full-static/.config
#
Value requested for BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9 not in final .config
Requested value: BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y
Actual value:
Using support/config-fragments/autobuild/br-arm-full-static.config as base
Merging support/config-fragments/minimal.config
Merging ../../config/sama5d4_xplained_defconfig
GEN /home/bartlomiej/br-test-pkg/br-arm-full-static/Makefile
#
# configuration written to /home/bartlomiej/br-test-pkg/br-arm-full-static/.config
#
Value requested for BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9 not in final .config
Requested value: BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y
Actual value:
Using support/config-fragments/autobuild/br-arm-full-static.config as base
Merging support/config-fragments/minimal.config
Merging ../../config/sama5d4_xplained_defconfig
GEN /home/bartlomiej/br-test-pkg/br-arm-full-static/Makefile
#
# configuration written to /home/bartlomiej/br-test-pkg/br-arm-full-static/.config
#
Value requested for BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9 not in final .config
Requested value: BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y
Actual value:
What does this entry mean, and what do I do to fix the build problems?
You have to make a configuration file that enables just your package. With recent Buildroot, you can also use test-pkg -p <pkg> without -c option.
test-pkg will do a build-test of one or more packages with a collection of different toolchains (by default, a subset of the toolchains used for the autobuilders). The configuration file you supply with -c is supposed to select the package(s) that you want to test. Any toolchain that does not satisfy the dependencies of those packages will be skipped.
The board defconfigs (like sama5d4_xplained_defconfig) build a toolchain as part of their configuration. This toolchain always differs from the toolchains used in the autobuilders. Therefore, if you supply one of the defconfigs as the -c option, all toolchains will always be skipped.
However, if you are only interested in the sama5d4 Xplained board, there is no real need to use test-pkg to test your package with all toolchains. Just enable the package to a custom configuration.

eBPF (bcc) on centos

It's possible deploy bcc --> https://iovisor.github.io/bcc/
... on centos /redhat SO?
someone knows what's the problem to compile bcc tools from centos? (all dependencies are installed), but when I execute the last step:
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
Returns:
[root#ebpf build]# cmake -DCMAKE_INSTALL_PREFIX=/usr ..
-- Latest recognized Git tag is v0.3.0
-- Git HEAD is 007d28c534e1a98e6017ac9f4c8cb1c0f5244388
-- Revision is 0.3.0-007d28c5 CMake Error at CMakeLists.txt:22 (find_package): Could not find a package configuration file provided
by "LLVM" with any of the following names:
LLVMConfig.cmake
llvm-config.cmake
Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
"LLVM_DIR" to a directory containing one of the above files. If
"LLVM" provides a separate development package or SDK, be sure it
has been installed.
-- Configuring incomplete, errors occurred! See also "/root/bcc/build/CMakeFiles/CMakeOutput.log".
for llvm issue. just run below CLI:
cp /usr/share/llvm/cmake/LLVM-Config.cmake /usr/share/llvm/cmake/llvm-config.cmake

Error building go compiler from source

I am trying to build the latest version (tip of the master branch) of Go from source.
The official Go documentation (https://golang.org/doc/install/source) states that you should download Go 1.4 binaries to build a more recent version. However it should be possible to build all from source.
To do this, I set variables in .bashrc :
PATH="$HOME/go/bin:$PATH"
export GOPATH=$HOME
then to build go 1.4 from source :
source ~/.bashrc
git clone https://go.googlesource.com/go
mkdir ~/go1.4
cd ~/go
git archive --format=tar go1.4.3 |tar -xv -C ~/go1.4
cd ~/go1.4/src
./make.bash
and finally build the latest version :
cd ~/go/src/
GOROOT_BOOTSTRAP=$HOME/go1.4 ./make.bash
I remember doing this months ago without problems, but today I get these errors building go 1.4 make.bash:
# cmd/pprof
.../go1.4/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
.../go1.4/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298
...
Is there something wrong in my method ?
The error messages point to CGO, and environment variables that control make.bash are explained at the beginning of the file :
CGO_ENABLED: Controls cgo usage during the build. Set it to 1
to include all cgo related files, .c and .go file with "cgo"
build directive, in the build. Set it to 0 to ignore them.
so if you disable CGO while building GO 1.4 :
cd ~/go1.4/src
CGO_ENABLED=0 ./make.bash
everything works and pass the tests.

Creating binary with CMake removes runtime path

I am using CMake to build a program on linux. The program compiles successfully and runs from the project build directory. The program is linked with a custom library in the directory ${HOME}/build/lib
I have an install stage with:
install(TARGETS ProgName RUNTIME DESTINATION bin)
When I run make install the program gets put in the correct place, but the cmake installer removes the runtime path from the binary.
-- Install configuration: "Debug"
-- Installing: *binary name*
-- Removed runtime path from "*binary name*"
I have read articles on the internet discussing the misuse of the LD_LIBRARY_PATH variable so I like to keep mine limited to system library locations if possible. I am not sysadmin so I cannot add the location to the default linker search path either.
Does anyone know how I can keep the development-time linking paths when installing or at least customising which paths are added to the runtime?
Cheers
Note: if you don't want to modify the cmake scripts themselves, setting property around, you can launch you cmake with a directive asking to not remove the runtime path:
See "Variables that Control the Build", with variable: "CMAKE_SKIP_RPATH"
If true, do not add run time path information.
If this is set to TRUE, then the rpath information is not added to compiled executables.
The default is to add rpath information if the platform supports it. This allows for easy running from the build tree.
To omit RPATH in the install step, but not the build step, use CMAKE_SKIP_INSTALL_RPATH instead.
If the deliveries already contained the right runtime path, that directive will avoid cmake to do any modification to the current runtime path included in said deliveries.
cmake -DCMAKE_SKIP_RPATH=ON xxx.cmake
You should look at set_target_properties command and the property BUILD_WITH_INSTALL_RPATH
http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:set_target_properties
This works for CMake 2.8
set_target_properties(foo PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
where foo is the target you defined earlier:
project(foo)
add_executable(foo ...)
...
install(TARGETS foo DESTINATION bin)
...
Before
% sudo make install
Install the project...
-- Install configuration: ""
-- Installing: /opt/mystuff/bin/foo
-- Removed runtime path from "/opt/mystuff/bin/foo"
After
% sudo make install
Install the project...
-- Install configuration: ""
-- Installing: /opt/mystuff/bin/foo
-- Set runtime path of "/opt/mystuff/bin/foo" to "/opt/zzyzx/lib:/opt/bar/lib/x86_64"

Resources