Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
5
Help us understand the problem. What is going on with this article?
@junkoda

El Capitan では LD_LIBRARY_PATH, DYLD_LIBRARY_PATH が環境変数にならない

More than 5 years have passed since last update.

シェルスクリプトから走らせると自作の共有ライブラリがみつからず四苦八苦。ターミナル(zsh)からは問題ないのに。

% sh test.sh
Library not loaded: libmockgal.so
  Referenced from: /usr/local/lib/python3.5/site-packages/mockgallib/_mockgallib.cpython-35m-darwin.so
  Reason: image not found

原因は El Capitan から LD_LIBRARY_PATH, DYLD_LIBRARY_PATH がセキュリティ強化のため環境変数にできなくなったために、/bin/sh から LD_LIBRARY_PATH が見えないことにあった。

% export LD_LIBRARY_PATH=hoge
% echo $LD_LIBRARY_PATH # 変数はある
hoge
% env | grep LD # LD_LIBRARY_PATH は環境変数にない

ログインシェル(zsh)で作業する分には良いのだけれども、シェルスクリプトでライブラリがみつからないことに。

#!/bin/sh
echo $LD_LIBRARY_PATH # 空っぽ

"System Integrity Protection (SIP)" なるものをがんばって無効にしてもよいけれど [2]、そこまでではない。あきらめて、/usr/local/lib に自作のライブラリへのリンクを作りました。

参考

1: https://github.com/meteor/meteor/issues/5431

2: http://www.macworld.com/article/2986118/security/how-to-modify-system-integrity-protection-in-el-capitan.html

5
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
5
Help us understand the problem. What is going on with this article?