build the lib on Mac #53

Closed
opened 2026-01-29 20:30:10 +00:00 by claunia · 7 comments
Owner

Originally created by @shawncao-zz on GitHub (Oct 8, 2015).

Hi.
I'm trying to build the lib using "python setup.py build" and I can see lib is placed at "build/lib.macosx-10.10-intel-2.7/brotli.so", however, I think .so file is not usable in MacOS, I expect to see a .dylib file, is this a problem? how to solve it please?

Thanks a lot!

Originally created by @shawncao-zz on GitHub (Oct 8, 2015). Hi. I'm trying to build the lib using "python setup.py build" and I can see lib is placed at "build/lib.macosx-10.10-intel-2.7/brotli.so", however, I think .so file is not usable in MacOS, I expect to see a .dylib file, is this a problem? how to solve it please? Thanks a lot!
Author
Owner

@anthrotype commented on GitHub (Oct 8, 2015):

Yes, .so is the correct extension for Python extension modules on OS X. On "win32" the extension would be .pyd.
distutils gets it from sysconfig:

import sysconfig
print(sysconfig.get_config_var('SO'))
@anthrotype commented on GitHub (Oct 8, 2015): Yes, `.so` is the correct extension for Python extension modules on OS X. On "win32" the extension would be `.pyd`. distutils gets it from sysconfig: ``` python import sysconfig print(sysconfig.get_config_var('SO')) ```
Author
Owner

@anthrotype commented on GitHub (Oct 8, 2015):

Of course the setup.py script is only meant to build and install the Python bindings. If you are looking to build a shared library to link with other non-Python code, that's not the one to use.
In that case you can try https://github.com/bagder/libbrotli

@anthrotype commented on GitHub (Oct 8, 2015): Of course the setup.py script is only meant to build and install the Python bindings. If you are looking to build a shared library to link with other non-Python code, that's not the one to use. In that case you can try https://github.com/bagder/libbrotli
Author
Owner

@shawncao-zz commented on GitHub (Oct 8, 2015):

Thanks @anthrotype , however, this .so file is working for me when I load it in Java via JNI interface (on Mac laptop). I was a little surprised, but it's working fine to compress my java bytes in memory. According to this, I guess this brotli.so is a "shared library". Anything misunderstood here... ?

@shawncao-zz commented on GitHub (Oct 8, 2015): Thanks @anthrotype , however, this .so file is working for me when I load it in Java via JNI interface (on Mac laptop). I was a little surprised, but it's working fine to compress my java bytes in memory. According to this, I guess this brotli.so is a "shared library". Anything misunderstood here... ?
Author
Owner

@anthrotype commented on GitHub (Oct 8, 2015):

I am surprised it works.. Though that's not the intended purpose of a Python extension module. I'm sure others more knowledgeable of C/C++ or Java than me could suggest a better approach for what you're trying to do.

@anthrotype commented on GitHub (Oct 8, 2015): I am surprised it works.. Though that's not the intended purpose of a Python extension module. I'm sure others more knowledgeable of C/C++ or Java than me could suggest a better approach for what you're trying to do.
Author
Owner

@eustas commented on GitHub (Nov 6, 2015):

According to the StackOverflow .so and .dylib are almost interchangable in modern versions on OSX.

@eustas commented on GitHub (Nov 6, 2015): According to the [StackOverflow](http://stackoverflow.com/questions/2339679/what-are-the-differences-between-so-and-dylib-on-osx) .so and .dylib are almost interchangable in modern versions on OSX.
Author
Owner

@nitram509 commented on GitHub (Nov 15, 2015):

@shawncao
You got brotli.so compiled under Mac OSX and running it in Java? Cool.
How do you managed to use the .so file from Java?
Would you please provide some sources (e.g. via Github ghist)?

@nitram509 commented on GitHub (Nov 15, 2015): @shawncao You got brotli.so compiled under Mac OSX and running it in Java? Cool. How do you managed to use the .so file from Java? Would you please provide some sources (e.g. via Github ghist)?
Author
Owner

@eustas commented on GitHub (Jun 20, 2016):

Soon it will be possible to compile dylib with xcode: see PR #382

@eustas commented on GitHub (Jun 20, 2016): Soon it will be possible to compile dylib with xcode: see PR #382
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#53