cancel
Showing results for 
Search instead for 
Did you mean: 

Error occurs when adding libmodbus to st-image-weston

hochul yoo
Associate III

I have successfully build st-image-weston using Distribution-Package.

Now I want to add libmodbus to st-image-weston.

I refer to the wiki page below.

https://wiki.st.com/stm32mpu/wiki/How_to_integrate_an_external_software_package

1)​

​I checked the libmodbus recipe in the path below.

And I am using the meta-oe layer containing libmodbus.

But I can't find libmodbus in the target.

Why doesn't rootfs include libmodbus?

layers/meta-openembedded/meta-oe/recipes-extended/libmodbus

2)

I tried to add libmodbus by executing the command below.

The following error occurs.

how to fix it?

echo 'IMAGE_INSTALL_append += "libmodbus"' >> ../layers/meta-st/meta-st-openstlinux/recipes-st/images/st-image-weston.bbappend
bitbake st-image-weston -c cleanall
bitbake st-image-weston
NOTE: Started PRServer with DBfile: /home/osboxes/STM32MPU_workspace/STM32MP15-Ecosystem-v3.0.0/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-03-31/build-openstlinuxweston-stm32mp1/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 35363, PID: 73879
Loading cache: 100% |#########################################################################################################################################################################################################| Time: 0:00:00
Loaded 3763 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
 
Build Configuration:
BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "arm-ostl-linux-gnueabi"
MACHINE              = "stm32mp1"
DISTRO               = "openstlinux-weston"
DISTRO_VERSION       = "3.1-snapshot-20210602"
TUNE_FEATURES        = "arm vfp cortexa7 neon vfpv4 thumb callconvention-hard"
TARGET_FPU           = "hard"
DISTRO_CODENAME      = "dunfell"
ACCEPT_EULA_stm32mp1 = "0"
GCCVERSION           = "9.%"
PREFERRED_PROVIDER_virtual/kernel = "linux-stm32mp"
meta-python
meta-oe
meta-gnome
meta-initramfs
meta-multimedia
meta-networking
meta-webserver
meta-filesystems
meta-perl            = "HEAD:5bba79488b7d393d2258d6e917f7bf7b0d7c4073"
meta-st-stm32mp      = "HEAD:7b55c34159fcfd57b4965f7aa9284200eea09d20"
meta-qt5             = "HEAD:0d8eb956015acdea7e77cd6672d08dce18061510"
meta-st-openstlinux  = "HEAD:d6947f5a1898744aa15a96b68e8945f4f553175e"
meta                 = "HEAD:72431ee8de5e3a53d259cebf420a7713ac9e1f14"
workspace            = "<unknown>:<unknown>"
 
Initialising tasks: 100% |####################################################################################################################################################################################################| Time: 0:00:06
Sstate summary: Wanted 411 Found 392 Missed 19 Current 2881 (95% match, 99% complete)
NOTE: Executing Tasks
ERROR: libmodbus-3.1.6-r0 do_prepare_recipe_sysroot: Error executing a python function in exec_python_func() autogenerated:
 
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:extend_recipe_sysroot(d)
     0003:
File: '/home/osboxes/STM32MPU_workspace/STM32MP15-Ecosystem-v3.0.0/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-03-31/layers/openembedded-core/meta/classes/staging.bbclass', lineno: 577, function: extend_recipe_sysroot
     0573:                    if "/bin/" in l or "/sbin/" in l:
     0574:                        # defer /*bin/* files until last in case they need libs
     0575:                        binfiles[l] = (targetdir, dest)
     0576:                    else:
 *** 0577:                        staging_copyfile(l, targetdir, dest, postinsts, seendirs)
     0578:
     0579:    # Handle deferred binfiles
     0580:    for l in binfiles:
     0581:        (targetdir, dest) = binfiles[l]
File: '/home/osboxes/STM32MPU_workspace/STM32MP15-Ecosystem-v3.0.0/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-03-31/layers/openembedded-core/meta/classes/staging.bbclass', lineno: 152, function: staging_copyfile
     0148:        os.symlink(linkto, dest)
     0149:        #bb.warn(c)
     0150:    else:
     0151:        try:
 *** 0152:            os.link(c, dest)
     0153:        except OSError as err:
     0154:            if err.errno == errno.EXDEV:
     0155:                bb.utils.copyfile(c, dest)
     0156:            else:
Exception: FileExistsError: [Errno 17] File exists: '/home/osboxes/STM32MPU_workspace/STM32MP15-Ecosystem-v3.0.0/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-03-31/build-openstlinuxweston-stm32mp1/tmp-glibc/sysroots-components/x86_64/xz-native/usr/include/lzma.h' -> '/home/osboxes/STM32MPU_workspace/STM32MP15-Ecosystem-v3.0.0/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-03-31/build-openstlinuxweston-stm32mp1/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/libmodbus/3.1.6-r0/recipe-sysroot-native/usr/include/lzma.h'
 
ERROR: Logfile of failure stored in: /home/osboxes/STM32MPU_workspace/STM32MP15-Ecosystem-v3.0.0/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-03-31/build-openstlinuxweston-stm32mp1/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/libmodbus/3.1.6-r0/temp/log.do_prepare_recipe_sysroot.74045
ERROR: Task (/home/osboxes/STM32MPU_workspace/STM32MP15-Ecosystem-v3.0.0/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-03-31/layers/meta-openembedded/meta-oe/recipes-extended/libmodbus/libmodbus_3.1.6.bb:do_prepare_recipe_sysroot) failed with exit code '1'
NOTE: Tasks Summary: Attempted 9007 tasks of which 9000 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 2 seconds
 
Summary: 1 task failed:
  /home/osboxes/STM32MPU_workspace/STM32MP15-Ecosystem-v3.0.0/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-03-31/layers/meta-openembedded/meta-oe/recipes-extended/libmodbus/libmodbus_3.1.6.bb:do_prepare_recipe_sysroot
Summary: There was 1 ERROR message shown, returning a non-zero exit code.

Thank you

Best regards​

1 ACCEPTED SOLUTION

Accepted Solutions
Jean-Marc B
ST Employee

Hi again @hochul yoo​ 

I am looking at your next question "how to fix it?" (build problem with libmodbus).

I performed the following commands:

$ bitbake st-image-weston
$ echo 'IMAGE_INSTALL_append += "libmodbus"' >> ../layers/meta-st/meta-st-openstlinux/recipes-st/images/st-image-weston.bbappend
$ bitbake st-image-weston -c cleanall
$ bitbake st-image-weston

But I was not able to reproduce your error.

Could you make a new attempt with the following commands please?

$ bitbake -c cleansstate xz-native
$ bitbake -c cleansstate libmodbus
$ bitbake st-image-weston

I guess there are some troubles with the bitbake cache but I can't explain it.

Best regards,

--JM

View solution in original post

5 REPLIES 5
Jean-Marc B
ST Employee

Hello @hochul yoo​ 

I am replying to your first question: "Why doesn't rootfs include libmodbus?"

Indeed, this package is not included into the rootfs but it is available through apt-get commands. Firstly, refresh the apt database:

root@stm32mp1:~# apt-get update

You can search your package and its version with these two commands:

root@stm32mp1:~# apt-cache search libmodbus
libmodbus-doc - A Modbus library - Documentation files
libmodbus5 - A Modbus library
root@stm32mp1:~# apt-cache policy libmodbus5
libmodbus5:
  Installed: (none)
  Candidate: 3.1.6-r0
  Version table:
     3.1.6-r0 500
        500 http://packages.openstlinux.st.com/3.0 dunfell/untested armhf Packages

and then install it on your board:

root@stm32mp1:~# apt-get install libmodbus5
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  libmodbus5
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 13.8 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://packages.openstlinux.st.com/3.0 dunfell/untested armhf libmodbus5 armhf 3.1.6-r0 [13.8 kB]
Fetched 13.8 kB in 0s (82.7 kB/s)
 
The software package is provided AS IS, and by downloading it, you agree to be bound to the terms of the software license agreement (SLA). The detailed content licenses can be found at https://wiki.st.com/stm32mpu/wiki/OpenSTLinux_licenses.
 
Selecting previously unselected package libmodbus5.
(Reading database ... 16484 files and directories currently installed.)
Preparing to unpack .../libmodbus5_3.1.6-r0_armhf.deb ...
Unpacking libmodbus5 (3.1.6-r0) ...
Setting up libmodbus5 (3.1.6-r0) ...

Best regards,

--JM

Jean-Marc B
ST Employee

Hi again @hochul yoo​ 

I am looking at your next question "how to fix it?" (build problem with libmodbus).

I performed the following commands:

$ bitbake st-image-weston
$ echo 'IMAGE_INSTALL_append += "libmodbus"' >> ../layers/meta-st/meta-st-openstlinux/recipes-st/images/st-image-weston.bbappend
$ bitbake st-image-weston -c cleanall
$ bitbake st-image-weston

But I was not able to reproduce your error.

Could you make a new attempt with the following commands please?

$ bitbake -c cleansstate xz-native
$ bitbake -c cleansstate libmodbus
$ bitbake st-image-weston

I guess there are some troubles with the bitbake cache but I can't explain it.

Best regards,

--JM

Hi Jean

Thanks I solved it.

Hello @hochul yoo​ 

Great! I am really glad you fixed your issue.

Was the problem related to a bitbake cache mismatch?

Anyway, do not forget many packages are available in the OpenSTLinux distribution through apt-get commands directly from your board.

Best regards,

--JM

To help community to find solutions, please click on "Select as Best" for my reply which solved your issue or answered your question.

Yves C
ST Employee

I tried also the process to add the libmodbus :

libmodbus add to weston image.

in conf/local.conf

IMAGE_INSTALL_append += "libmodbus"

bitbake st-image-weston

==> result package

/tmp-glibc/deploy/deb/cortexa7t2hf-neon-vfpv4/libmodbus5_3.1.6-r0.0_armhf.deb

/usr/lib/libmodbus.so.5

according to your trace, I check also if the file "lzma.h" exist:  

tmp-glibc/sysroots-components/x86_64/xz-native/usr/include/lzma.h