Launchpad

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_8zdvj4kj9 tr1l31q1mx58000 0gn/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_8zdvj4kj9 tr1l31q1mx58000 0gn/T/tmpAbN1KI pip-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/_diffcomma nd.py -> build/lib. macosx- 10.10-x86_ 64-2.7/ lxml/html
  copying src/lxml/ html/_html5buil der.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/ElementSou p.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/html5parse r.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/isoschemat ron
  copying src/lxml/ isoschematron/ __init_ _.py -> build/lib. macosx- 10.10-x86_ 64-2.7/ lxml/isoschemat ron
  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/isoschemat ron/resources
  creating build/lib. macosx- 10.10-x86_ 64-2.7/ lxml/isoschemat ron/resources/ rng
  copying src/lxml/ isoschematron/ resources/ rng/iso- schematron. rng -> build/lib. macosx- 10.10-x86_ 64-2.7/ lxml/isoschemat ron/resources/ rng
  creating build/lib. macosx- 10.10-x86_ 64-2.7/ lxml/isoschemat ron/resources/ xsl
  copying src/lxml/ isoschematron/ resources/ xsl/RNG2Schtrn. xsl -> build/lib. macosx- 10.10-x86_ 64-2.7/ lxml/isoschemat ron/resources/ xsl
  copying src/lxml/ isoschematron/ resources/ xsl/XSD2Schtrn. xsl -> build/lib. macosx- 10.10-x86_ 64-2.7/ lxml/isoschemat ron/resources/ xsl
  creating build/lib. macosx- 10.10-x86_ 64-2.7/ lxml/isoschemat ron/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/isoschemat ron/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/isoschemat ron/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/isoschemat ron/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/isoschemat ron/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/isoschemat ron/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/isoschemat ron/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_8zdvj4kj9 tr1l31q1mx58000 0gn/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_8zdvj4kj9 tr1l31q1mx58000 0gn/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_8zdvj4kj9 tr1l31q1mx58000 0gn/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_8zdvj4kj9 tr1l31q1mx58000 0gn/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_8zdvj4kj9 tr1l31q1mx58000 0gn/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

Read the original on bugs.launchpad.net ↗