[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Possible error in dependency checking a lots of other points
From: |
Nadim Khemir |
Subject: |
Possible error in dependency checking a lots of other points |
Date: |
Wed, 23 Jan 2002 12:13:34 +0100 |
Hi all, I took some time to play with cons and I have minor bad news. This
mail is quite long but
I think it is entertaining.
Following the example of peacha and banana OS I build a cons project but it
did not work as expected.
$ cons.bat -f construct.cons release project=hugin
cons.bat: error in file "construct.cons" (project must be specified at
construct.cons line 4.)
cons.bat: script errors encountered: construction aborted
After 1 hour in the debugger I finally found out that "cygwin" is faulty!
Running the same command without using
the batch file works.
$ perl "D:\Dev\Program\cons\cons.pl" -f construct.cons release project=hugin
Install release\hugin\build\dir1\lib.h as release\hugin\include\lib.h
cl /nologo /Irelease\hugin\include /c release\hugin\build\dir0\main.c
/Forelease\hugin\build\dir0\ma
...
...
Install release\hugin\build\dir0\hello.exe as release\hugin\bin\hello.exe
you can try this in a cygwin/bash shell:
$cat >> test.bat
echo %1
echo %2
echo %3
echo %4
^c
then:
$ ./test.bat a b=c d
you'll get
a
b
c
d
not the expected
a
b=c
d
I tried on different computers. Does anyone have the same problem?
If it is ok to run the command in this way (in cygwin):
$cons.bat -f construct.cons release 'project = hugin'
!! Note the space on both sides (needed only on one side but I dont remember
which one)
You can change line 436 in version 2.3.0 to:
my($var, $val) = /([^=\s]*)\s*=\s*(.*)/;
****************************************************************************
**
The big one now. I think cons is erroneous in its dependency check (I did
not dig too much on why
the error occures but I guess cons sees the dependency but does nothing
about it)
1/ directory structure and Construct files listing
Somewhere on my disk:
¦ construct.cons
| ******************************************
| Export qw( CONS INCLUDE LIB BIN );
|
| $EXPORT = '#export';
| $INCLUDE = "$EXPORT/include";
| $LIB = "$EXPORT/lib";
| $BIN = "$EXPORT/bin";
|
| $CONS = new cons
| (
| ENV => {%ENV}
| , CPPPATH => $INCLUDE # Include path
for C Compilations
| , LIBPATH => $LIB # Library path
for linking programs
| , LIBS => 'lib1.lib' # List of
standard libraries
| );
|
| Build
| (
| 'dir1/conscript.cons' # !! Note that I tryed reversing
the order
| , 'dir0/conscript.cons' # even If I did not expect any
change
| );
| ********************************************
¦
+---dir0
¦ main.c
| ********************************************
| #include <lib.h> // !!!! this is the dependency on dir1/lib.h
!!!
|
| int main(void)
| {
| SayHi("there!") ;
| return(0) ;
| }
| ********************************************
|
¦ conscript.cons
| ********************************************
| Import qw( CONS INCLUDE LIB BIN );
|
| # Exported products
| Install $CONS $BIN, 'hello.exe';
|
| # Internal products
| Program $CONS 'hello.exe', 'main.c';
| ********************************************
¦
+---dir1
lib.c
lib.h
conscript.cons
********************************************
Import qw( CONS INCLUDE LIB );
Install $CONS $LIB, 'lib1.lib';
# Install the products of this directory
Install $CONS $LIB, 'lib1.lib';
Install $CONS $INCLUDE, 'lib.h';
# Internal products
$CONS->Library('lib1.lib', 'lib.c') ;
********************************************
I get a proper build:
$ cons.bat -f construct.cons export -d
Target export\bin\hello.exe: dir0\hello.exe
Checking export\bin\hello.exe
Checking dir0\hello.exe
Checking dir0\main.obj
Checking dir0\main.c
Checking export\include\lib.h
Checking dir1\lib.h
Rebuilding export\include\lib.h: out of date.
Install dir1\lib.h as export\include\lib.h
Rebuilding dir0\main.obj: out of date.
cl /nologo /Iexport\include /c dir0\main.c /Fodir0\main.obj
main.c
Checking export\lib\lib1.lib
Checking dir1\lib1.lib
Checking dir1\lib.obj
Checking dir1\lib.c
Rebuilding dir1\lib.obj: out of date.
cl /nologo /Iexport\include /c dir1\lib.c /Fodir1\lib.obj
lib.c
Rebuilding dir1\lib1.lib: out of date.
lib /nologo /out:dir1\lib1.lib dir1\lib.obj
Rebuilding export\lib\lib1.lib: out of date.
Install dir1\lib1.lib as export\lib\lib1.lib
Rebuilding dir0\hello.exe: out of date.
link /nologo /out:dir0\hello.exe dir0\main.obj /LIBPATH:export\lib lib1.lib
Rebuilding export\bin\hello.exe: out of date.
Install dir0\hello.exe as export\bin\hello.exe
Target export\include\lib.h: dir1\lib.h
Target export\lib\lib1.lib: dir1\lib1.lib
The directories and files rightly look like this:
Somewhere on my disk:
¦ construct.cons
¦
+---dir0
¦ .consign
¦ conscript.cons
¦ hello.exe
¦ main.c
¦ main.obj
¦
+---dir1
¦ .consign
¦ conscript.cons
¦ lib.c
¦ lib.h
¦ lib.obj
¦ lib1.lib
¦
+---export
+---bin
¦ .consign
¦ hello.exe
¦
+---include
¦ .consign
¦ lib.h
¦
+---lib
.consign
lib1.lib
Now, I modify dir1/lib.h. That file should be copied in export/include and
be used by main.c.
That very dependency works fine in the first build. But running the same
build command gives:
$ cons.bat -f construct.cons export -d
Target export\bin\hello.exe: dir0\hello.exe
Checking export\bin\hello.exe
Checking dir0\hello.exe
Checking dir0\main.obj
Checking dir0\main.c
Checking export\include\lib.h
Checking dir1\lib.h
Rebuilding export\include\lib.h: out of date.
Install dir1\lib.h as export\include\lib.h
Checking export\lib\lib1.lib
Checking dir1\lib1.lib
Checking dir1\lib.obj
Checking dir1\lib.c
Target export\include\lib.h: dir1\lib.h
Target export\lib\lib1.lib: dir1\lib1.lib
The lines:
Checking export\include\lib.h
Checking dir1\lib.h
Rebuilding export\include\lib.h: out of date.
Install dir1\lib.h as export\include\lib.h
are fine and prove that the dependency is found but they should be followed
by:
Rebuilding dir0\main.obj: out of date.
Is that an error?
****************************************************************************
**
Some points that I already took up but that no one seemed to bother
answering.
*** documentation
The documentation could be better, (I know writtting documentation is
not
easy), I think some
sort of cookbook would be very welcome. Specially if one could download
it
ready to use.
Please spare me the useless answer: "that's a great idea, we are dying
for
you (nadim) to do it."
I'd love to, but have to learn cons first then teach it if I can.
*** documentation
I think there is a bad example in the documentation. I quote:
Repository derived files
If a repository tree contains derived files (usually object files,
libraries, or executables),
Cons will perform its normal signature calculation to decide whether the
repository file is
up-to-date or a derived file must be built locally. This means that, in
order to ensure correct
signature calculation, a repository tree must also contain the .consign
files that were created
by Cons when generating the derived files.
This would usually be accomplished by building the software in the
repository
(nadim) HORROR, If by repository one means where the source files are
then
what's the point in
having a Link command? CVS guys certainly "love" this example.
(or, alternatively, in a build directory, and then copying the result to
the repository):
(nadim) HORROR too, except that it takes longer and it's more
complicated
to do It.
Am I wrong or Repository is just made for avoiding this problem, I
quote:
The following lines in a Construct file will instruct Cons to look first
under the
/usr/experiment/repository directory and then under the
/usr/product/repository directory:
Repository qw(
/usr/experiment/repository
/usr/product/repository
);
The repository directories specified may contain source files, derived
files (objects, libraries
and executables), or both.
(nadim) I didn't play enough with repositories but:
1/ Have a source repository
2/ From the repository build in "build-repository"
3/ use the following lines
Repository qw(
/usr/source-repository
/usr/build-repository
);
The results should be equivalent without the inconvenients.
*** Link and Repository
These should work together (that's what is advertised) but I can't get
it
right. Does any one have
a working example? please.
*** extension
Could we have a default extension for the Construct and conscript files
so
one could get a fancy icon under
Win32 and The possibility to click it to jump in an editor with perl
support. Unix cave man still
using pico don't need to answer. I'll write the damn 5 lines but only if
they are going to be integrated and
are needed by other. Note that this would not change a thing for non
Win32
users.
*** A minor point
I do not care if tab is 8, 12 or 1.5 spaces and I care even less if one
like 3 characters or 8 characters indentation
for ones blocks. But please do not mix tabs and spaces before the first
charater you type. It just makes it painfull to
read the code (brackets do not aligh). I can change the tab size on the
fly
in my editor but I then have to use
the indentation size the source writer choose (if I use tab)or use
spaces.
I all leading spaces are tabs, everybody gets the
indentation size he loves (just set it in your editor). Note that
comment
alignement with tabs looks as bad.
The rule is simple and it works: ^\t*[^\t]*$
-set the tab size, you like, in your editor
-use only tabs for alignement before the firs non-space character
-after the firs non-space charater use only spaces to align
I will not just complain, If you agree on this one and I get the super
latest version, I will gladely
reindent the whole blob with just tabs and check it visualy (good
opportunity to read the source :-)
*** seeing is beliving
Thanks to Steven Knight and Gary Oberbrunner for their help with
Pre-post
action (search archive for Re: pre-post actions ?)
As the output of make or cons become voluminous (specialy when using
lint)
it is quite comfortable to
see what is happening without having to analyse 200 lines per second.
Here
is an example of how one get
some simple coloring of the "commands".
$CONS = new cons
(
ENV => {%ENV}
, CFLAGS => '/nologo -DPROGRAM=\"Byacc\"'
, CCCOM =>
[
qq#@ printf "\\n\33[42m-----
Compiling %%s\33[0m\\n" %<#
, '%CC %CFLAGS %_IFLAGS -c %<
-o %>'
, qq#@ printf
"\\n\33[42m------------------------- %%s\33[0m\\n" %<#
]
, LINKCOM =>
[
qq#@ printf "\\n\33[45m-----
Linking \33[0m\\n"#
, '%LINK %LDFLAGS /out:%> %<
%_LDIRS %LIBS'
]
) ;
$CONS->Program
(
'byacc.exe'
,qw(
closure.c
....
*** 2 questions:
How does one build C files to object files without having to generate a
library?
How does one assemble files (Win32)?
Nadim.
- Possible error in dependency checking a lots of other points,
Nadim Khemir <=
- Re: Possible error in dependency checking a lots of other points, Steven Knight, 2002/01/23
- RE: Possible error in dependency checking a lots of other points, Greg Spencer, 2002/01/23
- RE: Possible error in dependency checking a lots of other points, Charles Crain, 2002/01/23
- RE: Possible error in dependency checking a lots of other points, Greg Spencer, 2002/01/23
- Re: Possible error in dependency checking a lots of other points, Michael Polis, 2002/01/23
- Re: Possible error in dependency checking a lots of other points, Brad Garcia, 2002/01/23
- RE: Possible error in dependency checking a lots of other points, Greg Spencer, 2002/01/23
- RE: Possible error in dependency checking a lots of other points, Charles Crain, 2002/01/23
Re: Possible error in dependency checking a lots of other points, Brad Garcia, 2002/01/23
Re: Possible error in dependency checking a lots of other points, Johan Holmberg, 2002/01/25