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

Compile error under mac... #255

Open
yarcowang opened this Issue Jul 17, 2016 · 7 comments

Comments

Projects
None yet
2 participants
@yarcowang

yarcowang commented Jul 17, 2016

In file included from zend/includes.h:72:
zend/../include/streams.h:24:8: error: thread-local storage is not supported for the current target
extern thread_local PHPCPP_EXPORT std::ostream out;
       ^
zend/../include/streams.h:25:8: error: thread-local storage is not supported for the current target
extern thread_local PHPCPP_EXPORT std::ostream error;
       ^
zend/../include/streams.h:26:8: error: thread-local storage is not supported for the current target
extern thread_local PHPCPP_EXPORT std::ostream notice;
       ^
zend/../include/streams.h:27:8: error: thread-local storage is not supported for the current target
extern thread_local PHPCPP_EXPORT std::ostream warning;
       ^
zend/../include/streams.h:28:8: error: thread-local storage is not supported for the current target
extern thread_local PHPCPP_EXPORT std::ostream deprecated;
       ^
5 errors generated.
make: *** [shared/zend/base.o] Error 1

mac version 10.10.5
php installed from homebrew:

yarco@me PHP-CPP$ brew info php70
homebrew/php/php70: stable 7.0.8 (bottled), HEAD
PHP Version 7.0
https://php.net
@willianszwy

This comment has been minimized.

Show comment
Hide comment
@willianszwy

willianszwy Jul 28, 2016

hi,
I changed the default compiler to the g++-6 (installed by brew )

willianszwy commented Jul 28, 2016

hi,
I changed the default compiler to the g++-6 (installed by brew )

@yarcowang

This comment has been minimized.

Show comment
Hide comment
@yarcowang

yarcowang Jul 28, 2016

After upgrade to g++-6, then do CXX=g++-6 make, i got:

...
g++-6 -Wall -c -std=c++11 -fvisibility=hidden -DBUILDING_PHPCPP -Wno-write-strings -g `php-config --includes` -fpic -o shared/zend/zval.o zend/zval.cpp
/usr/local/bin/php-config: line 43: /usr/local/Library/ENV/4.3/sed: No such file or directory
g++-6 -shared -g `php-config --ldflags` -Wl,-soname,libphpcpp.so.2.0 -o libphpcpp.so.2.0.0 shared/common/modifiers.o shared/common/streambuf.o shared/zend/base.o shared/zend/callable.o shared/zend/classbase.o shared/zend/classimpl.o shared/zend/constant.o shared/zend/constantfuncs.o shared/zend/eval.o shared/zend/exception_handler.o shared/zend/exists.o shared/zend/extension.o shared/zend/extensionimpl.o shared/zend/fatalerror.o shared/zend/file.o shared/zend/function.o shared/zend/functor.o shared/zend/global.o shared/zend/globals.o shared/zend/hashmember.o shared/zend/ini.o shared/zend/inivalue.o shared/zend/iteratorimpl.o shared/zend/members.o shared/zend/module.o shared/zend/namespace.o shared/zend/object.o shared/zend/sapi.o shared/zend/script.o shared/zend/streambuf.o shared/zend/streams.o shared/zend/super.o shared/zend/value.o shared/zend/valueiterator.o shared/zend/zendcallable.o shared/zend/zval.o
/usr/local/bin/php-config: line 43: /usr/local/Library/ENV/4.3/sed: No such file or directory
ld: unknown option: -soname
collect2: error: ld returned 1 exit status
make: *** [libphpcpp.so.2.0.0] Error 1

yarcowang commented Jul 28, 2016

After upgrade to g++-6, then do CXX=g++-6 make, i got:

...
g++-6 -Wall -c -std=c++11 -fvisibility=hidden -DBUILDING_PHPCPP -Wno-write-strings -g `php-config --includes` -fpic -o shared/zend/zval.o zend/zval.cpp
/usr/local/bin/php-config: line 43: /usr/local/Library/ENV/4.3/sed: No such file or directory
g++-6 -shared -g `php-config --ldflags` -Wl,-soname,libphpcpp.so.2.0 -o libphpcpp.so.2.0.0 shared/common/modifiers.o shared/common/streambuf.o shared/zend/base.o shared/zend/callable.o shared/zend/classbase.o shared/zend/classimpl.o shared/zend/constant.o shared/zend/constantfuncs.o shared/zend/eval.o shared/zend/exception_handler.o shared/zend/exists.o shared/zend/extension.o shared/zend/extensionimpl.o shared/zend/fatalerror.o shared/zend/file.o shared/zend/function.o shared/zend/functor.o shared/zend/global.o shared/zend/globals.o shared/zend/hashmember.o shared/zend/ini.o shared/zend/inivalue.o shared/zend/iteratorimpl.o shared/zend/members.o shared/zend/module.o shared/zend/namespace.o shared/zend/object.o shared/zend/sapi.o shared/zend/script.o shared/zend/streambuf.o shared/zend/streams.o shared/zend/super.o shared/zend/value.o shared/zend/valueiterator.o shared/zend/zendcallable.o shared/zend/zval.o
/usr/local/bin/php-config: line 43: /usr/local/Library/ENV/4.3/sed: No such file or directory
ld: unknown option: -soname
collect2: error: ld returned 1 exit status
make: *** [libphpcpp.so.2.0.0] Error 1
@willianszwy

This comment has been minimized.

Show comment
Hide comment
@willianszwy

willianszwy Jul 28, 2016

Change -soname to -install_name

willianszwy commented Jul 28, 2016

Change -soname to -install_name

@yarcowang

This comment has been minimized.

Show comment
Hide comment
@yarcowang

yarcowang Jul 29, 2016

After change lineno 179 (makefile) from

    ${LINKER} ${PHP_LINKER_FLAGS} -Wl,-soname,libphpcpp.so.$(SONAME) -o $@ ${COMMON_SHARED_OBJECTS} ${PHP_SHARED_OBJECTS}

To

    ${LINKER} ${PHP_LINKER_FLAGS} -Wl,-install_name,libphpcpp.so.$(SONAME) -o $@ ${COMMON_SHARED_OBJECTS} ${PHP_SHARED_OBJECTS}

Then i got this:

      Php::StreamBuf::sync()    in streambuf.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [libphpcpp.so.2.0.0] Error 1

Maybe i shouldn't compile it under mac?

yarcowang commented Jul 29, 2016

After change lineno 179 (makefile) from

    ${LINKER} ${PHP_LINKER_FLAGS} -Wl,-soname,libphpcpp.so.$(SONAME) -o $@ ${COMMON_SHARED_OBJECTS} ${PHP_SHARED_OBJECTS}

To

    ${LINKER} ${PHP_LINKER_FLAGS} -Wl,-install_name,libphpcpp.so.$(SONAME) -o $@ ${COMMON_SHARED_OBJECTS} ${PHP_SHARED_OBJECTS}

Then i got this:

      Php::StreamBuf::sync()    in streambuf.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [libphpcpp.so.2.0.0] Error 1

Maybe i shouldn't compile it under mac?

@willianszwy

This comment has been minimized.

Show comment
Hide comment
@willianszwy

willianszwy Jul 29, 2016

you need add -undefined dynamic_lookup to LINKER_FLAGS

willianszwy commented Jul 29, 2016

you need add -undefined dynamic_lookup to LINKER_FLAGS

@yarcowang

This comment has been minimized.

Show comment
Hide comment
@yarcowang

yarcowang Jul 29, 2016

@willianszwy
Yes, finally make it done.

Here are the steps for those who want to compile it under mac.

  1. You should use gcc version of the c++ compiler g++-6 (not the apple one, clang++)
  2. You should change lineno(in makefile) 119 to add -undefined dynamic_lookup config like the document said, so the LINKER_FLAGS becomes:
    LINKER_FLAGS = -shared -undefined dynamic_lookup
  3. You should also change lineno(in makefile) 179 from -soname to install_name, so the that line becomes:
    ${LINKER} ${PHP_LINKER_FLAGS} -Wl,-install_name,libphpcpp.so.$(SONAME) -o $@ ${COMMON_SHARED_OBJECTS} ${PHP_SHARED_OBJECTS}
  4. Finally you run it as CXX=g++-6 make
  5. Done

yarcowang commented Jul 29, 2016

@willianszwy
Yes, finally make it done.

Here are the steps for those who want to compile it under mac.

  1. You should use gcc version of the c++ compiler g++-6 (not the apple one, clang++)
  2. You should change lineno(in makefile) 119 to add -undefined dynamic_lookup config like the document said, so the LINKER_FLAGS becomes:
    LINKER_FLAGS = -shared -undefined dynamic_lookup
  3. You should also change lineno(in makefile) 179 from -soname to install_name, so the that line becomes:
    ${LINKER} ${PHP_LINKER_FLAGS} -Wl,-install_name,libphpcpp.so.$(SONAME) -o $@ ${COMMON_SHARED_OBJECTS} ${PHP_SHARED_OBJECTS}
  4. Finally you run it as CXX=g++-6 make
  5. Done
@yarcowang

This comment has been minimized.

Show comment
Hide comment
@yarcowang

yarcowang Jul 29, 2016

Forgot to say thank you, @willianszwy

yarcowang commented Jul 29, 2016

Forgot to say thank you, @willianszwy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment