Page 1 of 1

Installe Ubuntu

Posted: Thu Nov 22, 2007 4:39 pm
by notezik
Bonsoir,
Je ne comprend pas comment installer Context sur Ubuntu et ni comment on lance la compilation d'un fichier?

Merci de votre aide.

Posted: Fri Nov 23, 2007 10:40 am
by MtnViewJohn
Make sure that you have libpng installed and then compile it by typing 'make cfdg'.

Posted: Fri Nov 23, 2007 11:44 am
by notezik
Thanks but :

notezik@notezik-laptop:~/Bureau/ContextFreeSource2.1$ make cfdg
cc objs/cfdg.o objs/cfdgimpl.o objs/renderimpl.o objs/builder.o objs/shape.o objs/yglue.o objs/variation.o objs/countable.o objs/tempfile.o objs/aggCanvas.o objs/HSBColor.o objs/SVGCanvas.o objs/primShape.o objs/bounds.o objs/shapeSTL.o objs/tiledCanvas.o objs/pngCanvas.o objs/posixSystem.o objs/main.o objs/lex.yy.o objs/y.tab.o objs/agg_trans_affine.o -L/usr/local/lib -lstdc++ -lpng -lz -fexceptions -o cfdg
objs/posixSystem.o: In function `PosixSystem::tempFileForWrite(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
posixSystem.cpp:(.text+0x53e): warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
objs/yglue.o: In function `yg_ResetForNextFile':
yglue.cpp:(.text+0x6): undefined reference to `yylineno'
objs/yglue.o: In function `yg_Reset':
yglue.cpp:(.text+0x13f): undefined reference to `yylineno'
yglue.cpp:(.text+0x148): undefined reference to `yyrestart'
objs/yglue.o: In function `yyerror':
yglue.cpp:(.text+0x7e9): undefined reference to `yylineno'
yglue.cpp:(.text+0x814): undefined reference to `yylineno'
objs/y.tab.o: In function `yyparse':
y.tab.c:(.text+0x3fd): undefined reference to `yylex'
collect2: ld a retourné 1 code d'état d'exécution
make: *** [cfdg] Erreur 1

Posted: Sat Nov 24, 2007 1:56 pm
by MtnViewJohn
Do you have flex and bison installed?

Posted: Sun Jul 13, 2008 1:19 am
by ychaouche
Hello,

Same problem on my ubuntu box.

I have flex and bison installed on it but got :

Code: Select all

root@mbarek:~/DOWNLOAD/APPLICATIONS/ContextFreeSource2.1# make
cc   objs/cfdg.o objs/cfdgimpl.o objs/renderimpl.o objs/builder.o objs/shape.o objs/yglue.o objs/variation.o objs/countable.o objs/tempfile.o objs/aggCanvas.o objs/HSBColor.o objs/SVGCanvas.o objs/primShape.o objs/bounds.o objs/shapeSTL.o objs/tiledCanvas.o objs/pngCanvas.o objs/posixSystem.o objs/main.o objs/lex.yy.o objs/y.tab.o objs/agg_trans_affine.o -L/usr/local/lib -lstdc++ -lpng -lz -fexceptions -o cfdg
objs/posixSystem.o: In function `PosixSystem::tempFileForWrite(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
posixSystem.cpp:(.text+0x67b): warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
objs/yglue.o: In function `yyerror':
yglue.cpp:(.text+0xe): undefined reference to `yylineno'
yglue.cpp:(.text+0x39): undefined reference to `yylineno'
objs/yglue.o: In function `yg_Reset':
yglue.cpp:(.text+0x6ac): undefined reference to `yylineno'
yglue.cpp:(.text+0x6bc): undefined reference to `yyrestart'
objs/yglue.o: In function `yg_ResetForNextFile':
yglue.cpp:(.text+0x6c5): undefined reference to `yylineno'
objs/y.tab.o: In function `yyparse':
y.tab.c:(.text+0x3df): undefined reference to `yylex'
collect2: ld a retourné 1 code d'état d'exécution
make: *** [cfdg] Erreur 1
root@mbarek:~/DOWNLOAD/APPLICATIONS/ContextFreeSource2.1# 
I noticed that the cc command do not link to liby.a (yacc) nor libl.a (lex) where theses symbols should be defined (I suppose). Just to make sure, I searched for them in /usr/lib/liby.so and /usr/lib/libl.so but indeed there aren't there :

Code: Select all

root@mbarek:~/DOWNLOAD/APPLICATIONS/ContextFreeSource2.1# grep yylineno /usr/lib/liby.a 
root@mbarek:~/DOWNLOAD/APPLICATIONS/ContextFreeSource2.1# grep yylineno /usr/lib/libl.a 
root@mbarek:~/DOWNLOAD/APPLICATIONS/ContextFreeSource2.1#
But I found out that these symbols are defined in the src-win directory :

Code: Select all

chaouche@mbarek:~/DOWNLOAD/APPLICATIONS/ContextFreeSource2.1$ grep yyrestart -r . 
./src-common/yglue.cpp:    void yyrestart(FILE *new_file);
./src-common/yglue.cpp:    yyrestart(0);
./src-win/derived/lex.yy.c:#define YY_NEW_FILE yyrestart( yyin )
./src-win/derived/lex.yy.c:      * (via yyrestart()), so that the user can continue scanning by
./src-win/derived/lex.yy.c:void yyrestart YY_PROTO(( FILE *input_file ));
./src-win/derived/lex.yy.c:                     yyrestart( yyin );
./src-win/derived/lex.yy.c:                                     yyrestart( yyin );
./src-win/derived/lex.yy.c:void yyrestart( FILE *input_file )
./src-win/derived/lex.yy.c:void yyrestart( input_file )
Fichier binaire ./objs/yglue.o concorde
chaouche@mbarek:~/DOWNLOAD/APPLICATIONS/ContextFreeSource2.1$ 
Since I build it for my linux box this file (lex.yy.c) is not compiled and linked. I suppose it is a replacement file for Windows installation.

Any help would be greatly appreciated.

Posted: Sun Jul 13, 2008 2:49 am
by ychaouche
Ok here's what I did to solve the problem :

Code: Select all

chaouche@mbarek:~/DOWNLOAD/APPLICATIONS/ContextFreeSource2.1/src-win/derived$ cp ../../src-common/yglue.h .
chaouche@mbarek:~/DOWNLOAD/APPLICATIONS/ContextFreeSource2.1/src-win/derived$  gcc -c lex.yy.c

chaouche@mbarek:~/DOWNLOAD/APPLICATIONS/ContextFreeSource2.1/src-win/derived$ cd ..
chaouche@mbarek:~/DOWNLOAD/APPLICATIONS/ContextFreeSource2.1/src-win$ cd ..
chaouche@mbarek:~/DOWNLOAD/APPLICATIONS/ContextFreeSource2.1$  mv objs/lex.yy.o  objs/lex.yy.o-old
chaouche@mbarek:~/DOWNLOAD/APPLICATIONS/ContextFreeSource2.1$ cp src-win/derived/lex.yy.o objs/
chaouche@mbarek:~/DOWNLOAD/APPLICATIONS/ContextFreeSource2.1$ make
cc   objs/cfdg.o objs/cfdgimpl.o objs/renderimpl.o objs/builder.o objs/shape.o objs/yglue.o objs/variation.o objs/countable.o objs/tempfile.o objs/aggCanvas.o objs/HSBColor.o objs/SVGCanvas.o objs/primShape.o objs/bounds.o objs/shapeSTL.o objs/tiledCanvas.o objs/pngCanvas.o objs/posixSystem.o objs/main.o objs/lex.yy.o objs/y.tab.o objs/agg_trans_affine.o -L/usr/local/lib -lstdc++ -lpng -lz -fexceptions -o cfdg
objs/posixSystem.o: In function `PosixSystem::tempFileForWrite(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
posixSystem.cpp:(.text+0x67b): warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
strip cfdg
chaouche@mbarek:~/DOWNLOAD/APPLICATIONS/ContextFreeSource2.1$
HTH.



[/code]

Posted: Sun Jul 13, 2008 9:12 am
by MtnViewJohn
flex generates yylineno, yyrestart, and yylex in the lex.yy.c file when it compiles the cfdg.l file. The libl.a and liby.a libraries define default driver functions for flex and bison. But Context Free has its own driver code for flex and bison so the libraries are not used.

Flex and bison are not integrated into Visual Studio on Windows so we put in pre-compiled output files from flex and bison in the src-win/derived directory. You shouldn't need them if you are compiling on any type of Unix or Linux.

Is there a lex.yy.c file in your obj directory? Can you type make clean and make cfdg and post the compiler output?

Posted: Sun Jul 13, 2008 9:41 am
by ychaouche
I'm feeling silly now :/, everything works just right. I think I messed with the first installation.