LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-27-2012, 08:30 PM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Rep: Reputation: 83
phc is generating incomplete code?


Hi!

I just compiled phc against php 5.2. Now, when I call phc to compile a simple php file, I get a 256 error from g++.

Code:
$ /usr/local/phc/bin/phc -c Hello.php -o hello
Error: gcc exited with error 256 (executed via 'gcc -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -L/usr/local/php/lib -Wl,-R/usr/local/php/lib -lphp5 -xc - -ggdb3 -O0 -ohello ')
So, I asked phc to generate C code and saved it into a file. When I tried to compile it, no surprises, it fails.... when I se the generated code, I find that main is incomplete.

File ends up like this:

Code:
int
main (int argc, char* argv[])
{
   int phc_exit_status;
   signal(SIGABRT, sighandler);
   signal(SIGSEGV, sighandler);

   TSRMLS_D;
   php_embed_init (argc, argv PTSRMLS_CC);
   zend_first_try
   {


      // load the compiled extension
      zend_startup_module (&app_module_entry);

      zval main_name;
      ZVAL_STRING (&main_name, "__MAIN__", NULL);

      zval retval;
Just like that. What's going on?
 
Old 05-27-2012, 11:06 PM   #2
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
Well..... this is very weird. I think the problem is in the parameters that g++ is getting when being called from phc (which, by the way, is the same problem that the compilation of phc was about).

If you recall (http://www.linuxquestions.org/questi...-of-it-946931/) I had to manually pass the linker some -L and -l parameters with -Wl (was there a change in the way g++ passes this parameters since the days of the last phc release?).

So..... I was able to make phc compile my php program by passing this additional parameters:

Code:
-C "-Wl\,-L/usr/local/php/lib" -C "-Wl\,-L/usr/local/boost/lib" -C "-Wl\,-lphp5" -C "-Wl\,-lboost_regex"
 
  


Reply

Tags
compilation, failure, gcc, phc


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Generating Code from DSLs LXer Syndicated Linux News 0 09-28-2011 12:20 AM
Code for generating a Pop-Up window in C lbdgwgt Programming 2 08-04-2010 09:16 AM
writing C code for generating load variations expeliarmus Programming 5 07-26-2007 09:45 AM
C++ Generating code balgaltz Programming 3 12-28-2006 11:21 PM
code for generating random samples! aru_04 Programming 2 07-21-2005 09:35 AM


All times are GMT -5. The time now is 10:25 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration