Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A way to distribute .so file #322

Open
RamonSmit opened this issue Apr 4, 2017 · 4 comments
Open

A way to distribute .so file #322

RamonSmit opened this issue Apr 4, 2017 · 4 comments

Comments

@RamonSmit
Copy link

Hi all,

Thanks for the lovely project! I'm really going to learn alot from this.

One question. I'm wondering how i'm going to include the phpcpp.so or libphpcpp.a file
into my project so I can just distribute only my compiled .so file.

Is there a way to do this?

Cheers,
Ramon Smit

@sjinks
Copy link
Contributor

sjinks commented Apr 5, 2017

Just make sure to link your PHP extension against libphpcpp.a and not against phpcpp.so. You will probably need to recompile libphpcpp.a with -fpic or -fPIC.

@RamonSmit
Copy link
Author

RamonSmit commented Apr 5, 2017

Hi @sjinks,

Thanks for your awnser.

My Makefile for PHP-CPP consists of:

COMPILER_FLAGS          =        -Wall -c -std=c++11 -fvisibility=hidden -DBUILDING_PHPCPP -Wno-write-strings -MD
SHARED_COMPILER_FLAGS	=        -fpic
STATIC_COMPILER_FLAGS	=        -fpic
PHP_COMPILER_FLAGS      =        ${COMPILER_FLAGS} `${PHP_CONFIG} --includes`

and the Makefile of the php extention I want to comple consists:

COMPILER_FLAGS		=	-Wall -c -O2 -std=c++11 -fpic -o
LINKER_FLAGS		=	-shared -fpic -Wl,--whole-archive
LINKER_DEPENDENCIES	=	-l:libphpcpp.a -Wl,--no-whole-archive

What else do I need to change?

Thanks in adcance,

Ramon Smit

@sjinks
Copy link
Contributor

sjinks commented Apr 5, 2017

Well, just try to build the extension and check with ldd if your resulting .so file depends on phpcpp.so.

@RamonSmit
Copy link
Author

Alright,

I get the following results:

[root@panel php-modules]# ldd dcss.so
./dcss.so: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./dcss.so)
./dcss.so: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.7' not found (required by ./dcss.so)
./dcss.so: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./dcss.so)
./dcss.so: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./dcss.so)
./dcss.so: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by ./dcss.so)
./dcss.so: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./dcss.so)
./dcss.so: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./dcss.so)
        linux-vdso.so.1 =>  (0x00007fffe8750000)
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007fe697adb000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fe6978c5000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fe697530000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fe698096000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fe6972ac000)

So from my perspective it links libphpcpp.a correctly to my plugin?

Now I need to find out how to require the other ones

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants