Problems with using 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!

Hi am not able to include the header files of libxml/parser.h it triggers error cannot open source file “libxml/parser.h”

in .cdef file, you need to add:

cflags:
{
	//-I/opt/swi/SWI9X07Y_02.28.03.05/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/libxml2
	-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/
	
}

getting same error “message”: “cannot open source file "libxml/parser.h"”,

hi getting errormessage like this cannot open source file “libxml/xmlversion.h” (dependency of “libxml2/libxml/parser.h”)

it should be in here:
/opt/swi/SWI9X07Y_02.28.03.05/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/libxml2/libxml/xmlversion.h

Hi,

To use libraries/apps in your legato application you will need to add the necessary header files and .so files for libraries to your vscode project.

the vscode system defination files defines default paths for header files it uses Interfaces and searches inside the interfaces folder for .so files you need to create a lib folder inside your legato workspace and add the .so files.

Also make sure while copying the .so files that the symlinks are not broken. Once the .so files are copied into the lib directory you can enter the ldflags section as below in your .sdef file which will be used across the project workspace.

ldflags:
{
-L/mnt/c/Users/Pankaj/Documents/legatosamples/leaf-data/current/wp76-legato/build/wp76xx/framework/lib
-L${MY_SYSTEM_DIR}/lib
}

using the {MY_SYSTEM_DIR}/ lib is more generic and will help to make the code easily portable across different workspaces without worrying about hardcoded paths.

Hope this helps