[Gsoc] GSoC 2018 - Mex Project Updates and Doubts

classic Classic list List threaded Threaded
4 messages Options
Siddhartha Gairola Siddhartha Gairola
Reply | Threaded
Open this post in threaded view
|

[Gsoc] GSoC 2018 - Mex Project Updates and Doubts

Hello all,

I did make a sample demo for the basic usage of the Mex API in Scilab. The commit link is given below -
https://codereview.scilab.org/#/c/20048/

Now I am currently working on the Geometry Processing Toolbox and porting it to Scilab.
Will give more detailed results and updates on my wiki page for this year's project -
https://wiki.scilab.org/Working%20Demo%20with%20Usage%20Docs%20for%20the%20Mex%20Module

I had the following doubts regarding this -

1. Now most of the mex files and also many of the gateways in Scilab too depend on external/thirdparty libraries.

For eg - One of the mex files I was working on included "libgl" library and "Eigen" library.

Headers included -
"#include <igl/matlab/MexStream.h>
 #include <igl/embree/ambient_occlusion.h>
 #include <igl/per_vertex_normals.h>
 #include <Eigen/Core>"



For compiling a mex file we use the -
ilib_mex_build(lib_name,table,files,libs [,makename,ldflags,cflags,fflags,cc])

This function compiles the native file and makes a dummy gateway in scilab of the specified function name and the mex file.
How does one include the depended headers file for the same? (also how do we include external libraries for such cases?)
(I mean should we satisfy the dependency locally or by including some headers in scilab itself?)

After running the ilib_mex_build() command in scilab it gives the following error - 
'''
ilib_compile: An error occurred during the compilation:
ambient_occlusion.c:1:34: fatal error: igl/matlab/MexStream.h: No such file or directory
#include <igl/matlab/MexStream.h>
^
compilation terminated.
make: *** [ambient_occlusion.lo] Error 1"""

The error is obviously due to igl not being linked. How do we specify this to resolve the dependency error?

Would be grateful for any help in this direction.

Regards,
Siddhartha
(IRC: rocko)



_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc
Clément David-3 Clément David-3
Reply | Threaded
Open this post in threaded view
|

Re: GSoC 2018 - Mex Project Updates and Doubts

Hello Siddhartha,

> For compiling a mex file we use the -
> ilib_mex_build(lib_name,table,files,libs [,makename,ldflags,cflags,fflags,cc])
>
> This function compiles the native file and makes a dummy gateway in scilab of the specified
> function name and the mex file.
> How does one include the depended headers file for the same? (also how do we include external
> libraries for such cases?)
> (I mean should we satisfy the dependency locally or by including some headers in scilab itself?)
>
> After running the ilib_mex_build() command in scilab it gives the following error -
> '''
> ilib_compile: An error occurred during the compilation:
> ambient_occlusion.c:1:34: fatal error: igl/matlab/MexStream.h: No such file or directory
>  #include <igl/matlab/MexStream.h>
>                                   ^
> compilation terminated.
> make: *** [ambient_occlusion.lo] Error 1"""
>
> The error is obviously due to igl not being linked. How do we specify this to resolve the
> dependency error?

The error comes from a missing CFLAGS "-Ipath/to/igl" to let Scilab use the header provided by the
library your mex depends on. Be sure to also compile the igl library against Scilab first to ensure
you get the correct dependencies on your mex.

This kind of issues are well documented on stackoverflow or other websites, take a look at the
README shipped with igl to compile it correctly.

Thanks,

--
Clément
_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc
Siddhartha Gairola Siddhartha Gairola
Reply | Threaded
Open this post in threaded view
|

Re: GSoC 2018 - Mex Project Updates and Doubts

Hello Clément,

Good day!

Thank you for your reply. Yes, ultimately I did end up using CFLAGS with the path to the dependency libraries.
Since libgl is a header only library do we still require to compile it against Scilab?

The dependencies for mex are more or less complete, but I when people may write their own mex files then they use some external mathematical libraries too.
So those instructions will have to be added to the help for compiling with thirdparty software or libraries for seamless compilation.

Thanking you.

Regards,
Siddhartha

On Fri, Jun 1, 2018 at 2:17 PM, Clément David <[hidden email]> wrote:
Hello Siddhartha,

> For compiling a mex file we use the -
> ilib_mex_build(lib_name,table,files,libs [,makename,ldflags,cflags,fflags,cc])
>
> This function compiles the native file and makes a dummy gateway in scilab of the specified
> function name and the mex file.
> How does one include the depended headers file for the same? (also how do we include external
> libraries for such cases?)
> (I mean should we satisfy the dependency locally or by including some headers in scilab itself?)
>
> After running the ilib_mex_build() command in scilab it gives the following error -
> '''
> ilib_compile: An error occurred during the compilation:
> ambient_occlusion.c:1:34: fatal error: igl/matlab/MexStream.h: No such file or directory
>  #include <igl/matlab/MexStream.h>
>                                   ^
> compilation terminated.
> make: *** [ambient_occlusion.lo] Error 1"""
>
> The error is obviously due to igl not being linked. How do we specify this to resolve the
> dependency error?

The error comes from a missing CFLAGS "-Ipath/to/igl" to let Scilab use the header provided by the
library your mex depends on. Be sure to also compile the igl library against Scilab first to ensure
you get the correct dependencies on your mex.

This kind of issues are well documented on stackoverflow or other websites, take a look at the
README shipped with igl to compile it correctly.

Thanks,

--
Clément


_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc
Clément David-3 Clément David-3
Reply | Threaded
Open this post in threaded view
|

Re: GSoC 2018 - Mex Project Updates and Doubts

Hello Siddhartha,

libigl is not a header only library (it has some header only dependencies but also compiled ones) ;
to ease your work, you should probably use a static library [1]. Depending on the feature you will
be using, the linker will then be able to strip the non-needed dependencies.

Usually to manage dependency, you have to identify if this library is shipped by Scilab or not (for
example eigen is) ; if this is already a dependency, use the Scilab provided one. If not, build it
as a shared library and ship it within your toolbox. Having a static library is also OK for patched
dependencies.

[1]: http://libigl.github.io/libigl/static-library/

Thanks,

--
Clément

Le vendredi 01 juin 2018 à 18:37 +0530, Siddhartha Gairola a écrit :

> Hello Clément,
>
> Good day!
>
> Thank you for your reply. Yes, ultimately I did end up using CFLAGS with the path to the
> dependency libraries.
> Since libgl is a header only library do we still require to compile it against Scilab?
>
> The dependencies for mex are more or less complete, but I when people may write their own mex
> files then they use some external mathematical libraries too.
> So those instructions will have to be added to the help for compiling with thirdparty software or
> libraries for seamless compilation.
>
> Thanking you.
>
> Regards,
> Siddhartha
>
> On Fri, Jun 1, 2018 at 2:17 PM, Clément David <[hidden email]> wrote:
> > Hello Siddhartha,
> >
> > > For compiling a mex file we use the -
> > > ilib_mex_build(lib_name,table,files,libs [,makename,ldflags,cflags,fflags,cc])
> > >
> > > This function compiles the native file and makes a dummy gateway in scilab of the specified
> > > function name and the mex file.
> > > How does one include the depended headers file for the same? (also how do we include external
> > > libraries for such cases?)
> > > (I mean should we satisfy the dependency locally or by including some headers in scilab
> > itself?)
> > >
> > > After running the ilib_mex_build() command in scilab it gives the following error -
> > > '''
> > > ilib_compile: An error occurred during the compilation:
> > > ambient_occlusion.c:1:34: fatal error: igl/matlab/MexStream.h: No such file or directory
> > >  #include <igl/matlab/MexStream.h>
> > >                                   ^
> > > compilation terminated.
> > > make: *** [ambient_occlusion.lo] Error 1"""
> > >
> > > The error is obviously due to igl not being linked. How do we specify this to resolve the
> > > dependency error?
> >
> > The error comes from a missing CFLAGS "-Ipath/to/igl" to let Scilab use the header provided by
> > the
> > library your mex depends on. Be sure to also compile the igl library against Scilab first to
> > ensure
> > you get the correct dependencies on your mex.
> >
> > This kind of issues are well documented on stackoverflow or other websites, take a look at the
> > README shipped with igl to compile it correctly.
> >
> > Thanks,
> >
> > --
> > Clément
>
>
_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc