alibaba / PhotonLibOS

Probably the fastest coroutine lib in the world!

Home Page:https://PhotonLibOS.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After 00e13e30a2 it's no longer possible to use libphoton.a

medvednikov opened this issue · comments

Particularly after this change:

00e13e3#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20aL302-R313

For the V language we generate photonwrapper.so using these 2 build commands:

https://github.com/vlang/photonbin/blob/master/build.sh

It used to work fine.

Now we have to do a patch:

https://github.com/vlang/photonbin/blob/master/macos_photonlib_patch.txt

Hopefully this can be fixed. Thanks!

Does it only happen in macOS?

The libphoton.a in the latest release has included all the third-party libs, except libssl and libcurl.

So basically you just need this achieve file alone.

We've only tested on macos so far, will do Linux today.

Please try the latest Photon release, and build a new libphoton.a.

ld: archive member 'libphoton_sole.' not a mach-o file in '/dev/src/cpp/PhotonLibOS/output/libphoton.a'

How did you build photon? Can I see your build command?

By running

/Users/alex/code/3rd/PhotonLibOS $ cmake .
/Users/alex/code/3rd/PhotonLibOS $ make

That generates build/output/libphoton.a

[ 98%] Built target photon_shared
[100%] Linking CXX static library output/libphoton_sole.a
[100%] Built target photon_static
ar: warning: libphoton_sole.a truncated to libphoton_sole.
ar: warning: libfstack_weak.a truncated to libfstack_weak.
[100%] Built target _photon_static_archive
/Users/alex/code/3rd/PhotonLibOS $

and we get the not a mach-o file error when running

c++ -shared -o photonwrapper.so photonwrapper.o \
	-L $PHOTON_REPO_PATH/build/output  \
	$PHOTON_REPO_PATH/build/output/libphoton.a      \
	$OPEN_SSL_PATH/lib/libssl.dylib \
	$OPEN_SSL_PATH/lib/libcrypto.dylib \
	/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/lib/libcurl.tbd   -lpthread  

It seems the ar in macOS is quite different than the one in Linux. Perhaps I need to try the libtool tool

build/output/libphoton.dylib is correct

Hopefully this patch would fix. #195

Yes, it did. Great job!

Thanks.