Problems with using libxml2

What do you have in

/home/reinhard/.leaf/wp85-toolchain_SWI9X15Y_07.14.01.00-linux64/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/libxml2

I also tried with
/home/reinhard/.leaf/wp85-toolchain_SWI9X15Y_07.14.01.00-linux64/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/libxml2/include

I am not 100% sure that i properly installed it

Oh and the 2 .h files definitely are under

/home/reinhard/.leaf/wp85-toolchain_SWI9X15Y_07.14.01.00-linux64/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/libxml2/include/libxml

Which is why i include them like <libxm/parser.h>

When running mkapp it seems to recognize the h files but cannot find the references to the functions in the h files hence the “undefined reference to xmlFreeDoc” error

This is my tree.h inside WP76 toolchain
/opt/swi/SWI9X07Y_02.28.03.05/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/libxml2/libxml

Do you find xmlFreeDoc in your side for the tree.h?
tree.h (38.5 KB)

I checked the toolchain SWI9X15Y_07140100-wp85-wp750x-native-x86_64-201907181020:

https://source.sierrawireless.com/resources/airprime/software/wpx5xx/wpx5xx-firmware-latest-release-components/#sthash.mohz30tW.dpbs

I don’t see anything related to libxml2

owner@CNHKG-EX-001367:~/legato/packages/legato.toolchain.2.2.3.SWI9X15Y_07140100-wp85-wp750x-native-x86_64-201907181020/resources/native/sysroots$ find ./ -name "*libxml*"
./armv7a-neon-poky-linux-gnueabi/usr/lib/libxml.so
./armv7a-neon-poky-linux-gnueabi/usr/lib/libxml.la
./armv7a-neon-poky-linux-gnueabi/usr/lib/libxml.so.0
./armv7a-neon-poky-linux-gnueabi/usr/lib/libxml.so.0.0.0
owner@CNHKG-EX-001367:~/legato/packages/legato.toolchain.2.2.3.SWI9X15Y_07140100-wp85-wp750x-native-x86_64-201907181020/resources/native/sysroots$ find ./ -name "tree.h"./armv7a-neon-poky-linux-gnueabi/usr/src/kernel/kernel/rcu/tree.h
./armv7a-neon-poky-linux-gnueabi/usr/src/kernel/include/config/quota/tree.h
./x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/6.2.0/plugin/include/tree.h
owner@CNHKG-EX-001367:~/legato/packages/legato.toolchain.2.2.3.SWI9X15Y_07140100-wp85-wp750x-native-x86_64-2019

I had to make a second account because the forum wouldn’ let me post for another 6 hours cause it’s a new account.

I do find xmlFreeDoc in my tree.h yes.

I tried to add libxml2 to my toolchain, i basically just installed it in the include directory like in " I want to install my own copy of libxml2 in my home directory and link my programs against it, but it doesn’t work" explained in http://xmlsoft.org/FAQ.html, and hoped it would work.

Is there a way to proper way to add libxml2 to the toolchain? And if there is can you show me?

Thanks for your help btw, i am new to this kind of stuff and still a bit lost with things like these.

I suspect the libxml2 you add to the toolchain is not an official one.
The official way should be using the libxml2 stuff from yocto recipe.

Here is what I try on WP76 source:

  1. download the yocto source from source.sierrawireless.com

https://source.sierrawireless.com/resources/airprime/software/wp76xx/wp76xx-firmware-release-13,-d-,1-components/#sthash.2vlTNVx1.dpbs

  1. go to ./meta-swi/meta-swi-mdm9x28/recipes-core/images/mdm9x28-image.inc

3.add the following line:
IMAGE_INSTALL_append = " libxml2"

  1. Make the yocto image

  2. the include path now should be in yocto/build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/libxml2/2.9.7-r0/image/usr/include/libxml2/

  3. in component.cdef, add the following:

    cflags:
    {

     -I/home/owner/Yocto/WP76/R13.3/yocto/build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/libxml2/2.9.7-r0/image/usr/include/libxml2/
    

    }

FYI, I just set the target module in Developer studio to be WP8548 and I saw the same problem as yours.
However if I add the following in “requires” section, the compilation is OK:

     lib:
    {      
      //  xml2
      /home/owner/Yocto/WP76/R13.3/yocto/build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/libxml2/2.9.7-r0/image/usr/lib/libxml2.so
      
    } 

Also for the cflag include path, I am using the one in WP76:

cflags:
{
	
	-I/home/owner/Yocto/WP76/R13.3/yocto/build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/libxml2/2.9.7-r0/image/usr/include/libxml2/
	
}

Probably you need to download the WP85 yocto source and do the same.
(If the above is too complicated, you can also download the toolchain of WP76 and use the libxml2 library there, of course this is not a correct way, but worth a try )

https://source.sierrawireless.com/resources/airprime/software/wp76xx/wp76xx-firmware-release-13,-d-,1-components/#sthash.2vlTNVx1.dpbs%201

Probably you need to download the WP85 yocto source and do the same.
(If the above is too complicated, you can also download the toolchain of WP76 and use the libxml2 library there, of course this is not a correct way, but worth a try )

Is there a way doing this wit the Leaf Workspace Manager?

you can download WP76 package through leaf.

I am sorry to bother you this much, but i downloaded the yocto source and i added IMAGE_INSTALL_append = " libxml2" to mdm9x28-image.inc.

But how exactly do i make the yocto image and how do i go on from there?

Just go to the yocto folder, and then type “make”.
Btw, why don’t you just download the wp76 toolchain and extract it in /opt/swi

I treid that but still got the undefined reference error :frowning:

in cflags i now have have this:

cflags:

{

//-I /home/reinhard/.leaf/wp85-toolchain_SWI9X15Y_07.14.01.00-linux64/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/libxml2/include/

-I /home/reinhard/.leaf/wp76-toolchain_SWI9X07Y_02.37.07.00-linux64/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/libxml2

}

did you include the “lib” section in component.cdef ?

 lib:
    {      
      //  xml2
      /home/owner/Yocto/WP76/R13.3/yocto/build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/libxml2/2.9.7-r0/image/usr/lib/libxml2.so
      
    }

I added that and now i am getting a new error:

I still see there is -lxml2
Also i don’t understand why the -L flag is having the wp76 toolchain path.

Btw, will you consider to use developer studio as it is working on my side?

I dont understand it either,

I would prefer to stay with VScode cause i am somewhat familiar with it.
But i can download and try it with Deveeloper Studio.
I just don’t understand why the linker can’t libpthread.so.0 and libpthread_nonshared.a even when i specify their path using the -L flag

Add: The support for Developer studio has ended which is why i am using vscode

You can try not specify the -L or point to wp85 toolchain ,not wp76 toolchain.

You can see my developer studio log, it does not specify -L path

When i am not specifying the -L i still get the same error that it can’t find the libpthread files also it points to the wp76 because i added

/home/reinhard/.leaf/wp76-toolchain_SWI9X07Y_02.37.07.00-linux64/sysroots/armv7a-neon-poky-linux-gnueabi/usr/lib/libxml2.so

to the required lib section in the .cdef.

When i remove the required lib section i go back to my old errors that xmlFreeDoc and so on are undefined reference :frowning:

If you copy the libxml2.so to desktop, then it will not point to wp76 toolchain, right?

1 Like

I am not sure why that helped but it finally compiled!!

Thank you for your help! I wouldn’t have got it without you!