<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>2014/04/22 23:34、Steve Borho <steve <at> <a href="http://borho.org">borho.org</a>> のメール:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Tue, Apr 22, 2014 at 12:36 AM, 宮村 公男 <<a href="mailto:xanadu@apost.plala.or.jp">xanadu <at> apost.plala.or.jp</a>> wrote:<br><blockquote type="cite"><br>2014/04/22 2:07、Derek Buitenhuis <derek.buitenhuis <at> <a href="http://gmail.com">gmail.com</a>> のメール:<br><br>On 4/21/2014 5:37 AM, 宮村 公男 wrote:<br><br>Here’s his comment:<br>“In order to be able to link libx265 to ffmpeg it requires -lstdc++ as a<br>compiler flag yet it does not provide it via pkg-config when ffmpeg asks for<br>the -cflags of libx265. It should add -lstdc++ to its Libs: line of the<br>x265.pc file.”<br><br><br>-lc++ *IS ADDED* if pkg-config is invoked with --static<br>during configure, which is what this configure option does.<br><br>Did you actually even try it? I get the feeling you didn’t.<br><br><br>I do tried to configure ffmpeg by adding "--pkg-config-flags=—static”<br><br>Here’s command line output and config.log of ffmpeg with your replay.<br><br><command line output><br>$ ./configure --prefix=${TARGET} --as=yasm --enable-gpl --enable-libx265<br>--pkg-config-flags=—static<br>Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr<br>--with-gxx-include-dir=/usr/include/c++/4.2.1<br>Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr<br>--with-gxx-include-dir=/usr/include/c++/4.2.1<br>Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr<br>--with-gxx-include-dir=/usr/include/c++/4.2.1<br>Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr<br>--with-gxx-include-dir=/usr/include/c++/4.2.1<br>Package —static was not found in the pkg-config search path.<br>Perhaps you should add the directory containing `—static.pc'<br>to the PKG_CONFIG_PATH environment variable<br>No package '—static' found<br>Package —static was not found in the pkg-config search path.<br>Perhaps you should add the directory containing `—static.pc'<br>to the PKG_CONFIG_PATH environment variable<br>No package '—static' found<br>ERROR: x265 not found<br><br><config.log><br>check_pkg_config x265 x265.h x265_encoder_encode<br>pkg-config --exists --print-errors x265<br>check_func_headers x265.h x265_encoder_encode<br>check_ld cc<br>check_cc<br>BEGIN /var/folders/qk/x9k9r6f955d75dnv5dd2rgm00000gn/T//ffconf.IUpdYOQo.c<br>  1 #include <x265.h><br>  2 long check_x265_encoder_encode(void) { return (long)<br>x265_encoder_encode; }<br>  3 int main(void) { return 0; }<br>END /var/folders/qk/x9k9r6f955d75dnv5dd2rgm00000gn/T//ffconf.IUpdYOQo.c<br>gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC<br>-I/Volumes/ffmpeg_compile/include -L/Volumes/ffmpeg_compile/lib -std=c99<br>-mdynamic-no-pic -fomit-frame-pointer -fPIC -pthread -c -o<br>/var/folders/qk/x9k9r6f955d75dnv5dd2rgm00000gn/T//ffconf.mIIfdUZ5.o<br>/var/folders/qk/x9k9r6f955d75dnv5dd2rgm00000gn/T//ffconf.IUpdYOQo.c<br>clang: warning: argument unused during compilation:<br>'-L/Volumes/ffmpeg_compile/lib'<br>gcc -L/Volumes/ffmpeg_compile/lib -Wl,-dynamic,-search_paths_first -o<br>/var/folders/qk/x9k9r6f955d75dnv5dd2rgm00000gn/T//ffconf.FoLI6JH8<br>/var/folders/qk/x9k9r6f955d75dnv5dd2rgm00000gn/T//ffconf.mIIfdUZ5.o -lm<br>-lbz2 -lz -pthread<br>clang: warning: argument unused during compilation: '-pthread'<br>Undefined symbols for architecture x86_64:<br>"_x265_encoder_encode", referenced from:<br>    _check_x265_encoder_encode in ffconf.mIIfdUZ5.o<br>   (maybe you meant: _check_x265_encoder_encode)<br>ld: symbol(s) not found for architecture x86_64<br>clang: error: linker command failed with exit code 1 (use -v to see<br>invocation)<br>ERROR: x265 not found<br><br><br>Have you read his comment carefully?<br>He say "-lstdc++” compiler flag should be passed to ffmpeg via pkg-config<br>(x265.pc) when ffmpeg asks for the -cflags of x265.  But current x265 does<br>not provide it.<br><br><br>So x265.pc should be as follows:<br>--- a/x265.pc 2014-04-16 14:50:20.000000000 +0900<br>+++ b/x265.pc 2014-04-21 10:54:32.000000000 +0900<br>@@ -6,6 +6,6 @@<br>Name: x265<br>Description: H.265/HEVC video encoder<br>Version: 0.9<br>-Libs: -L${libdir} -lx265<br>+Libs: -L${libdir} -lx265 -lstdc++<br>Libs.private: -lc++<br>-l/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/lib/darwin/libclang_rt.osx.a<br>Cflags: -I${includedir}<br><br><br>Incorrect. You are adding the wrong C++ stdlib. See my<br>explanation above.<br><br><br>I can’t understand what is incorrect.  by addiing "-lstdc++” compiler flag<br>to Libs: line of x265.pc, We can solve this “x265 not found” problem.<br>This must be a bug with x265.<br><br><br>Also, I have problem with x265 shard build:<br>$ export VOLNAME=x265-ffmpeg<br>$ export TARGET="/Volumes/${VOLNAME}"<br>$ export PATH=${TARGET}/bin:$PATH<br><br>$ cd ../x265/build/<br>$ mkdir shard<br>$ cd shard/<br>$ cmake -DCMAKE_INSTALL_PREFIX:PATH=${TARGET} ../../source/<br>$ make -j 4 && make install<br><br>-- Install configuration: "Release"<br>-- Installing: /Volumes/x265-ffmpeg/lib/libx265.a<br>-- Up-to-date: /Volumes/x265-ffmpeg/include/x265.h<br>-- Installing: /Volumes/x265-ffmpeg/include/x265_config.h<br>-- Installing: /Volumes/x265-ffmpeg/lib/libx265.0.0.dylib<br>-- Installing: /Volumes/x265-ffmpeg/lib/libx265.16.dylib<br>-- Installing: /Volumes/x265-ffmpeg/lib/libx265.dylib<br>-- Installing: /Volumes/x265-ffmpeg/lib/pkgconfig/x265.pc<br>-- Installing: /Volumes/x265-ffmpeg/bin/x265<br><br>$ which x265<br>/Volumes/x265-ffmpeg/bin/x265<br><br>$ cd ~<br>$ x265 --help<br>dyld: Library not loaded: libx265.16.dylib<br>Referenced from: /Volumes/x265-ffmpeg/bin/x265<br>Reason: image not found<br>Trace/BPT trap: 5<br><br>Same as x265 binary, ffmpeg binary fails to execute because x265 shard<br>library can’t be loaded.<br>I’d like to know what is happening with x265 shard library too.<br></blockquote><br>what's a shard?<br><br>anyway, if you install into some random folder that is not in the<br>system library load path, then you need to tell cmake to enable RPATH<br>in the executable.  This is roughly documented here:<br><br><a href="http://www.cmake.org/Wiki/CMake_RPATH_handling">http://www.cmake.org/Wiki/CMake_RPATH_handling</a><br><br>I suspect you need to add something line:<br>-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=true to the cmake command line</div></blockquote><br></div><div>The directory “shard" which I created in the build directory is the directory to build shard library type x265.  Not big meaning…</div><div><br></div><div>OK, based on the document which you introduce, I can fix "dyld: Library not loaded: libx265.16.dylib” issue.  Since I use Mac OS X, I have added "export DYLD_LIBRARY_PATH=${TARGET}/lib” then x265 and ffmpeg can execute with shard library.</div><div>I don’t add  "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=true" to the cmake command line.</div><div><br></div><div>Can I ask issue of adding "-lstdc++” flag to x265.pc to you?</div><div><br></div><div>// Miya</div></body></html>