auditwheel icon indicating copy to clipboard operation
auditwheel copied to clipboard

`LD_LIBRARY_PATH=` and `LD_LIBRARY_PATH=.` do not work

Open abitrolly opened this issue 2 years ago • 2 comments

I am trying to setup cibuildwheel that fails at the repair step given these two files.

# ls -la *.so.2 *whl
-rwxr-xr-x. 1 root root 1965280 Jun 21 11:29 libopendht.so.2
-rw-r--r--. 1 root root 1507129 Jun 20 10:19 opendht-2.4.5-cp36-cp36m-linux_x86_64.whl

Fails with traceback.

  INFO:auditwheel.main_repair:Repairing opendht-2.4.5-cp36-cp36m-linux_x86_64.whl
  Traceback (most recent call last):
    File "/usr/local/bin/auditwheel", line 8, in <module>
      sys.exit(main())
    File "/opt/_internal/pipx/venvs/auditwheel/lib/python3.9/site-packages/auditwheel/main.py", line 59, in main
      rval = args.func(args, p)
    File "/opt/_internal/pipx/venvs/auditwheel/lib/python3.9/site-packages/auditwheel/main_repair.py", line 161, in execute
      out_wheel = repair_wheel(
    File "/opt/_internal/pipx/venvs/auditwheel/lib/python3.9/site-packages/auditwheel/repair.py", line 74, in repair_wheel
      raise ValueError(
  ValueError: Cannot repair wheel, because required library "libopendht.so.2" could not be located

I prepended LD_LIBRARY_PATH=. to the command as instructed in #85, and still got the same message. The command became this.

LD_LIBRARY_PATH=. auditwheel repair -w /tmp/cibuildwheel/repaired_wheel /tmp/cibuildwheel/built_wheel/opendht-2.4.5-cp36-cp36m-linux_x86_64.whl

I tried LD_LIBRARY_PATH= but it didn't work too. https://github.com/abitrolly/opendht/runs/6981236904?check_suite_focus=true Found it strange given this piece of code.

https://github.com/pypa/auditwheel/blob/55bc5ee7de795819fccfd6468129c1041bcb9ac7/src/auditwheel/lddtree.py#L104-L106

LD_LIBRARY_PATH=$PWD works fine. https://github.com/abitrolly/opendht/runs/6987495549?check_suite_focus=true

abitrolly avatar Jun 21 '22 15:06 abitrolly

I see why this is confusing but this happens because the CWD is changed to a tmp dir with only the contents of the input wheel when entering this InWheelCtx context manager in repair.py.

I'm not sure whether this should be changed to use the LD_LIBRARY_PATH entries with respect to the original CWD, or if it should just be documented that LD_LIBRARY_PATH entries need to be absolute paths.

aganders3 avatar Jun 30 '22 17:06 aganders3

@aganders3 the best way is to merge #374 with the explicit --add-path option.

abitrolly avatar Jun 30 '22 18:06 abitrolly