LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 07:30 PM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Blog Entries: 1

Rep: Reputation: 90
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, 10:06 PM   #2
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
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



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-27-2011 11:20 PM
Code for generating a Pop-Up window in C lbdgwgt Programming 2 08-04-2010 08:16 AM
writing C code for generating load variations expeliarmus Programming 5 07-26-2007 08:45 AM
C++ Generating code balgaltz Programming 3 12-28-2006 10:21 PM
code for generating random samples! aru_04 Programming 2 07-21-2005 08:35 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:47 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration