Problem when compiling the OpenSCAD.

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem when compiling the OpenSCAD.

Henrique Dias
I can not compile the OpenSCAD, because of the following error:

yacc -d -p parser -b parser src/parser.y
yacc: e - line 27 of "src/parser.y", syntax error
%expect 1 /* Expect 1 shift/reduce conflict for ifelse_statement - "dangling
else problem" */
^
make: *** [parser_yacc.h] Error 1

After some research I found a solution to this problem but do not know if it's the right one.
I replaced the yacc by the bison parser in Makefile and work.

Steps to build the OpenSCAD successfully:

git clone --depth=1 git://github.com/openscad/openscad.git
cd openscad
qmake
cp Makefile Makefile.org
nano -w Makefile <-- Replace the yacc parser by the bison (find the line 338).
make

At the end of the build you can see the "openscad" binary.

Comparing the original Makefile, with the new Makefile:

diff -u Makefile.org Makefile
--- Makefile.org        2011-01-28 23:10:50.000000000 +0000
+++ Makefile    2011-01-28 23:11:18.000000000 +0000
@@ -335,7 +335,7 @@
 compiler_yacc_decl_clean:
        -$(DEL_FILE) parser_yacc.h
 parser_yacc.h: src/parser.y
-       yacc -d -p parser -b parser src/parser.y
+       bison -d -p parser -b parser src/parser.y
         rm -f parser_yacc.h parser_yacc.cpp
         mv -f parser.tab.h parser_yacc.h
         mv -f parser.tab.c parser_yacc.cpp


Henrique Dias
Reply | Threaded
Open this post in threaded view
|

Re: Problem when compiling the OpenSCAD.

Giles Bathgate-2

I believe on systems where yacc is not installed /usr/bin/yacc is a symlink to bison. on your system you must have already had yacc installed. However the "fix" you propose shouldnt be done in the makefile, (it gets overwrittern each time you run qmake) all that is needed is a

QMAKE_YACC = bison

line somewhere in the openscad.pro

Regards

Giles


On 28 Jan 2011 23:42, "Henrique Dias" <[hidden email]> wrote:
> I can not compile the OpenSCAD, because of the following error:
>
> yacc -d -p parser -b parser src/parser.y
> yacc: e - line 27 of "src/parser.y", syntax error
> %expect 1 /* Expect 1 shift/reduce conflict for ifelse_statement - "dangling
> else problem" */
> ^
> make: *** [parser_yacc.h] Error 1
>
> After some research I found a solution to this problem but do not know if
> it's the right one.
> I replaced the yacc by the bison parser in Makefile and work.
>
> Steps to build the OpenSCAD successfully:
>
> git clone --depth=1 git://github.com/openscad/openscad.git
> cd openscad
> qmake
> cp Makefile Makefile.org
> nano -w Makefile <-- Replace the yacc parser by the bison (find the line
> 338).
> make
>
> At the end of the build you can see the "openscad" binary.
>
> Comparing the original Makefile, with the new Makefile:
>
> diff -u Makefile.org Makefile
> --- Makefile.org 2011-01-28 23:10:50.000000000 +0000
> +++ Makefile 2011-01-28 23:11:18.000000000 +0000
> @@ -335,7 +335,7 @@
> compiler_yacc_decl_clean:
> -$(DEL_FILE) parser_yacc.h
> parser_yacc.h: src/parser.y
> - yacc -d -p parser -b parser src/parser.y
> + bison -d -p parser -b parser src/parser.y
> rm -f parser_yacc.h parser_yacc.cpp
> mv -f parser.tab.h parser_yacc.h
> mv -f parser.tab.c parser_yacc.cpp
>
>
> Henrique Dias
Reply | Threaded
Open this post in threaded view
|

Re: Problem when compiling the OpenSCAD.

Stuart Young
On 29 January 2011 12:45, Giles Bathgate <[hidden email]> wrote:
> I believe on systems where yacc is not installed /usr/bin/yacc is a symlink
> to bison. on your system you must have already had yacc installed. However
> the "fix" you propose shouldnt be done in the makefile, (it gets
> overwrittern each time you run qmake) all that is needed is a
>
> QMAKE_YACC = bison
>
> line somewhere in the openscad.pro

Henrique: Out of interest, can you please run the following command
and post the output?

'yacc --version'

It would be good to know which version of yacc doesn't work. With
luck, someone could implement a test in the makefile to check which is
installed and then generate a meaningful error and/or use bison
instead.

--
Stuart Young (aka Cefiar)

Reply | Threaded
Open this post in threaded view
|

Re: Problem when compiling the OpenSCAD.

Giles Bathgate-2

I would be surprised if you find any version of yacc that supports bison extensions ;)

On 29 Jan 2011 02:01, "Stuart Young" <[hidden email]> wrote:
> On 29 January 2011 12:45, Giles Bathgate <[hidden email]> wrote:
>> I believe on systems where yacc is not installed /usr/bin/yacc is a symlink
>> to bison. on your system you must have already had yacc installed. However
>> the "fix" you propose shouldnt be done in the makefile, (it gets
>> overwrittern each time you run qmake) all that is needed is a
>>
>> QMAKE_YACC = bison
>>
>> line somewhere in the openscad.pro
>
> Henrique: Out of interest, can you please run the following command
> and post the output?
>
> 'yacc --version'
>
> It would be good to know which version of yacc doesn't work. With
> luck, someone could implement a test in the makefile to check which is
> installed and then generate a meaningful error and/or use bison
> instead.
>
> --
> Stuart Young (aka Cefiar)
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
Reply | Threaded
Open this post in threaded view
|

Re: Problem when compiling the OpenSCAD.

Giles Bathgate-2

Openscad does however compile with bison -y (yacc compatible mode) so version info would be useful.

On 29 Jan 2011 08:39, "Giles Bathgate" <[hidden email]> wrote:
> I would be surprised if you find any version of yacc that supports bison
> extensions ;)
> On 29 Jan 2011 02:01, "Stuart Young" <[hidden email]> wrote:
>> On 29 January 2011 12:45, Giles Bathgate <[hidden email]> wrote:
>>> I believe on systems where yacc is not installed /usr/bin/yacc is a
> symlink
>>> to bison. on your system you must have already had yacc installed.
> However
>>> the "fix" you propose shouldnt be done in the makefile, (it gets
>>> overwrittern each time you run qmake) all that is needed is a
>>>
>>> QMAKE_YACC = bison
>>>
>>> line somewhere in the openscad.pro
>>
>> Henrique: Out of interest, can you please run the following command
>> and post the output?
>>
>> 'yacc --version'
>>
>> It would be good to know which version of yacc doesn't work. With
>> luck, someone could implement a test in the makefile to check which is
>> installed and then generate a meaningful error and/or use bison
>> instead.
>>
>> --
>> Stuart Young (aka Cefiar)
>> _______________________________________________
>> OpenSCAD mailing list
>> [hidden email]
>> http://rocklinux.net/mailman/listinfo/openscad
Reply | Threaded
Open this post in threaded view
|

Re: Problem when compiling the OpenSCAD.

Henrique Dias
In reply to this post by Stuart Young
My yacc don't have --version option!!!

$ yacc --version
usage: yacc [-dlrtv] [-b file_prefix] [-p symbol_prefix] filename


On Sat, Jan 29, 2011 at 2:01 AM, Stuart Young <[hidden email]> wrote:
On 29 January 2011 12:45, Giles Bathgate <[hidden email]> wrote:
> I believe on systems where yacc is not installed /usr/bin/yacc is a symlink
> to bison. on your system you must have already had yacc installed. However
> the "fix" you propose shouldnt be done in the makefile, (it gets
> overwrittern each time you run qmake) all that is needed is a
>
> QMAKE_YACC = bison
>
> line somewhere in the openscad.pro

Henrique: Out of interest, can you please run the following command
and post the output?

'yacc --version'

It would be good to know which version of yacc doesn't work. With
luck, someone could implement a test in the makefile to check which is
installed and then generate a meaningful error and/or use bison
instead.

--
Stuart Young (aka Cefiar)
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad

Reply | Threaded
Open this post in threaded view
|

Re: Problem when compiling the OpenSCAD.

Henrique Dias
In reply to this post by Giles Bathgate-2
Hi Giles,

Thanks for the help, but I have two binaries, yacc and bison.

You are right, the best choice is to put the bison in the "openscad.pro" file.


git clone --depth=1 git://github.com/openscad/openscad.git
cd openscad
echo "QMAKE_YACC = bison" >> openscad.pro
qmake
make
make install


Henrique Dias

On Sat, Jan 29, 2011 at 1:45 AM, Giles Bathgate <[hidden email]> wrote:

I believe on systems where yacc is not installed /usr/bin/yacc is a symlink to bison. on your system you must have already had yacc installed. However the "fix" you propose shouldnt be done in the makefile, (it gets overwrittern each time you run qmake) all that is needed is a

QMAKE_YACC = bison

line somewhere in the openscad.pro

Regards

Giles


On 28 Jan 2011 23:42, "Henrique Dias" <[hidden email]> wrote:
> I can not compile the OpenSCAD, because of the following error:
>
> yacc -d -p parser -b parser src/parser.y
> yacc: e - line 27 of "src/parser.y", syntax error
> %expect 1 /* Expect 1 shift/reduce conflict for ifelse_statement - "dangling
> else problem" */
> ^
> make: *** [parser_yacc.h] Error 1
>
> After some research I found a solution to this problem but do not know if
> it's the right one.
> I replaced the yacc by the bison parser in Makefile and work.
>
> Steps to build the OpenSCAD successfully:
>
> git clone --depth=1 git://github.com/openscad/openscad.git
> cd openscad
> qmake
> cp Makefile Makefile.org
> nano -w Makefile <-- Replace the yacc parser by the bison (find the line
> 338).
> make
>
> At the end of the build you can see the "openscad" binary.
>
> Comparing the original Makefile, with the new Makefile:
>
> diff -u Makefile.org Makefile
> --- Makefile.org 2011-01-28 23:10:50.000000000 +0000
> +++ Makefile 2011-01-28 23:11:18.000000000 +0000
> @@ -335,7 +335,7 @@
> compiler_yacc_decl_clean:
> -$(DEL_FILE) parser_yacc.h
> parser_yacc.h: src/parser.y
> - yacc -d -p parser -b parser src/parser.y
> + bison -d -p parser -b parser src/parser.y
> rm -f parser_yacc.h parser_yacc.cpp
> mv -f parser.tab.h parser_yacc.h
> mv -f parser.tab.c parser_yacc.cpp
>
>
> Henrique Dias

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


Reply | Threaded
Open this post in threaded view
|

Re: Problem when compiling the OpenSCAD.

Giles Bathgate-2

I think the following will also work:


git clone --depth=1 git://github.com/openscad/openscad.git
cd openscad
QMAKE_YACC=bison qmake
make
make install

As for tracking down the version number did you try:

yacc -v

to get the version info?

Also, are you on windows? I seem to remember having this problem on windows. Anyway if you can track down the binary, open it in a hex editor or even notepad and see if there is any version info in there.

Regards

Giles


Reply | Threaded
Open this post in threaded view
|

Re: Problem when compiling the OpenSCAD.

Giles Bathgate-2
On 29 January 2011 20:00, Giles Bathgate <[hidden email]> wrote:
> yacc -v

sorry that should be:

yacc -V

(uppercase V)

Regards

Giles

Reply | Threaded
Open this post in threaded view
|

Re: Problem when compiling the OpenSCAD.

Henrique Dias
In reply to this post by Giles Bathgate-2
I tried to get the version, but when executing the command I got this:

$ yacc -v
usage: yacc [-dlrtv] [-b file_prefix] [-p symbol_prefix] filename

My OS is Gentoo Linux

The package that I have installed is:

*  dev-util/yacc
      Latest version available: 1.9.1-r5
      Latest version installed: 1.9.1-r5
      Size of files: 63 kB
      Homepage:      http://dinosaur.compilertools.net/#yacc
      Description:   Yacc: Yet Another Compiler-Compiler
      License:       as-is



On Sat, Jan 29, 2011 at 8:00 PM, Giles Bathgate <[hidden email]> wrote:

I think the following will also work:


git clone --depth=1 git://github.com/openscad/openscad.git
cd openscad
QMAKE_YACC=bison qmake
make
make install

As for tracking down the version number did you try:

yacc -v

to get the version info?

Also, are you on windows? I seem to remember having this problem on windows. Anyway if you can track down the binary, open it in a hex editor or even notepad and see if there is any version info in there.

Regards

Giles



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad