Bitbake gtk 3 c code do_install error

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello Mansij,

Thank you for reaching out with your question. The error you’re encountering is due to a mismatch between the name of the binary file generated during the compilation step and the name expected during the installation step in your Yocto recipe.

In your nsgtk_1.0.0.bb file, the do_compile function compiles the nsgtk.c file into a binary named hello_gtk:

do_compile() {
    ${CC} -Wall ${LDFLAGS} nsgtk.c -o hello_gtk `pkg-config --cflags --libs gtk+-3.0`
}

However, in the do_install function, you are trying to install a binary named nsgtk:

do_install() {
    install -d ${D}${bindir}
    install -m 755 ${S}/nsgtk ${D}${bindir}/
}

To resolve this issue, you need to ensure that the binary name in the do_install step matches the name of the compiled binary. You can do this by changing the do_install function to:

do_install() {
    install -d ${D}${bindir}
    install -m 755 ${S}/hello_gtk ${D}${bindir}/
}

This change should resolve the error by correctly referencing the compiled binary hello_gtk during the installation step. After making this change, try running bitbake nsgtk again.

I hope this helps! If you have any more questions, feel free to ask.

Best regards,
Toradex AI Assistant

Please, also check if these links can help you solve your problem:

What Linux OS do I need to use to create and use GTK application?.