<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX ProcessorsのトピックRecipe for c program that use libmodbus</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Recipe-for-c-program-that-use-libmodbus/m-p/1581763#M200009</link>
    <description>&lt;P&gt;I'm trying to create a Linux image with Yocto project. I need the modbus library for C.&lt;/P&gt;&lt;P&gt;I added the libmodbus in IMAGE_INSTALL_append in the bitbake file of the image. Libmodbus is included in the meta-openembedded that I have.&lt;/P&gt;&lt;P&gt;Now I have a recipe to compile a simple c program (for test purpose) that uses the modbus library (#include &amp;lt;modbus.h&amp;gt;). This program works in my host.&lt;/P&gt;&lt;P&gt;The bitbake file to install the C program is the following:&lt;/P&gt;&lt;PRE&gt;SUMMARY = &lt;SPAN class=""&gt;"modbustest Recipe"&lt;/SPAN&gt;
LICENSE = &lt;SPAN class=""&gt;"CLOSED"&lt;/SPAN&gt;

SRC_URI = &lt;SPAN class=""&gt;"file://test.c "&lt;/SPAN&gt;

DEPENDS += &lt;SPAN class=""&gt;"libmodbus"&lt;/SPAN&gt;

S = &lt;SPAN class=""&gt;"${WORKDIR}"&lt;/SPAN&gt;

FILES_${PN} +=  &lt;SPAN class=""&gt;"${libdir}/*.so"&lt;/SPAN&gt;

do_compile() {
    ${CC} ${CFLAGS} ${LDFLAGS} test.c -o test -I/${D}/usr/lib/modbus/ -lmodbus
}

do_install_append() {
    install -d ${D}/opt/modbustest/bin
    install -m &lt;SPAN class=""&gt;0777&lt;/SPAN&gt; ${WORKDIR}/test ${D}/opt/modbustest/bin
}

FILES_${PN} += &lt;SPAN class=""&gt;"/opt/modbustest/bin"&lt;/SPAN&gt;

FILES_SOLIBSDEV = &lt;SPAN class=""&gt;""&lt;/SPAN&gt;

INSANE_SKIP_${PN} += &lt;SPAN class=""&gt;"dev-so"&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;When I try to create the image, this is the error:&lt;/P&gt;&lt;PRE&gt;ERROR: modbustest&lt;SPAN class=""&gt;-0.1&lt;/SPAN&gt;-r0 do_compile: Execution of &lt;SPAN class=""&gt;'/home/uip/yocto-mx8/build-modbus/tmp/work/aarch64-ts-linux/modbustest/0.1-r0/temp/run.do_compile.3835'&lt;/SPAN&gt; failed with &lt;SPAN class=""&gt;exit&lt;/SPAN&gt; code &lt;SPAN class=""&gt;1&lt;/SPAN&gt;:
test.c:&lt;SPAN class=""&gt;2&lt;/SPAN&gt;:&lt;SPAN class=""&gt;10&lt;/SPAN&gt;: fatal error: modbus.h: No such file or directory
    &lt;SPAN class=""&gt;2&lt;/SPAN&gt; | &lt;SPAN class=""&gt;#&lt;SPAN class=""&gt;include&lt;/SPAN&gt; &lt;SPAN class=""&gt;&amp;lt;modbus.h&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
  |          ^~~~~~~~~~
compilation terminated.
WARNING: &lt;SPAN class=""&gt;exit&lt;/SPAN&gt; code &lt;SPAN class=""&gt;1&lt;/SPAN&gt; from a shell command.&lt;/PRE&gt;&lt;P&gt;I know that library is to link to the do_compile but I don't know how to do.&lt;/P&gt;&lt;P&gt;Probably in the recipe file there are many errors. I copy and paste many solutions from internet but nothing works.&lt;/P&gt;&lt;P&gt;Does someone know how to solve it?&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;</description>
    <pubDate>Thu, 12 Jan 2023 14:03:14 GMT</pubDate>
    <dc:creator>marcoozmg</dc:creator>
    <dc:date>2023-01-12T14:03:14Z</dc:date>
    <item>
      <title>Recipe for c program that use libmodbus</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Recipe-for-c-program-that-use-libmodbus/m-p/1581763#M200009</link>
      <description>&lt;P&gt;I'm trying to create a Linux image with Yocto project. I need the modbus library for C.&lt;/P&gt;&lt;P&gt;I added the libmodbus in IMAGE_INSTALL_append in the bitbake file of the image. Libmodbus is included in the meta-openembedded that I have.&lt;/P&gt;&lt;P&gt;Now I have a recipe to compile a simple c program (for test purpose) that uses the modbus library (#include &amp;lt;modbus.h&amp;gt;). This program works in my host.&lt;/P&gt;&lt;P&gt;The bitbake file to install the C program is the following:&lt;/P&gt;&lt;PRE&gt;SUMMARY = &lt;SPAN class=""&gt;"modbustest Recipe"&lt;/SPAN&gt;
LICENSE = &lt;SPAN class=""&gt;"CLOSED"&lt;/SPAN&gt;

SRC_URI = &lt;SPAN class=""&gt;"file://test.c "&lt;/SPAN&gt;

DEPENDS += &lt;SPAN class=""&gt;"libmodbus"&lt;/SPAN&gt;

S = &lt;SPAN class=""&gt;"${WORKDIR}"&lt;/SPAN&gt;

FILES_${PN} +=  &lt;SPAN class=""&gt;"${libdir}/*.so"&lt;/SPAN&gt;

do_compile() {
    ${CC} ${CFLAGS} ${LDFLAGS} test.c -o test -I/${D}/usr/lib/modbus/ -lmodbus
}

do_install_append() {
    install -d ${D}/opt/modbustest/bin
    install -m &lt;SPAN class=""&gt;0777&lt;/SPAN&gt; ${WORKDIR}/test ${D}/opt/modbustest/bin
}

FILES_${PN} += &lt;SPAN class=""&gt;"/opt/modbustest/bin"&lt;/SPAN&gt;

FILES_SOLIBSDEV = &lt;SPAN class=""&gt;""&lt;/SPAN&gt;

INSANE_SKIP_${PN} += &lt;SPAN class=""&gt;"dev-so"&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;When I try to create the image, this is the error:&lt;/P&gt;&lt;PRE&gt;ERROR: modbustest&lt;SPAN class=""&gt;-0.1&lt;/SPAN&gt;-r0 do_compile: Execution of &lt;SPAN class=""&gt;'/home/uip/yocto-mx8/build-modbus/tmp/work/aarch64-ts-linux/modbustest/0.1-r0/temp/run.do_compile.3835'&lt;/SPAN&gt; failed with &lt;SPAN class=""&gt;exit&lt;/SPAN&gt; code &lt;SPAN class=""&gt;1&lt;/SPAN&gt;:
test.c:&lt;SPAN class=""&gt;2&lt;/SPAN&gt;:&lt;SPAN class=""&gt;10&lt;/SPAN&gt;: fatal error: modbus.h: No such file or directory
    &lt;SPAN class=""&gt;2&lt;/SPAN&gt; | &lt;SPAN class=""&gt;#&lt;SPAN class=""&gt;include&lt;/SPAN&gt; &lt;SPAN class=""&gt;&amp;lt;modbus.h&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
  |          ^~~~~~~~~~
compilation terminated.
WARNING: &lt;SPAN class=""&gt;exit&lt;/SPAN&gt; code &lt;SPAN class=""&gt;1&lt;/SPAN&gt; from a shell command.&lt;/PRE&gt;&lt;P&gt;I know that library is to link to the do_compile but I don't know how to do.&lt;/P&gt;&lt;P&gt;Probably in the recipe file there are many errors. I copy and paste many solutions from internet but nothing works.&lt;/P&gt;&lt;P&gt;Does someone know how to solve it?&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 14:03:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Recipe-for-c-program-that-use-libmodbus/m-p/1581763#M200009</guid>
      <dc:creator>marcoozmg</dc:creator>
      <dc:date>2023-01-12T14:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: Recipe for c program that use libmodbus</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Recipe-for-c-program-that-use-libmodbus/m-p/1583239#M200183</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;you can see the following:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/intel/luv-yocto/blob/master/meta-oe/recipes-extended/libmodbus/libmodbus.inc" target="_blank"&gt;https://github.com/intel/luv-yocto/blob/master/meta-oe/recipes-extended/libmodbus/libmodbus.inc&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 14:24:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Recipe-for-c-program-that-use-libmodbus/m-p/1583239#M200183</guid>
      <dc:creator>Bio_TICFSL</dc:creator>
      <dc:date>2023-01-16T14:24:52Z</dc:date>
    </item>
  </channel>
</rss>

