Opened 4 years ago
Last modified 2 years ago
#60722 new defect
DYLD_LIBRARY_PATH doesn't work in <command>.env
Reported by: | ryandesign (Ryan Carsten Schmidt) | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | base | Version: | 2.6.99 |
Keywords: | Cc: | ||
Port: |
Description
I had to implement the test phase of the espeak portfile like this:
test.cmd DYLD_LIBRARY_PATH=${build.dir} \ ESPEAK_DATA_PATH=${worksrcpath} \ ./espeak
I originally tried this:
test.cmd ./espeak test.env DYLD_LIBRARY_PATH=${build.dir} \ ESPEAK_DATA_PATH=${worksrcpath}
But this didn't work. The environment variables didn't get passed to the espeak binary. I think that's a bug in base.
Change History (4)
comment:1 Changed 4 years ago by jmroot (Joshua Root)
comment:2 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)
Ok, but it doesn't work in the espeak portfile.
test.env DYLD_LIBRARY_PATH=${build.dir} \ ESPEAK_DATA_PATH=${worksrcpath} test.cmd ./espeak
results in:
---> Testing espeak DEBUG: Executing org.macports.test (espeak) DEBUG: Environment: CC='/usr/bin/clang' CC_PRINT_OPTIONS='YES' CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk_audio_espeak/espeak/work/.CC_PRINT_OPTIONS' CFLAGS='-Os -arch x86_64 -arch x86_64 -arch x86_64' CPATH='/opt/local/include' CPPFLAGS='-I/opt/local/include' CXX='/usr/bin/clang++' CXXFLAGS='-Os -std=c++98 -arch x86_64 -arch x86_64 -arch x86_64 -stdlib=libc++' DEVELOPER_DIR='/Library/Developer/CommandLineTools' DYLD_LIBRARY_PATH='/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk_audio_espeak/espeak/work/espeak-1.48.04-source/src' ESPEAK_DATA_PATH='/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk_audio_espeak/espeak/work/espeak-1.48.04-source' F90FLAGS='-Os -m64 -m64 -m64' FCFLAGS='-Os -m64 -m64 -m64' FFLAGS='-Os -m64 -m64 -m64' INSTALL='/usr/bin/install -c' LDFLAGS='-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -arch x86_64 -arch x86_64' LIBRARY_PATH='/opt/local/lib' MACOSX_DEPLOYMENT_TARGET='10.13' OBJC='/usr/bin/clang' OBJCFLAGS='-Os -arch x86_64 -arch x86_64 -arch x86_64' OBJCXX='/usr/bin/clang++' OBJCXXFLAGS='-Os -std=c++98 -arch x86_64 -arch x86_64 -arch x86_64 -arch x86_64 -stdlib=libc++' PREFIX='/opt/local' Executing: cd "/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk_audio_espeak/espeak/work/espeak-1.48.04-source/src" && ./espeak Testing. -w out.wav PREFIX=/opt/local DEBUG: system: cd "/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk_audio_espeak/espeak/work/espeak-1.48.04-source/src" && ./espeak Testing. -w out.wav PREFIX=/opt/local dyld: Library not loaded: /opt/local/lib/libespeak.dylib Referenced from: /opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk_audio_espeak/espeak/work/espeak-1.48.04-source/src/./espeak Reason: image not found sh: line 1: 23340 Abort trap: 6 ./espeak Testing. -w out.wav PREFIX=/opt/local
whereas the way it's written in the Portfile now:
test.cmd DYLD_LIBRARY_PATH=${build.dir} \ ESPEAK_DATA_PATH=${worksrcpath} \ ./espeak
results in:
---> Testing espeak DEBUG: Executing org.macports.test (espeak) DEBUG: Environment: CC='/usr/bin/clang' CC_PRINT_OPTIONS='YES' CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk_audio_espeak/espeak/work/.CC_PRINT_OPTIONS' CFLAGS='-Os -arch x86_64 -arch x86_64 -arch x86_64' CPATH='/opt/local/include' CPPFLAGS='-I/opt/local/include' CXX='/usr/bin/clang++' CXXFLAGS='-Os -std=c++98 -arch x86_64 -arch x86_64 -arch x86_64 -stdlib=libc++' DEVELOPER_DIR='/Library/Developer/CommandLineTools' F90FLAGS='-Os -m64 -m64 -m64' FCFLAGS='-Os -m64 -m64 -m64' FFLAGS='-Os -m64 -m64 -m64' INSTALL='/usr/bin/install -c' LDFLAGS='-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -arch x86_64 -arch x86_64' LIBRARY_PATH='/opt/local/lib' MACOSX_DEPLOYMENT_TARGET='10.13' OBJC='/usr/bin/clang' OBJCFLAGS='-Os -arch x86_64 -arch x86_64 -arch x86_64' OBJCXX='/usr/bin/clang++' OBJCXXFLAGS='-Os -std=c++98 -arch x86_64 -arch x86_64 -arch x86_64 -arch x86_64 -stdlib=libc++' PREFIX='/opt/local' Executing: cd "/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk_audio_espeak/espeak/work/espeak-1.48.04-source/src" && DYLD_LIBRARY_PATH=/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk_audio_espeak/espeak/work/espeak-1.48.04-source/src ESPEAK_DATA_PATH=/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk_audio_espeak/espeak/work/espeak-1.48.04-source ./espeak Testing. -w out.wav PREFIX=/opt/local DEBUG: system: cd "/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk_audio_espeak/espeak/work/espeak-1.48.04-source/src" && DYLD_LIBRARY_PATH=/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk_audio_espeak/espeak/work/espeak-1.48.04-source/src ESPEAK_DATA_PATH=/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk_audio_espeak/espeak/work/espeak-1.48.04-source ./espeak Testing. -w out.wav PREFIX=/opt/local
comment:3 Changed 2 years ago by jmroot (Joshua Root)
Summary: | test.env doesn't work → DYLD_LIBRARY_PATH doesn't work in <command>.env |
---|
Again, base is setting the environment variable correctly, it's SIP that is removing it (command_exec uses system which uses /bin/sh). The only way to avoid that would be to never run things via OS-provided executables.
comment:4 Changed 2 years ago by danielluke (Daniel J. Luke)
Or use trace mode (since it copies binaries to work around SIP already).
Note: See
TracTickets for help on using
tickets.
Works fine here. Portfile like this:
Results in output which includes:
(If you test like this with your variables, be aware that /usr/bin/env is a SIP-protected binary and will not see any DYLD_* environment variables. Yes that's pretty terrible.)