[Scilab-Dev] Header inclusion in external toolboxes source files (GNU/Linux)

ycollet at freesurf.fr ycollet at freesurf.fr
Mon Apr 6 09:04:21 CEST 2009


Hello,

I agree with you. I needed to use the
get_absolute_path('builder_c_gateway.sce') to add the path to the
sci_gateway/c to get the .h included correctly by scilab during
compilation.

YC

On Mon, 06 Apr 2009 08:59:06 +0200, Matteo Morelli <mmorelli at users.sf.net>
wrote:
> Dear all,
> 
>   I'd like to point out two little issues I've encountered in applying
> the external contribs installation procedure in Scilab-5.x. In order to
> avoid a kilometric post, I decided to split my report in two separate
> mails. The following is the description of first little issue I dealt
> with. It only occurs by running Scilab-5.x under GNU/Linux.
> 
>   Let's take the toolbox skeleton and add to it the includes directory,
> which the header file "foo.h" has been defined in. If we modified the
> file src/c/csum.c as follows
> 
>     #include "../../includes/foo.h" /* header file inclusion */
>     int csum(double *a, double *b, double *c)
>     {
>       ...
>     }
> 
> and tried to build the toolbox, we'd get:
> 
>     [...]
>        ilib_gen_Make: Copy csum.c to TMPDIR
>        ilib_gen_Make: configure : Generate Makefile.
>        ilib_gen_Make: Modification of the Makefile in TMPDIR.
>        Running the Makefile
>     ilib_compile: An error occured during the compilation:
>      
>     !csum.c:7:32: error: ../../includes/foo.h: No such file or directory 
!
>     !                                                                    
!
>     !make: *** [csum.lo] Error 1                                         
!
> 
>     ilib_compile: The command was:
>     make  
> CFLAGS="-I/usr/local/share/scilab//../../include/scilab/malloc/ 
> -I/usr/local/share/scilab//../../include/scilab/output_stream/ 
> -I/usr/local/share/scilab//../../include/scilab/mexlib/ 
> -I/usr/local/share/scilab//../../include/scilab/core/ " 
> CXXFLAGS="-I/usr/local/share/scilab//../../include/scilab/malloc/ 
> -I/usr/local/share/scilab//../../include/scilab/output_stream/ 
> -I/usr/local/share/scilab//../../include/scilab/mexlib/ 
> -I/usr/local/share/scilab//../../include/scilab/core/ " 
> FFLAGS="-I/usr/local/share/scilab//../../include/scilab/core/ "
>     [...]
> 
>   The error above occurs only under Linux, because ilib_gen_Make_unix()
> copies all *.c files from src/c to TMPDIR without caring about the
> headers the files include. Of course, you could expect the developers of
> toolboxes fix the problem by changing the file inclusion directive to
> #include <foo.h>, by adding something similar to the following
> directory search option to CFLAGS
> 
>     1. "-I""" + tbx_src_path + "../../includes/""", in the Windows case
> 
>     or
> 
>     2. "-I" + tbx_src_path + "../../includes/", in the GNU/Linux case,
> 
> and, finally, by modifying the src builder with a piece of code like
> 
>     if MSDOS then
>         ... 1. ...
>     else
>         ... 2. ...
>     end
> 
> That's just what I made to fix the problem with the toolbox skeleton.
> However, in my opinion, it would be better if Scilab handled the issue
> automatically.
> 
>   Any comments or suggestions?
> 
> Regards,
> 
> --
> Matteo
> 



More information about the dev mailing list