LoginSignup
2
1

More than 3 years have passed since last update.

macOS X Catalina上のMacPorts(2.6.2)でossp-uuidがコンパイルできない

Last updated at Posted at 2019-12-02

そもそもみんなMacPortsは使ってないだろうし…

多分これはMacPortsの開発者グループも気がついていて、すぐに修正される不具合なのかもしれませんが、macOSをMojaveからCatalinaへとアップデートしたらMacPortsのアップグレードでエラーになってしまったので、とりあえずの対処方法です。

具体的にはossp-uuid-1.6.2_11+perl5_26.darwin_19.x86_64をコンパイルしようとした際に以下の様なエラーが発生しました。

--->  Computing dependencies for gobject-introspection
--->  Dependencies to be installed: cairo fontconfig ossp-uuid
--->  Fetching archive for ossp-uuid
--->  Attempting to fetch ossp-uuid-1.6.2_11+perl5_26.darwin_19.x86_64.tbz2 from http://kmq.jp.packages.macports.org/ossp-uuid
--->  Attempting to fetch ossp-uuid-1.6.2_11+perl5_26.darwin_19.x86_64.tbz2 from https://pek.cn.packages.macports.org/macports/packages/ossp-uuid
--->  Attempting to fetch ossp-uuid-1.6.2_11+perl5_26.darwin_19.x86_64.tbz2 from https://packages.macports.org/ossp-uuid
--->  Building ossp-uuid
Error: Failed to build ossp-uuid: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ossp-uuid/ossp-uuid/main.log for details.

で、「ログを確認しろ」と書かれていたのでログファイルを確認したところsysrootの設定に問題があるようで、sysrootに存在しないディレクトリが指定されていてヘッダーファイルsys/types.hが見つからないと言われています。

/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_ossp-uuid/ossp-uuid/main.log
:info:build clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk' [-Wmissing-sysroot]
:info:build chmod 644 "uuid.bs"
:info:build In file included from uuid.xs:30:
:info:build ../uuid.h:39:10: fatal error: 'sys/types.h' file not found
:info:build #include <sys/types.h>
:info:build          ^~~~~~~~~~~~~

それもそのはずで、sysrootには/Library/Developer/CommandLineTools/SDKs以下のSDKロケーションが指定されていますが、これはXcode 11をmacOS X Catalinaにインストールした場合は存在していません。(Appleの公式ドキュメントによれば存在することにはなっているのですが…)

そんな訳でとりあえずは存在しないディレクトリに正しいディレクトリのシンボリックリンクを作ってその場しのぎです。
多分、正しくはossp-uuidをビルドする際にスクリプト(Makefile?)がインクルードファイルのパスを設定する際にちゃんとxcrun --show-sdk-pathが返すロケーションを使ってくれれば済む話なのですが。

sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs /Library/Developer/CommandLineTools/
2
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1