Comments (15)
I have a newer bison installed with Homebrew but it's not on the PATH
.
I think I've gotten it to use the newer bison by doing:
YACC=/usr/local/Cellar/bison/3.0.3/bin/yacc pip install jq
but then I get a linker error:
...
ld: targeted OS version does not support use of thread local variables in _jv_nomem_handler for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
Complete output from command /Users/marca/python/virtualenvs/jq.py/bin/python -c "import setuptools, tokenize; __file__='/Users/marca/dev/git-repos/jq.py/setup.py'; exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps:
...
from jq.py.
Do you get that error when jq is being built, or the Python bindings? If it's jq, then it's probably best to try to build jq 1.4 separately to see if you get any errors. If you do, then the jq maintainers themselves can probably help more than I can.
from jq.py.
It's when building the Python bindings - let me share more of the output:
...
building 'jq' extension
gcc -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/marca/dev/git-repos/jq.py/jq-jq-1.4 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c jq.c -o build/temp.macosx-10.4-x86_64-2.7/jq.o
jq.c:1242:104: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
((struct __pyx_vtabstruct_2jq__ErrorStore *)__pyx_v_store->__pyx_vtab)->store_error(__pyx_v_store, jv_string_value(__pyx_v_error));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
jq.c:4579:42: warning: function '__Pyx_PyInt_AsSignedLongLong' is not needed and will not be emitted [-Wunneeded-internal-declaration]
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
^
22 warnings generated.
gcc -bundle -undefined dynamic_lookup build/temp.macosx-10.4-x86_64-2.7/jq.o /Users/marca/dev/git-repos/jq.py/jq-jq-1.4/.libs/libjq.a -o /Users/marca/dev/git-repos/jq.py/jq.so
ld: targeted OS version does not support use of thread local variables in _jv_nomem_handler for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
Complete output from command /Users/marca/python/virtualenvs/jq.py/bin/python -c "import setuptools, tokenize; __file__='/Users/marca/dev/git-repos/jq.py/setup.py'; exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps:
...
jq
itself has already built OK:
[marca@marca-mac2 jq.py]$ ll jq-jq-1.4/jq
-rwxr-xr-x+ 1 marca staff 274K Jan 16 19:09 jq-jq-1.4/jq*
[marca@marca-mac2 jq.py]$ file jq-jq-1.4/jq
jq-jq-1.4/jq: Mach-O 64-bit executable x86_64
from jq.py.
Note to self: A nicer way to reproduce this that result in less junky output is:
$ YACC=/usr/local/Cellar/bison/3.0.3/bin/yacc python setup.py build
...
creating build/lib.macosx-10.4-x86_64-2.7
gcc -bundle -undefined dynamic_lookup build/temp.macosx-10.4-x86_64-2.7/jq.o jq-jq-1.4/.libs/libjq.a -o build/lib.macosx-10.4-x86_64-2.7/jq.so
ld: targeted OS version does not support use of thread local variables in _jv_nomem_handler for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
from jq.py.
I wondered if it had to do with the fact that it was using gcc
and recent OS X versions prefer clang
.
$ YACC=/usr/local/Cellar/bison/3.0.3/bin/yacc CC=clang python setup.py build
...
clang -bundle -undefined dynamic_lookup build/temp.macosx-10.4-x86_64-2.7/jq.o jq-jq-1.4/.libs/libjq.a -o build/lib.macosx-10.4-x86_64-2.7/jq.so
ld: targeted OS version does not support use of thread local variables in _jv_nomem_handler for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
No dice.
from jq.py.
Huh? It works when I do the clang
link command manually from the shell; it just doesn't work within python setup.py build
?
[marca@marca-mac2 jq.py]$ clang -bundle -undefined dynamic_lookup build/temp.macosx-10.4-x86_64-2.7/jq.o jq-jq-1.4/.libs/libjq.a -o build/lib.macosx-10.4-x86_64-2.7/jq.so
[marca@marca-mac2 jq.py]$ echo $?
0
[marca@marca-mac2 jq.py]$ ls -l build/lib.macosx-10.4-x86_64-2.7/jq.so
-rwxr-xr-x+ 1 marca staff 304424 Jan 17 09:26 build/lib.macosx-10.4-x86_64-2.7/jq.so*
[marca@marca-mac2 jq.py]$ cp build/lib.macosx-10.4-x86_64-2.7/jq.so .
[marca@marca-mac2 jq.py]$ ipython --no-banner
In [1]: from jq import jq
In [2]: jq(".[]+1").transform([1, 2, 3], multiple_output=True)
Out[2]: [2, 3, 4]
from jq.py.
I wonder if this has something to do with MACOSX_DEPLOYMENT_TARGET
?
from jq.py.
Ooh. The following appears to work:
MACOSX_DEPLOYMENT_TARGET="10.5" YACC=/usr/local/Cellar/bison/3.0.3/bin/yacc CC=clang python setup.py build
Later on, I'll try to formulate this into a PR so that it's automatic. Or failing that I'll send a PR to add a note to the README.
from jq.py.
Thanks for investigating! I'm not at all familiar with building on a Mac: do you know why the default deployment target doesn't work?
from jq.py.
Good question. I'm not too familiar with OS X build stuff easier but I found this in the python-spidermonkey project at http://python-spidermonkey.googlecode.com/svn/trunk/setup.py:
try:
# For some reason, importing Pyrex appears to change the value of
# the MACOSX_DEPLOYMENT_TARGET to something that may be
# inaccurate. So we'll make sure that it's set to whatever it was
# before we imported Pyrex.
oldTarget = os.environ.get("MACOSX_DEPLOYMENT_TARGET", "")
from Pyrex.Distutils import build_ext
os.environ["MACOSX_DEPLOYMENT_TARGET"] = oldTarget
I'll play with this later.
from jq.py.
Docs on MACOSX_DEPLOYMENT_TARGET
from jq.py.
This likely depends on what Python installation one is using and on what version of OS X (as they come with different Python versions in /usr/bin/python
.
For example, on my OS X 10.9.5 system:
[marca@marca-mac2 ~]$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
[marca@marca-mac2 ~]$ /Library/Frameworks/Python.framework/Versions/2.7/bin/python -c 'import sysconfig; print(sysconfig.get_config_var("MACOSX_DEPLOYMENT_TARGET"))'
10.4
[marca@marca-mac2 ~]$ /usr/bin/python -c 'import sysconfig; print(sysconfig.get_config_var("MACOSX_DEPLOYMENT_TARGET"))'
10.9
Some more info on my Python installation; I am not sure if it came like this or I hacked it at some point:
[marca@marca-mac2 ~]$ ag 'MACOSX_DEPLOYMENT_TARGET.*10\.4' /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py
393: 'MACOSX_DEPLOYMENT_TARGET': '10.4',
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/Makefile
139:MACOSX_DEPLOYMENT_TARGET=10.4
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/test/test_sysconfig.py
178: get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = '10.4'
from jq.py.
I upgraded from Python 2.7.6 to Python 2.7.9 and now I have:
[marca@marca-mac2 ~]$ /Library/Frameworks/Python.framework/Versions/2.7/bin/python -c 'import sysconfig; print(sysconfig.get_config_var("MACOSX_DEPLOYMENT_TARGET"))'
10.6
from jq.py.
Thanks for the pull requests! I've merged them in and released version 0.1.2 to PyPI, which should hopefully fix the issues.
from jq.py.
Looks great! Thank you!
❯ workon jq.py
...
❯ pip install jq
Collecting jq
Downloading jq-0.1.2.tar.gz
Installing collected packages: jq
...
22 warnings generated.
/usr/bin/clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g build/temp.macosx-10.6-intel-2.7/jq.o /var/folders/gw/w0clrs515zx9x_55zgtpv4mm0000gp/T/pip-build-RTXOyh/jq/jq-jq-1.4/.libs/libjq.a -o build/lib.macosx-10.6-intel-2.7/jq.so
ld: warning: ignoring file /var/folders/gw/w0clrs515zx9x_55zgtpv4mm0000gp/T/pip-build-RTXOyh/jq/jq-jq-1.4/.libs/libjq.a, file was built for archive which is not the architecture being linked (i386): /var/folders/gw/w0clrs515zx9x_55zgtpv4mm0000gp/T/pip-build-RTXOyh/jq/jq-jq-1.4/.libs/libjq.a
Successfully installed jq-0.1.2
❯ ipython --no-banner
In [1]: from jq import jq
In [2]: jq(".[]+1").transform([1, 2, 3], multiple_output=True)
Out[2]: [2, 3, 4]
Thanks!
from jq.py.
Related Issues (20)
- how can I package this so that it can be reused as Lambda Layer in AWS? HOT 1
- 'OverflowError: cannot convert float infinity to integer' when handling big numbers HOT 3
- walk built-in function does not work HOT 1
- Output values truncated on "null bytes" HOT 2
- Is there a way to output query result without quotes (i.e. "jq -r ") HOT 1
- Error building wheel for jq during "pip install jq" HOT 1
- Cython-3 support HOT 3
- Tests failing with jq-1.7 HOT 1
- Useless `-lonig` when building using system libraries HOT 1
- Behaviour of Out Method first() on JSON Array Output HOT 1
- tox.ini missing in sdist - please add HOT 1
- Variable support
- Module support HOT 1
- Logging support
- ImportError on arm64 (Mac OSX M1) with jq 1.5.0 and 1.6.0 HOT 7
- install error HOT 1
- Specify jq command-line options HOT 2
- Add type hints as a `.pyi` stub file
- json.dumps: ensure_ascii
- Is it possible to input_file? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jq.py.