2021-08-23 01:52 PM
hi,
i'm trying to compile a program in STM32CubeIDE that i wrote that cotnains calls located in libgpiod. but i'm getting linker errors as shown below. do i need to create the library myself or do i need to set a path in the CubeIDE's environment?
i selected the option to install STOpenLinux to be embedded inside of CubeIDE.
Invoking: MPU G++ Linker
arm-ostl-linux-gnueabi-g++ -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/vbuonassisi@ostendo.local/.eclipse/com.st.stm32cube.ide.mcu.rcp.product_1.6.0_1935172119_linux_gtk_x86_64/plugins/com.st.openstlinux.sdk.openstlinux_5.4_dunfell_mp1_20_11_12_5.4.0.202011171729/tools/sysroots/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi -o "NearEGSoftware" ./gpio_test.o ./main.o -Wl,-Map="NearEGSoftware.map" -Wl,--gc-sections
/home/vbuonassisi@ostendo.local/.eclipse/com.st.stm32cube.ide.mcu.rcp.product_1.6.0_1935172119_linux_gtk_x86_64/plugins/com.st.openstlinux.sdk.openstlinux_5.4_dunfell_mp1_20_11_12_5.4.0.202011171729/tools/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/9.3.0/real-ld: ./gpio_test.o: in function `gpio_test()':
/home/vbuonassisi@ostendo.local/Documents/STM32MP15-Ecosystem-v3.0.0/Developer-Package/workspace/NearEGSoftware/Debug/../gpio_test.cpp:20: undefined reference to `gpiod_chip_open_by_name'
/home/vbuonassisi@ostendo.local/.eclipse/com.st.stm32cube.ide.mcu.rcp.product_1.6.0_1935172119_linux_gtk_x86_64/plugins/com.st.openstlinux.sdk.openstlinux_5.4_dunfell_mp1_20_11_12_5.4.0.202011171729/tools/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/9.3.0/real-ld: /home/vbuonassisi@ostendo.local/Documents/STM32MP15-Ecosystem-v3.0.0/Developer-Package/workspace/NearEGSoftware/Debug/../gpio_test.cpp:29: undefined reference to `gpiod_chip_get_line'
/home/vbuonassisi@ostendo.local/.eclipse/com.st.stm32cube.ide.mcu.rcp.product_1.6.0_1935172119_linux_gtk_x86_64/plugins/com.st.openstlinux.sdk.openstlinux_5.4_dunfell_mp1_20_11_12_5.4.0.202011171729/tools/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/9.3.0/real-ld: /home/vbuonassisi@ostendo.local/Documents/STM32MP15-Ecosystem-v3.0.0/Developer-Package/workspace/NearEGSoftware/Debug/../gpio_test.cpp:40: undefined reference to `gpiod_line_request_output'
/home/vbuonassisi@ostendo.local/.eclipse/com.st.stm32cube.ide.mcu.rcp.product_1.6.0_1935172119_linux_gtk_x86_64/plugins/com.st.openstlinux.sdk.openstlinux_5.4_dunfell_mp1_20_11_12_5.4.0.202011171729/tools/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/9.3.0/real-ld: /home/vbuonassisi@ostendo.local/Documents/STM32MP15-Ecosystem-v3.0.0/Developer-Package/workspace/NearEGSoftware/Debug/../gpio_test.cpp:34: undefined reference to `gpiod_chip_close'
/home/vbuonassisi@ostendo.local/.eclipse/com.st.stm32cube.ide.mcu.rcp.product_1.6.0_1935172119_linux_gtk_x86_64/plugins/com.st.openstlinux.sdk.openstlinux_5.4_dunfell_mp1_20_11_12_5.4.0.202011171729/tools/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/9.3.0/real-ld: /home/vbuonassisi@ostendo.local/Documents/STM32MP15-Ecosystem-v3.0.0/Developer-Package/workspace/NearEGSoftware/Debug/../gpio_test.cpp:45: undefined reference to `gpiod_chip_close'
/home/vbuonassisi@ostendo.local/.eclipse/com.st.stm32cube.ide.mcu.rcp.product_1.6.0_1935172119_linux_gtk_x86_64/plugins/com.st.openstlinux.sdk.openstlinux_5.4_dunfell_mp1_20_11_12_5.4.0.202011171729/tools/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/9.3.0/real-ld: /home/vbuonassisi@ostendo.local/Documents/STM32MP15-Ecosystem-v3.0.0/Developer-Package/workspace/NearEGSoftware/Debug/../gpio_test.cpp:53: undefined reference to `gpiod_line_set_value'
/home/vbuonassisi@ostendo.local/.eclipse/com.st.stm32cube.ide.mcu.rcp.product_1.6.0_1935172119_linux_gtk_x86_64/plugins/com.st.openstlinux.sdk.openstlinux_5.4_dunfell_mp1_20_11_12_5.4.0.202011171729/tools/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/9.3.0/real-ld: /home/vbuonassisi@ostendo.local/Documents/STM32MP15-Ecosystem-v3.0.0/Developer-Package/workspace/NearEGSoftware/Debug/../gpio_test.cpp:58: undefined reference to `gpiod_chip_close'
collect2: error: ld returned 1 exit status
make: *** [makefile:52: NearEGSoftware] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
thanks,
vince
Solved! Go to Solution.
2021-08-31 06:48 AM
hi olivier,
i did follow the instructions in the link you sent me to set up my CubeIDE as well as an STM youtube video that i found . non of that helped. what did help is adding the library name to C/C++ Build->Settings->MPU G++ Linker->Libraries in the configuration for the project. i did not know that i needed to manually add the library that i use to the project configuration.
thanks,
vince
2021-08-25 04:53 AM
Hi @vbuon.1 ,
Did you follow wiki instruction to install SDK and create your user space project under CubeIDE ?
See
https://wiki.st.com/stm32mpu/wiki/How_to_debug_a_user_space_application_with_STM32CubeIDE
Olivier
2021-08-31 06:48 AM
hi olivier,
i did follow the instructions in the link you sent me to set up my CubeIDE as well as an STM youtube video that i found . non of that helped. what did help is adding the library name to C/C++ Build->Settings->MPU G++ Linker->Libraries in the configuration for the project. i did not know that i needed to manually add the library that i use to the project configuration.
thanks,
vince