Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7877859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:29:50+00:00 2026-06-03T03:29:50+00:00

I am trying to load a PHP extension made using SWIG, but I am

  • 0

I am trying to load a PHP extension made using SWIG, but I am getting the following error when starting PHP:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/libtg.so' - /usr/lib/php5/20090626/libtg.so: undefined symbol: __gxx_personality_v0 in Unknown on line 0

The extension I am trying to load is named libtg.so and was compiled with the command:

g++ -shared libtg_wrap.o -o libtg.so

where libtg_wrap.o is the object file for the wrapper code generated by SWIG.

The missing symbol __gxx_personality_v0 is found in libstdc++.so, as evident from the following command:

$ nm -D /usr/lib/libstdc++.so.6 | grep __gxx_personality_v0
00000000000b9990 T __gxx_personality_v0

libstdc++.so is referenced in libtg.so, as evident from the following command:

$ ldd libtg.so
linux-vdso.so.1 =>  (0x00007fff5f932000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f3fc937c000)
libm.so.6 => /lib/libm.so.6 (0x00007f3fc90f9000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f3fc8ee2000)
libc.so.6 => /lib/libc.so.6 (0x00007f3fc8b5f000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3fc98fc000)

so I don’t see why it cannot find the symbol. Any ideas on how I can further debug this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:29:52+00:00Added an answer on June 3, 2026 at 3:29 am

    It seems that somewhere in your compile process, the compiler or linker was not aware of a c++ source.

    When I tried swig (also to create a php extension), I created the following Makefile that may be handy in your case, so you may want to customize it for your project and give it a try, it’s pretty straighforward.

    See how I had to specify the “-c++” option to the swig command. Also, be sure to have .cpp extension for your source files and add “-lstdc++” to your linker flags.

    The important stuff should be the swig invocation (note the -c++ option):

    ${OUTPUTDIR}/${NAME}_swig.cpp:
        ${SWIG} -outdir ${OUTPUTDIR} \
            -oh ${OUTPUTDIR}/${NAME}_swig.h \
            -o ${OUTPUTDIR}/${NAME}_swig.cpp \
            -c++ -php \
            ${NAME}.i
    

    and the linker invocation (note the -lstdc flag) :

    ld -shared ${OUTPUTDIR}/*.o -o ${OUTPUTDIR}/${NAME}.so -lstdc++
    

    Hope it helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to php and I am getting this error trying to load
I'm trying to load a gzipped XML file using simplexml_load_file() PHP function, but I
I'm trying to load an image through PHP, but I don't know how. The
I am trying to load a xml document I created using PHP and DOM
I am getting a strange error message with the following piece of PHP code
I am trying to load the html content using c# (To simulate php function
I'm trying to build a C++ extension for python using swig. I've followed the
I am trying to load an extension of a php class by itself. I
Is it good to use an autoloader that load root/app/model/test.php when trying to use
I'm now trying to create a xml-rpc server with the CodeIgniter Framework. <?php $this->load->library('xmlrpc');

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.