pbiggar / phc

A compiler for PHP
132 stars 37 forks source link

Problem with compiling #144

Open pbiggar opened 9 years ago

pbiggar commented 9 years ago
Followed the hello world example, also tried with latest svn checkout, same problem,
as far I can see.

It's similar to this old issue: http://code.google.com/p/phc/issues/detail?id=123

To quote myself from that issue:
========================================================
Thanks Paul, however I'm still having this issue and a some difficulties to compile
the svn trunk, don't know why. Had to touch some files and got some errors during make:

make[2]: *** [optimize.lo] Error 1
make[2]: Leaving directory `/root/phc/phc-read-only'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/root/phc/phc-read-only'
make: *** [install] Error 2

And make install too. I can mail you the whole log if you want to. Thanks.
========================================================

I have attached the whole log file, hopefully it'll help you. The server was just installed
with:
Debian 64bit Squeeze
OpenSSH
Apache2
MySQL server + client
Anything said that should be installed.

Thanks for your great effort to make such a thing as this :)

Btw. saw your speech at youtube at Google Tech Talk, very interesting.

Original issue reported on code.google.com by emil86moe on 2011-07-27 22:32:17


pbiggar commented 9 years ago
Looks like there were changes made in the Zend API. It should be straightforward to
fix these, and I'd be happy to accept a patch that does it.

- zend_fcall_info_init: looks like it has a new signature, preventing the optimizer
from being built.

- <stdin>:71: error: ‘zval’ has no member named ‘refcount’
<stdin>:72: error: ‘zval’ has no member named ‘is_ref’

Looks like refcount and is_ref are not members any more. These should be changed to
use the equivalent macro I think.

Original issue reported on code.google.com by paul.biggar on 2011-07-29 18:39:26

pbiggar commented 9 years ago
Thanks for the reply, however I'm unfortunately unable to apply such a patch. I hope
someone else will take it up.

In the meantime, is it correct understood that, I can use PHC with an older version
of PHP (old stable)?

Original issue reported on code.google.com by emil86moe on 2011-08-02 13:25:24

pbiggar commented 9 years ago
I'd posted a fix for zend_fcall_info_init that got things working for me on 5.3, but
Andrei asked me not to commit it because he was working on a bigger change:

https://plonker.villiros.com/pipermail/phc-internals/2011-February/005922.html

Original issue reported on code.google.com by kevinday on 2011-08-02 16:50:02

pbiggar commented 9 years ago
kevin, I would say apply the patch. Andrei can undo it with his patch if he finishes
it.

Original issue reported on code.google.com by paul.biggar on 2011-08-02 19:45:33

pbiggar commented 9 years ago
Hi everyone,

  The aforementioned patch should work for any analysis pass of phc, but fails for
codegen. Since phc is not working with PHP 5.3.x, at least with this patch it can analyze
the code. I believe you may apply it.

  About the problem, I began to look at the codegen part of it, but with no advance.
Maybe someone with more background on the zend API can have more success.

Original issue reported on code.google.com by logytech on 2011-08-02 20:19:56

pbiggar commented 9 years ago
Could you explain where the codegen problem is happening? We're using 5.3.2 with no
apparent problems.

Original issue reported on code.google.com by bobdunkfloat on 2011-08-02 20:28:36

pbiggar commented 9 years ago
Hi bob, please try with this testcode: http://www.phpcompiler.org/lists/phc-internals/2010-December/005904.html

Original issue reported on code.google.com by logytech on 2011-08-02 20:47:01

pbiggar commented 9 years ago
Issue 137 has been merged into this issue.

Original issue reported on code.google.com by paul.biggar on 2011-08-22 08:41:46

pbiggar commented 9 years ago
Hi, I can't compile phc in Ubuntu 11.10

# gcc --version
gcc-4.6.real (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.

# g++ --version
g++-4.6.real (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.

libtool: link: g++ -Wextra -Wno-unused-parameter -Wno-write-strings -Wno-deprecated
-g -O2 -o src/.libs/phc phc.o -Wl,--export-dynamic  /usr/lib/libltdl.so -lboost_regex-mt
./.libs/libphc.so -L/usr/lib -lgccpp -lgc -ldl
./.libs/libphc.so: undefined reference to `boost::match_results<char const*, std::allocator<boost::sub_match<char
const*> > >::maybe_assign(boost::match_results<char const*, std::allocator<boost::sub_match<char
const*> > > const&)'
./.libs/libphc.so: undefined reference to `boost::re_detail::verify_options(unsigned
int, boost::regex_constants::_match_flags)'
./.libs/libphc.so: undefined reference to `boost::re_detail::get_mem_block()'
./.libs/libphc.so: undefined reference to `boost::match_results<__gnu_cxx::__normal_iterator<char
const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char
const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >
> >::maybe_assign(boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char
const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >
> > const&)'
./.libs/libphc.so: undefined reference to `boost::re_detail::perl_matcher<char const*,
std::allocator<boost::sub_match<char const*> >, boost::regex_traits<char, boost::cpp_regex_traits<char>
> >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char>
> > const&, boost::regex_constants::_match_flags)'
./.libs/libphc.so: undefined reference to `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char
const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char
const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >
>, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char,
boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)'
./.libs/libphc.so: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform_primary(char
const*, char const*) const'
./.libs/libphc.so: undefined reference to `boost::cpp_regex_traits<char>::toi(char
const*&, char const*, int) const'
./.libs/libphc.so: undefined reference to `boost::re_detail::get_default_error_string(boost::regex_constants::error_type)'
./.libs/libphc.so: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform(char
const*, char const*) const'
./.libs/libphc.so: undefined reference to `boost::re_detail::put_mem_block(void*)'
./.libs/libphc.so: undefined reference to `boost::basic_regex<char, boost::regex_traits<char,
boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)'
./.libs/libphc.so: undefined reference to `boost::re_detail::raise_runtime_error(std::runtime_error
const&)'
collect2: ld returned 1 exit status
make[2]: *** [src/phc] Ошибка 1

Original issue reported on code.google.com by gotlium on 2011-12-22 16:45:53

pbiggar commented 9 years ago
What version of phc are you using;? Is it the latest svn?

Original issue reported on code.google.com by paul.biggar on 2011-12-23 00:53:28

pbiggar commented 9 years ago
Yes, at first time I'm install from tar bar. When I can't compile, I do it from svn.
It's all boost packages, which installed on my pc:

libboost-all-dev 1.46.1.1
libboost-date-time-dev 1.46.1.1
libboost-date-time1.46-dev 1.46.1-5ubuntu2
libboost-date-time1.46.1 1.46.1-5ubuntu2
libboost-dev 1.46.1.1
libboost-filesystem-dev 1.46.1.1
libboost-filesystem1.46-dev 1.46.1-5ubuntu2
libboost-filesystem1.46.1 1.46.1-5ubuntu2
libboost-graph-dev 1.46.1.1
libboost-graph-parallel-dev 1.46.1.1
libboost-graph-parallel1.46-dev 1.46.1-5ubuntu3
libboost-graph-parallel1.46.1 1.46.1-5ubuntu3
libboost-graph1.46-dev 1.46.1-5ubuntu2
libboost-graph1.46.1 1.46.1-5ubuntu2
libboost-iostreams-dev 1.46.1.1
libboost-iostreams1.46-dev 1.46.1-5ubuntu2
libboost-iostreams1.46.1 1.46.1-5ubuntu2
libboost-math-dev 1.46.1.1
libboost-math1.46-dev 1.46.1-5ubuntu2
libboost-math1.46.1 1.46.1-5ubuntu2
libboost-mpi-dev 1.46.1.1
libboost-mpi-python-dev 1.46.1.1
libboost-mpi1.46-dev 1.46.1-5ubuntu3
libboost-mpi1.46.1 1.46.1-5ubuntu3
libboost-program-options-dev 1.46.1.1
libboost-program-options1.46-dev 1.46.1-5ubuntu2
libboost-program-options1.46.1 1.46.1-5ubuntu2
libboost-python-dev 1.46.1.1
libboost-python1.46-dev 1.46.1-5ubuntu2
libboost-python1.46.1 1.46.1-5ubuntu2
libboost-regex-dev 1.46.1.1
libboost-regex1.46-dev 1.46.1-5ubuntu2
libboost-regex1.46.1 1.46.1-5ubuntu2
libboost-serialization-dev 1.46.1.1
libboost-serialization1.46-dev 1.46.1-5ubuntu2
libboost-serialization1.46.1 1.46.1-5ubuntu2
libboost-signals-dev 1.46.1.1
libboost-signals1.46-dev 1.46.1-5ubuntu2
libboost-signals1.46.1 1.46.1-5ubuntu2
libboost-system-dev 1.46.1.1
libboost-system1.46-dev 1.46.1-5ubuntu2
libboost-system1.46.1 1.46.1-5ubuntu2
libboost-test-dev 1.46.1.1
libboost-test1.46-dev 1.46.1-5ubuntu2
libboost-test1.46.1 1.46.1-5ubuntu2
libboost-thread-dev 1.46.1.1
libboost-thread1.46-dev 1.46.1-5ubuntu2
libboost-thread1.46.1 1.46.1-5ubuntu2
libboost-wave-dev 1.46.1.1
libboost-wave1.46-dev 1.46.1-5ubuntu2
libboost-wave1.46.1 1.46.1-5ubuntu2
libboost1.46-dev 1.46.1-5ubuntu2

# php --version
PHP 5.3.6-13ubuntu3.3 with Suhosin-Patch (cli) (built: Dec 13 2011 18:18:37) 
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
    with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

If you need more information, tell me.

Original issue reported on code.google.com by gotlium on 2011-12-23 08:54:33

pbiggar commented 9 years ago
I'm also having tough time compiling under Ubuntu 11.10.

Using SVN, during phc configure, I get:
...
...
checking for maketea... config/phc_missing maketea
checking for php... /usr/local/bin/php
checking for zend_eval_string in -lphp5... yes
checking for sapi/embed/php_embed.h... yes
checking whether compiler supports covariant returns... yes
checking for /usr/lib/libCrun.so.1... no
checking for boostlib >= 1.35.0... yes
checking whether the Boost::Regex library is available... yes
checking for exit in -lboost_regex-mt... no
checking for exit in -lboost_regex-mt... (cached) no
checking for exit in -lboost_regex... no
checking for exit in -lboost_regex... (cached) no
checking for exit in -lboost_regex... (cached) no
checking for exit in -lboost_regex... (cached) no
configure: error: Could not link against boost_regex !

I have got all the libboost installed.
Here's an interesting finding.

1. Initially I complied PHC without php, and PHC configure no problem! (Of course this
is not I want)

2. Then I complied and install php-5.2.17, following PHC's documentation
3. Now PHC will halt at the above configure error.

Question: Could the above error caused by php ?

Original issue reported on code.google.com by cffong on 2011-12-31 09:59:44

pbiggar commented 9 years ago
i have exactly the same issue:/
but using debian testing.

during configure i get this:

configure: error: Could not link against boost_regex !

combined several php, libboost, and phc versions and i get that error every time.

Original issue reported on code.google.com by kovjan192@freemail.hu on 2012-01-24 04:23:14

pbiggar commented 9 years ago
I have the same issue on both Ubuntu 11.10 and a clean install of Fedora 16.

Original issue reported on code.google.com by alaeddine.mesbahi on 2012-01-25 16:44:01

pbiggar commented 9 years ago
Same here on Debian testing (wheezy), even if i build most of the libraries myself.
Compiling on Ubuntu 10.04 LTS (just for testing) works without a hitch.

It seems that something is going wrong in testing the libraries, as "exit" is definitely
in the lib. (if i skip the regex test, i get the same error on libgc: "checking for
main in -lgc... no")

Original issue reported on code.google.com by OverSoft.NL on 2012-02-08 10:57:25

pbiggar commented 9 years ago
Thanks for the bug reports. Just to let you know, there's no-one working on phc at the
moment, so if you need it fixed, you'll have to dig into it yourselves. I can help
with specific questions though.

Original issue reported on code.google.com by paul.biggar on 2012-02-08 17:22:58

pbiggar commented 9 years ago
My OS is Ubuntu 11.10.

I have the same problem , and its message is like that
"./.libs/libphc.so undefined reference to boost::re_detail".
(Similar to comment #9)

Thanks paul.biggar for this information.

Original issue reported on code.google.com by smartPG on 2012-03-04 15:31:57

pbiggar commented 9 years ago
I just hit the same problem when specifying php by hand:

checking for php... /usr/local/php/bin/php
checking for zend_eval_string in -lphp5... yes
checking for sapi/embed/php_embed.h... yes
checking whether compiler supports covariant returns... yes
checking for /usr/lib/libCrun.so.1... no
checking for boostlib >= 1.35.0... yes
checking whether the Boost::Regex library is available... yes
checking for exit in -lboost_regex-mt... no
checking for exit in -lboost_regex-mt... (cached) no
checking for exit in -lboost_regex... no
checking for exit in -lboost_regex... (cached) no
checking for exit in -lboost_regex... (cached) no
configure: error: Could not link against boost_regex !

Did anybody find a solution for this?

Original issue reported on code.google.com by eantoranz on 2012-05-25 19:05:38

pbiggar commented 9 years ago
Well well.... how about this:

configure:17347: checking for main in -lboost_regex-mt
configure:17366: g++ -o conftest -g -O2  -I/usr/include  -L/usr/lib conftest.cpp -lboost_regex-mt
 -lphp5 -L/usr/local/php/lib -R/usr/local/php/lib -ldl  >&5
g++: error: unrecognized option '-R'

Where does this -R option come from? Perhaps it's an old g++ option?

Original issue reported on code.google.com by eantoranz on 2012-05-25 19:19:56

pbiggar commented 9 years ago
I can't find a -R option in cpp so how do I get rid of it so that configure doesn't
use it when doing those checks? I'm also wondering why this doesn't happen when I don't
specify php by hand.

Original issue reported on code.google.com by eantoranz on 2012-05-25 19:48:28

pbiggar commented 9 years ago
A little bit more, the problem seems to be in $LIBS at that point ( and it must be set
in PHP detection, right ?).

LIBS='-lphp5 -L/usr/local/php/lib -R/usr/local/php/lib -ldl '

Original issue reported on code.google.com by eantoranz on 2012-05-25 20:05:30

pbiggar commented 9 years ago
As I recall, -R is used to make the dynamic linking work. I think libtool adds it (or
perhaps we add it and libtool is supposed to transform it to the right thing on your
platform.

On solution might be to upgrade phc's copy of libtool, maybe?

Original issue reported on code.google.com by paul.biggar on 2012-05-25 20:13:57

pbiggar commented 9 years ago
There's an assigment of LIBS twice in the PHP detection where -R is added to the options.
I commented it out and added a line that was the exact LIBS assignment without the
-Rx option..... configure ran successfully and I'm compiling at the moment. Let's see
if it works.

Original issue reported on code.google.com by eantoranz on 2012-05-25 20:14:54

pbiggar commented 9 years ago
It was too beautiful to be true. I knew I was gonna hit a brick wall:

/bin/bash ./libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.  -I/usr/include
 -I/usr/include -I/usr/include/xercesc -I./src -I. -I./3rdparty/getopt -I./src/generated
-isystem/usr/local/php/include/php -isystem/usr/local/php/include/php/main -isystem/usr/local/php/include/php/TSRM
-isystem/usr/local/php/include/php/Zend -DDATADIR=\"/usr/local/share\" -DPKGLIBDIR=\"/usr/local/lib/phc\"
-Wall  -Wextra -Wno-unused-parameter -Wno-write-strings -Wno-deprecated -g -O2 -MT
optimize.lo -MD -MP -MF .deps/optimize.Tpo -c -o optimize.lo `test -f 'src/embed/optimize.cpp'
|| echo './'`src/embed/optimize.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I/usr/include -I/usr/include -I/usr/include/xercesc
-I./src -I. -I./3rdparty/getopt -I./src/generated -isystem/usr/local/php/include/php
-isystem/usr/local/php/include/php/main -isystem/usr/local/php/include/php/TSRM -isystem/usr/local/php/include/php/Zend
-DDATADIR=\"/usr/local/share\" -DPKGLIBDIR=\"/usr/local/lib/phc\" -Wall -Wextra -Wno-unused-parameter
-Wno-write-strings -Wno-deprecated -g -O2 -MT optimize.lo -MD -MP -MF .deps/optimize.Tpo
-c src/embed/optimize.cpp  -fPIC -DPIC -o .libs/optimize.o
src/embed/optimize.cpp: In static member function 'static Method_info* PHP::get_method_info(String*)':
src/embed/optimize.cpp:223:63: error: invalid conversion from 'zend_fcall_info* {aka
_zend_fcall_info*}' to 'uint {aka unsigned int}' [-fpermissive]
src/embed/optimize.cpp:223:63: error: cannot convert 'zend_fcall_info_cache* {aka _zend_fcall_info_cache*}'
to 'zend_fcall_info* {aka _zend_fcall_info*}' for argument '3' to 'int zend_fcall_info_init(zval*,
uint, zend_fcall_info*, zend_fcall_info_cache*, char**, char**)'
src/embed/optimize.cpp: In member function 'virtual bool Internal_method_info::return_by_ref()':
src/embed/optimize.cpp:248:22: error: 'struct _zend_function::<anonymous>' has no member
named 'return_reference'
src/embed/optimize.cpp:249:1: warning: control reaches end of non-void function [-Wreturn-type]
make[2]: *** [optimize.lo] Error 1
make[2]: Leaving directory `/home/antoranz/Descargas/php/phc-0.3.0.1'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/antoranz/Descargas/php/phc-0.3.0.1'
make: *** [all] Error 2

But then it's another story/bug so I guess that's it for this thread

Original issue reported on code.google.com by eantoranz on 2012-05-25 20:16:38

pbiggar commented 9 years ago
They look easy to fix though. It might be 5.3 issues - where did you get the code?

There were some pushes since the last release, some are in google code svn, and at
least one is on github only. (Someone needs to move everything to github, but I dont
have time, so I just started taking all patched to github).

Original issue reported on code.google.com by paul.biggar on 2012-05-25 20:20:10

pbiggar commented 9 years ago
I just install phc from this link step by step http://phpcompiler.org/doc/latest/install.html#php-embed-sapi-installation-instructions

but I got this error:
checking for /usr/lib/libCrun.so.1... no
checking for boostlib >= 1.35.0... yes
checking whether the Boost::Regex library is available... yes
checking for exit in -lboost_regex-mt... no
checking for exit in -lboost_regex-mt... (cached) no
checking for exit in -lboost_regex... no
checking for exit in -lboost_regex... (cached) no
checking for exit in -lboost_regex... (cached) no
configure: error: Could not link against boost_regex !

I do not know what is this error.
Is there any dependency that I have to install or missing configuration?
Please help me if any body solved this problem.
Thanks

Original issue reported on code.google.com by mohammad.ghazavi on 2012-08-23 06:47:02

pbiggar commented 9 years ago
On Ubuntu 12.04, phc successfully configures but won't make. The make fails when linking,
reporting a string of linker errors starting with

./.libs/libphc.so: undefined reference to `boost::re_detail:.....

I think this is the same issue caused by commenter #9. The issue is caused by an incorrect
argument order to the linker. (the -lboost_regex-mt argument has no effect because
it's specified after ./.libs/libphc.so). You can continue linking if you manually move
the g++ arguments around.

If anyone is reading this, what's the development status of phc? I want to play with
it, but from what I'm reading, it seems that there's both a SVN and a github repository,
neither of which contains all of the latest changes. (I want to use it for research
purposes -- not production -- so it doesn't bother me that it's still incomplete.)

Original issue reported on code.google.com by jmstuckman on 2012-09-04 05:02:57

pbiggar commented 9 years ago
Regarding the development story:

- all new code via pull request on github
- there are patches in SVN that have not been ported
- we should move the webiste to github too
- we need to update the website to point to the new stuff
- help appreciated :)

Original issue reported on code.google.com by paul.biggar on 2012-09-04 06:43:03

pbiggar commented 9 years ago
I have ported this :
https://github.com/h4ck3rm1k3/phc/commit/84eb90b21edc95b3a8f6915e38226c3faa6a0f36

Original issue reported on code.google.com by JamesMikeDuPont on 2012-09-24 13:01:00

pbiggar commented 9 years ago
I believe that this patch is not enough. Please take a look at the following post: http://www.phpcompiler.org/lists/phc-internals/2011-February/005922.html

[]z, Andrei

Original issue reported on code.google.com by logytech on 2012-09-24 13:32:29

pbiggar commented 9 years ago
Well now that I have a compiler that can build, i found out that the project I wanted
to use needs exceptions, so I dont need to search further. I guess I need to figure
out how to extend the codegen. I guess we need tests cases for this bug. Can you provide
code that will exercise the bug you describe?
thanks
mike

Original issue reported on code.google.com by JamesMikeDuPont on 2012-09-25 11:04:32

pbiggar commented 9 years ago
As far as I can remember, phc can parse try/catch commands. Unfortunately it does not
generate code for such instructions. In fact, you'll need to extend phc's code generator
to support this feature. However, if you also need optimizations you'll have a bad
time. Don't get me wrong, phc's optimization pass is awesome, but it still needs a
lot of work. (;

Original issue reported on code.google.com by logytech on 2012-09-25 19:00:08

pbiggar commented 9 years ago
At this point I would be happy if I could get it not to fail on these exceptions, please
tell me how to do that because i want to do a basic code check first.
mike

Original issue reported on code.google.com by JamesMikeDuPont on 2012-09-25 19:30:29

pbiggar commented 9 years ago
You have two options: (1) Implement a dummy codegen target for try and catch that does
nothing; (2) Implement an AST pass that strips try/catch but keeps its body. I haven't
worked with codegen in phc so I don't know how difficult it would be to implement the
first option. The second option shouldn't be hard, since it's well documented in phc
site. Take a look at: http://phpcompiler.org/doc/latest/traversalintro.html

Original issue reported on code.google.com by logytech on 2012-09-25 20:19:21

wjain commented 7 years ago

src/embed/optimize.cpp:223:63: error: invalid conversion from 'zend_fcall_info {aka _zend_fcall_info}' to 'uint {aka unsigned int}' [-fpermissive]

Modify int result = zend_fcall_info_init (&fn, &fci, &fcic TSRMLS_CC); to int result = zend_fcall_info_init (&fn, 0, &fci, &fcic, NULL, NULL TSRMLS_CC);