情弱ログ

参考にならないので当てにしないでください

yosemite上のGentoo/Prefixでmedia-libs/libcanberraのemergeがコケる

誰かバグレポート書いて案件その3。
とりあえず

% emerge libcanberra

すると

canberra-gtk-module.c:28:22: error: gdk/gdkx.h: No such file or directory
canberra-gtk-module.c: In function 'window_get_desktop':
canberra-gtk-module.c:303: error: 'Atom' undeclared (first use in this function)
canberra-gtk-module.c:303: error: (Each undeclared identifier is reported only once
canberra-gtk-module.c:303: error: for each function it appears in.)
canberra-gtk-module.c:303: error: expected ';' before 'type_return'
canberra-gtk-module.c:315: warning: implicit declaration of function 'XGetWindowProperty'
canberra-gtk-module.c:315: warning: implicit declaration of function 'GDK_DISPLAY_XDISPLAY'
canberra-gtk-module.c:315: warning: implicit declaration of function 'GDK_WINDOW_XID'
canberra-gtk-module.c:316: warning: implicit declaration of function 'gdk_x11_get_xatom_by_name_for_display'
canberra-gtk-module.c:317: error: 'False' undeclared (first use in this function)
canberra-gtk-module.c:317: error: expected ')' before numeric constant
canberra-gtk-module.c:317: error: 'type_return' undeclared (first use in this function)
canberra-gtk-module.c:319: error: 'Success' undeclared (first use in this function)
canberra-gtk-module.c:322: error: expected ')' before numeric constant
canberra-gtk-module.c:329: error: 'None' undeclared (first use in this function)
canberra-gtk-module.c:330: warning: implicit declaration of function 'XFree'
canberra-gtk-module.c: In function 'display_get_desktop':
canberra-gtk-module.c:336: error: 'Atom' undeclared (first use in this function)
canberra-gtk-module.c:336: error: expected ';' before 'type_return'
canberra-gtk-module.c:348: warning: implicit declaration of function 'DefaultRootWindow'
canberra-gtk-module.c:350: error: 'False' undeclared (first use in this function)
canberra-gtk-module.c:350: error: expected ')' before numeric constant
canberra-gtk-module.c:350: error: 'type_return' undeclared (first use in this function)
canberra-gtk-module.c:352: error: 'Success' undeclared (first use in this function)
canberra-gtk-module.c:355: error: expected ')' before numeric constant
canberra-gtk-module.c:363: error: 'None' undeclared (first use in this function)
canberra-gtk-module.c: In function 'window_is_xembed':
canberra-gtk-module.c:370: error: 'Atom' undeclared (first use in this function)
canberra-gtk-module.c:370: error: expected ';' before 'type_return'
canberra-gtk-module.c:376: error: expected ';' before 'xembed'
canberra-gtk-module.c:386: error: 'xembed' undeclared (first use in this function)
canberra-gtk-module.c:392: error: 'False' undeclared (first use in this function)
canberra-gtk-module.c:392: error: 'type_return' undeclared (first use in this function)
canberra-gtk-module.c:394: error: 'Success' undeclared (first use in this function)
canberra-gtk-module.c:408: error: 'None' undeclared (first use in this function)

こんなエラーが出てくる。
面倒なので(あと昨日の夜に寝ぼけながらやったせいでほとんど覚えてないので)解決方法だけ乗せると

% LDFLAGS="-L/Users/vicco/Gentoo/usr/lib -L/usr/local/lib" CPPFLAGS="-I/Users/vicco/Gentoo/usr/include -I/usr/local/include/gtk-2.0 -I/usr/local/lib/gtk-2.0/include" CC=clang CXX=clang++ ebuild ~/Gentoo/usr/portage/media-libs/libcanberra/libcanberra-0.30-r4.ebuild unpack
% vim ~/Gentoo/var/tmp/portage/media-libs/libcanberra-0.30-r4/work/libcanberra-0.30/configure.ac

で117行目から

CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
        -Wl,--as-needed \
        -Wl,--gc-sections])

の部分をコメントアウト。clangでは--as-neededと--gc-sectionsはunsupported optionとのこと。
あとは

% LDFLAGS="-L/Users/vicco/Gentoo/usr/lib -L/usr/local/lib" CPPFLAGS="-I/Users/vicco/Gentoo/usr/include -I/usr/local/include/gtk-2.0 -I/usr/local/lib/gtk-2.0/include" CC=clang CXX=clang++ ebuild ~/Gentoo/usr/portage/media-libs/libcanberra/libcanberra-0.30-r4.ebuild configure
% LDFLAGS="-L/Users/vicco/Gentoo/usr/lib -L/usr/local/lib" CPPFLAGS="-I/Users/vicco/Gentoo/usr/include -I/usr/local/include/gtk-2.0 -I/usr/local/lib/gtk-2.0/include" CC=clang CXX=clang++ ebuild ~/Gentoo/usr/portage/media-libs/libcanberra/libcanberra-0.30-r4.ebuild compile
% LDFLAGS="-L/Users/vicco/Gentoo/usr/lib -L/usr/local/lib" CPPFLAGS="-I/Users/vicco/Gentoo/usr/include -I/usr/local/include/gtk-2.0 -I/usr/local/lib/gtk-2.0/include" CC=clang CXX=clang++ ebuild ~/Gentoo/usr/portage/media-libs/libcanberra/libcanberra-0.30-r4.ebuild install
% LDFLAGS="-L/Users/vicco/Gentoo/usr/lib -L/usr/local/lib" CPPFLAGS="-I/Users/vicco/Gentoo/usr/include -I/usr/local/include/gtk-2.0 -I/usr/local/lib/gtk-2.0/include" CC=clang CXX=clang++ ebuild ~/Gentoo/usr/portage/media-libs/libcanberra/libcanberra-0.30-r4.ebuild qmerge

(毎回LDFLAGSとか指定する必要は多分無い)
Gentoo/Prefix上のライブラリとbrewで突っ込んだライブラリを使ったせいでとてもカオス。
今後アップデートがあった時にとても面倒くさそう。