3.6.3 errors with "ld: library not found for -lrt" on OS X

Bug #1614693 reported by Bryan
70
This bug affects 13 people
Affects Status Importance Assigned to Milestone
lxml
Fix Released
High
scoder

Bug Description

https://bugs.launchpad.net/lxml/+bug/1614603 fixed an issue on Linux, but broke OS X.

`pip install lxml==3.6.3` fails with this error:
##
Building wheels for collected packages: lxml
  Running setup.py bdist_wheel for lxml
  Complete output from command /Users/danchenshao/Uber/.pyenvs/foober/bin/python2.7 -c "import setuptools;__file__='/private/var/folders/6z/q0_8zdvj4kj9tr1l31q1mx580000gn/T/pip-build-FmzRyj/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/6z/q0_8zdvj4kj9tr1l31q1mx580000gn/T/tmpAbN1KIpip-wheel-:
  Building lxml version 3.6.3.
  Building without Cython.
  Using build configuration of libxslt 1.1.28
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.10-x86_64-2.7
  creating build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/_elementpath.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/builder.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/cssselect.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/doctestcompare.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/ElementInclude.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/pyclasslookup.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/sax.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/usedoctest.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  creating build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  creating build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/_diffcommand.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/_html5builder.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/_setmixin.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/builder.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/clean.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/defs.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/diff.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/ElementSoup.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/formfill.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/html5parser.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/soupparser.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/usedoctest.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  creating build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron
  copying src/lxml/isoschematron/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron
  copying src/lxml/lxml.etree.h -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/lxml.etree_api.h -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/includes/c14n.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/config.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/dtdvalid.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/etreepublic.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/htmlparser.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/relaxng.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/schematron.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/tree.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/uri.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/xinclude.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/xmlerror.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/xmlparser.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/xmlschema.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/xpath.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/xslt.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/etree_defs.h -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/lxml-version.h -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  creating build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources
  creating build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/rng
  copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/rng
  creating build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl
  copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl
  copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl
  creating build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  running build_ext
  building 'lxml.etree' extension
  creating build/temp.macosx-10.10-x86_64-2.7
  creating build/temp.macosx-10.10-x86_64-2.7/src
  creating build/temp.macosx-10.10-x86_64-2.7/src/lxml
  clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/include/libxml2 -Isrc/lxml/includes -I/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.10-x86_64-2.7/src/lxml/lxml.etree.o -w -flat_namespace
  clang -bundle -undefined dynamic_lookup build/temp.macosx-10.10-x86_64-2.7/src/lxml/lxml.etree.o -lxslt -lexslt -lrt -lxml2 -lz -lm -o build/lib.macosx-10.10-x86_64-2.7/lxml/etree.so
  ld: library not found for -lrt
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  error: command 'clang' failed with exit status 1
  ----------------------------------------
  Failed building wheel for lxml
Failed to build lxml
Installing collected packages: lxml
  Found existing installation: lxml 3.6.1
    Uninstalling lxml-3.6.1:
      Successfully uninstalled lxml-3.6.1
  Running setup.py install for lxml
    Complete output from command /Users/danchenshao/Uber/.pyenvs/foober/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/var/folders/6z/q0_8zdvj4kj9tr1l31q1mx580000gn/T/pip-build-FmzRyj/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/6z/q0_8zdvj4kj9tr1l31q1mx580000gn/T/pip-MneQsb-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/danchenshao/Uber/.pyenvs/foober/bin/../include/site/python2.7/lxml:
    Building lxml version 3.6.3.
    Building without Cython.
    Using build configuration of libxslt 1.1.28
    running install
    running build
    running build_py
    copying src/lxml/includes/lxml-version.h -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    running build_ext
    building 'lxml.etree' extension
    clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/include/libxml2 -Isrc/lxml/includes -I/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.10-x86_64-2.7/src/lxml/lxml.etree.o -w -flat_namespace
    clang -bundle -undefined dynamic_lookup build/temp.macosx-10.10-x86_64-2.7/src/lxml/lxml.etree.o -lxslt -lexslt -lrt -lxml2 -lz -lm -o build/lib.macosx-10.10-x86_64-2.7/lxml/etree.so
    ld: library not found for -lrt
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'clang' failed with exit status 1
    ----------------------------------------
  Rolling back uninstall of lxml
Command "/Users/danchenshao/Uber/.pyenvs/foober/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/var/folders/6z/q0_8zdvj4kj9tr1l31q1mx580000gn/T/pip-build-FmzRyj/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/6z/q0_8zdvj4kj9tr1l31q1mx580000gn/T/pip-MneQsb-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/danchenshao/Uber/.pyenvs/foober/bin/../include/site/python2.7/lxml" failed with error code 1 in /private/var/folders/6z/q0_8zdvj4kj9tr1l31q1mx580000gn/T/pip-build-FmzRyj/lxml
##

From quick googling, it looks like OSX doens't need the "-lrt" flag at all. I found several PRs on other projects that simply removed that flag when compiling on OSX and that fixed it for them

Revision history for this message
causlayer@gmail.com (causlayer) wrote :

The same error message.
os X version :10.11.6
Python version :2.7.10

toriumiy (lithium-1992)
description: updated
Revision history for this message
fargoth (cantfind) wrote :

Also the same error message.

OS X 10.10.5
python versions 3.5.1 and 2.7.11

xcode command line tools are already installed.

Revision history for this message
sy (sy-b) wrote :

I have the same error message.

MacOS 10.12 Beta (16A294a)
Python 2.7.11

XCode command line tools are already installed.

scoder (scoder)
Changed in lxml:
milestone: none → 3.6.4
assignee: nobody → scoder (scoder)
importance: Undecided → High
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.