{"action":"created","issue":{"url":"https://api.github.com/repos/mesonbuild/meson/issues/305","labels_url":"https://api.github.com/repos/mesonbuild/meson/issues/305/labels{/name}","comments_url":"https://api.github.com/repos/mesonbuild/meson/issues/305/comments","events_url":"https://api.github.com/repos/mesonbuild/meson/issues/305/events","html_url":"https://github.com/mesonbuild/meson/issues/305","id":115083982,"number":305,"title":"A little confused","user":{"login":"empirefox","id":5887597,"avatar_url":"https://avatars.githubusercontent.com/u/5887597?v=3","gravatar_id":"","url":"https://api.github.com/users/empirefox","html_url":"https://github.com/empirefox","followers_url":"https://api.github.com/users/empirefox/followers","following_url":"https://api.github.com/users/empirefox/following{/other_user}","gists_url":"https://api.github.com/users/empirefox/gists{/gist_id}","starred_url":"https://api.github.com/users/empirefox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/empirefox/subscriptions","organizations_url":"https://api.github.com/users/empirefox/orgs","repos_url":"https://api.github.com/users/empirefox/repos","events_url":"https://api.github.com/users/empirefox/events{/privacy}","received_events_url":"https://api.github.com/users/empirefox/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-11-04T15:52:52Z","updated_at":"2015-11-05T03:18:23Z","closed_at":null,"body":"I started using meson these days. But i got some problems, when going a little deeper.\r\nHere is my meson.build\r\n```\r\nproject('ffmpeg-wrap', 'c', 'cpp')\r\n#add_global_arguments('-std=gnu++11', language : 'cpp')\r\nadd_global_arguments('-fno-rtti', language : 'cpp')\r\nadd_global_arguments('-O3', language : 'cpp')\r\nadd_global_arguments('-pthread', language : 'cpp')\r\n#add_global_arguments('-Wno-variadic-macros', language : 'c')\r\n\r\ninc = include_directories(\r\n  '/home/savage/git/macro-logger',\r\n  '/home/savage/git/spdlog/include'\r\n)\r\n\r\nsrc = [\r\n'ffmpeg_format.c',\r\n'ffmpeg_log.c',\r\n'ffmpeg_transcoding.c',\r\n'gang_decoder_impl.c',\r\n\r\n'gang_audio_device.cc',\r\n'gang_decoder.cc',\r\n'gang_init_deps.cc',\r\n'gang_spdlog_console.cc',\r\n'gangvideocapturer.cc'\r\n]\r\n\r\njsoncpp = dependency('jsoncpp')\r\navcodec = dependency('libavcodec')\r\navformat = dependency('libavformat')\r\navfilter = dependency('libavfilter')\r\ncrypto = dependency('libcrypto')\r\nopenssl = dependency('openssl')\r\nwebrtc_lib = find_library('webrtc_full', dirs: '/home/savage/soft/webrtc/webrtc-linux64/lib/Debug')\r\nwebrtc_inc = include_directories('/home/savage/git/webrtcbuilds')\r\nwebrtc = declare_dependency(include_directories: webrtc_inc,\r\n                            dependencies: webrtc_lib)\r\n\r\nffwraplib = static_library('ffmpeg-wrap',\r\n                        sources: src,\r\n                        include_directories : inc,\r\n                        dependencies: [avcodec, avformat, avfilter, webrtc, jsoncpp, crypto, openssl],\r\n                        install: true,\r\n                        cpp_args: ['-DLOG_LEVEL=1',\r\n                                   '-DGANG_AV_LOG=0',\r\n                                   '-DENABLE_THREAD_CHECKER=1',\r\n                                   '-DENABLE_DEBUG=0',\r\n                                   '-DSPDLOG_TRACE_OFF',\r\n                                   '-DWEBRTC_POSIX',\r\n                                   '-DSPDLOG_NO_DATETIME'])\r\n\r\nh = install_headers([\r\n'ffmpeg_format.h',\r\n'ffmpeg_log.h',\r\n'ffmpeg_transcoding.h',\r\n'gang_audio_device.h',\r\n'gang_dec.h',\r\n'gang_decoder.h',\r\n'gang_decoder_impl.h',\r\n'gang_init_deps.h',\r\n'gang_spdlog_console.h',\r\n'gangvideocapturer.h'\r\n])\r\n\r\npkgconfig_gen(libraries : ffwraplib,\r\n              subdirs: ['.'],\r\n              version : '1.0',\r\n              name : 'libffmpeg-wrap',\r\n              filebase : 'ffmpeg-wrap',\r\n              description : 'ffmpeg wrap tool')\r\n\r\n#############################\r\n##           failed line\r\n#############################\r\n\r\nffwrap_inc = include_directories(\r\n  '/home/savage/git/webrtcbuilds',\r\n  '/home/savage/git/spdlog/include'\r\n)\r\n\r\nffwrap_links = [\r\n'-L/home/savage/soft/webrtc/webrtc-linux64/lib/Debug', '-lwebrtc_full',\r\n'-pthread', '-lrt', '-ldl'\r\n]\r\n\r\nexecutable('gang_rec_only_test_main',\r\n           'test/gang_rec_only_test_main.cc',\r\n           link_with: ffwraplib,\r\n           link_args: ffwrap_links,\r\n           include_directories: ffwrap_inc,\r\n           cpp_args: ['-DLOG_LEVEL=1',\r\n                      '-DGANG_AV_LOG=0',\r\n                      '-DENABLE_THREAD_CHECKER=1',\r\n                      '-DENABLE_DEBUG=0',\r\n                      '-DSPDLOG_TRACE_OFF',\r\n                      '-DWEBRTC_POSIX',\r\n                      '-DSPDLOG_NO_DATETIME'])\r\n\r\n```\r\n\r\nIt can build static lib successfully, but always failed with `executable`.\r\nHere is the generated build line that always failed:\r\n```\r\n c++    -o gang_rec_only_test_main 'gang_rec_only_test_main@exe/test_gang_rec_only_test_main.cc.o' '-Wl,-O1' 'libffmpeg-wrap.a'  '-L/usr/local/lib' '-L/usr/lib/x86_64-linux-gnu/pulseaudio' '-L/usr/local/lib' '-lavcodec' '-lXv' '-lX11' '-lXext' '-lva' '-lva-x11' '-lva' '-lxcb' '-lXau' '-lXdmcp' '-lxcb-xfixes' '-lxcb-render' '-lxcb-shape' '-lxcb' '-lXau' '-lXdmcp' '-lxcb-shape' '-lxcb' '-lXau' '-lXdmcp' '-lX11' '-lasound' '-lSDL' '-lpthread' '-lm' '-ldl' '-lasound' '-lm' '-ldl' '-lpthread' '-lpulse-simple' '-lpulse' '-lX11' '-lXext' '-lcaca' '-lpthread' '-lxvidcore' '-lx264' '-lpthread' '-lm' '-ldl' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvorbisenc' '-lvorbis' '-logg' '-lspeex' '-lm' '-lpulse' '-lpulsecommon-6.0' '-lopus' '-lm' '-lmp3lame' '-lfreetype' '-lz' '-lpng12' '-lfdk-aac' '-lm' '-lass' '-lm' '-lharfbuzz' '-lfontconfig' '-lexpat' '-lfreetype' '-lexpat' '-lenca' '-lm' '-lfribidi' '-lfreetype' '-lz' '-lpng12' '-lm' '-lz' '-pthread' '-lswresample' '-lm' '-lavutil' '-lm' '-L/usr/local/lib' '-L/usr/lib/x86_64-linux-gnu/pulseaudio' '-L/usr/local/lib' '-L/usr/lib/x86_64-linux-gnu/pulseaudio' '-L/usr/local/lib' '-lavformat' '-lXv' '-lX11' '-lXext' '-lva' '-lva-x11' '-lva' '-lxcb' '-lXau' '-lXdmcp' '-lxcb-xfixes' '-lxcb-render' '-lxcb-shape' '-lxcb' '-lXau' '-lXdmcp' '-lxcb-shape' '-lxcb' '-lXau' '-lXdmcp' '-lX11' '-lasound' '-lSDL' '-lpthread' '-lm' '-ldl' '-lasound' '-lm' '-ldl' '-lpthread' '-lpulse-simple' '-lpulse' '-lX11' '-lXext' '-lcaca' '-lpthread' '-lxvidcore' '-lx264' '-lpthread' '-lm' '-ldl' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvorbisenc' '-lvorbis' '-logg' '-lspeex' '-lm' '-lpulse' '-lpulsecommon-6.0' '-lopus' '-lm' '-lmp3lame' '-lfreetype' '-lz' '-lpng12' '-lfdk-aac' '-lm' '-lass' '-lm' '-lharfbuzz' '-lfontconfig' '-lexpat' '-lfreetype' '-lexpat' '-lenca' '-lm' '-lfribidi' '-lfreetype' '-lz' '-lpng12' '-lm' '-lz' '-pthread' '-lavcodec' '-lXv' '-lX11' '-lXext' '-lva' '-lva-x11' '-lva' '-lxcb' '-lXau' '-lXdmcp' '-lxcb-xfixes' '-lxcb-render' '-lxcb-shape' '-lxcb' '-lXau' '-lXdmcp' '-lxcb-shape' '-lxcb' '-lXau' '-lXdmcp' '-lX11' '-lasound' '-lSDL' '-lpthread' '-lm' '-ldl' '-lasound' '-lm' '-ldl' '-lpthread' '-lpulse-simple' '-lpulse' '-lX11' '-lXext' '-lcaca' '-lpthread' '-lxvidcore' '-lx264' '-lpthread' '-lm' '-ldl' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvorbisenc' '-lvorbis' '-logg' '-lspeex' '-lm' '-lpulse' '-lpulsecommon-6.0' '-lopus' '-lm' '-lmp3lame' '-lfreetype' '-lz' '-lpng12' '-lfdk-aac' '-lm' '-lass' '-lm' '-lharfbuzz' '-lfontconfig' '-lexpat' '-lfreetype' '-lexpat' '-lenca' '-lm' '-lfribidi' '-lfreetype' '-lz' '-lpng12' '-lm' '-lz' '-pthread' '-lswresample' '-lm' '-lavutil' '-lm' '-L/usr/local/lib' '-L/usr/lib/x86_64-linux-gnu/pulseaudio' '-L/usr/local/lib' '-L/usr/lib/x86_64-linux-gnu/pulseaudio' '-L/usr/local/lib' '-L/usr/lib/x86_64-linux-gnu/pulseaudio' '-L/usr/local/lib' '-lavfilter' '-lXv' '-lX11' '-lXext' '-lva' '-lva-x11' '-lva' '-lxcb' '-lXau' '-lXdmcp' '-lxcb-xfixes' '-lxcb-render' '-lxcb-shape' '-lxcb' '-lXau' '-lXdmcp' '-lxcb-shape' '-lxcb' '-lXau' '-lXdmcp' '-lX11' '-lasound' '-lSDL' '-lpthread' '-lm' '-ldl' '-lasound' '-lm' '-ldl' '-lpthread' '-lpulse-simple' '-lpulse' '-lX11' '-lXext' '-lcaca' '-lpthread' '-lxvidcore' '-lx264' '-lpthread' '-lm' '-ldl' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvorbisenc' '-lvorbis' '-logg' '-lspeex' '-lm' '-lpulse' '-lpulsecommon-6.0' '-lopus' '-lm' '-lmp3lame' '-lfreetype' '-lz' '-lpng12' '-lfdk-aac' '-lm' '-lass' '-lm' '-lharfbuzz' '-lfontconfig' '-lexpat' '-lfreetype' '-lexpat' '-lenca' '-lm' '-lfribidi' '-lfreetype' '-lz' '-lpng12' '-lm' '-lz' '-pthread' '-lswscale' '-lm' '-lpostproc' '-lavresample' '-lm' '-lavformat' '-lXv' '-lX11' '-lXext' '-lva' '-lva-x11' '-lva' '-lxcb' '-lXau' '-lXdmcp' '-lxcb-xfixes' '-lxcb-render' '-lxcb-shape' '-lxcb' '-lXau' '-lXdmcp' '-lxcb-shape' '-lxcb' '-lXau' '-lXdmcp' '-lX11' '-lasound' '-lSDL' '-lpthread' '-lm' '-ldl' '-lasound' '-lm' '-ldl' '-lpthread' '-lpulse-simple' '-lpulse' '-lX11' '-lXext' '-lcaca' '-lpthread' '-lxvidcore' '-lx264' '-lpthread' '-lm' '-ldl' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvorbisenc' '-lvorbis' '-logg' '-lspeex' '-lm' '-lpulse' '-lpulsecommon-6.0' '-lopus' '-lm' '-lmp3lame' '-lfreetype' '-lz' '-lpng12' '-lfdk-aac' '-lm' '-lass' '-lm' '-lharfbuzz' '-lfontconfig' '-lexpat' '-lfreetype' '-lexpat' '-lenca' '-lm' '-lfribidi' '-lfreetype' '-lz' '-lpng12' '-lm' '-lz' '-pthread' '-lavcodec' '-lXv' '-lX11' '-lXext' '-lva' '-lva-x11' '-lva' '-lxcb' '-lXau' '-lXdmcp' '-lxcb-xfixes' '-lxcb-render' '-lxcb-shape' '-lxcb' '-lXau' '-lXdmcp' '-lxcb-shape' '-lxcb' '-lXau' '-lXdmcp' '-lX11' '-lasound' '-lSDL' '-lpthread' '-lm' '-ldl' '-lasound' '-lm' '-ldl' '-lpthread' '-lpulse-simple' '-lpulse' '-lX11' '-lXext' '-lcaca' '-lpthread' '-lxvidcore' '-lx264' '-lpthread' '-lm' '-ldl' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvpx' '-lm' '-lpthread' '-lvorbisenc' '-lvorbis' '-logg' '-lspeex' '-lm' '-lpulse' '-lpulsecommon-6.0' '-lopus' '-lm' '-lmp3lame' '-lfreetype' '-lz' '-lpng12' '-lfdk-aac' '-lm' '-lass' '-lm' '-lharfbuzz' '-lfontconfig' '-lexpat' '-lfreetype' '-lexpat' '-lenca' '-lm' '-lfribidi' '-lfreetype' '-lz' '-lpng12' '-lm' '-lz' '-pthread' '-lswresample' '-lm' '-lavutil' '-lm' '-ljsoncpp' '-lcrypto' '-lssl' '-lcrypto' '-L/home/savage/soft/webrtc/webrtc-linux64/lib/Debug' '-lwebrtc_full' '-pthread' '-lrt' '-ldl'\r\n```\r\nThe error info:\r\n```\r\nlibffmpeg-wrap.a(gang_decoder.cc.o):(.rodata._ZTVN4gang11GangDecoder10GangThreadE[_ZTVN4gang11GangDecoder10GangThreadE]+0x60): undefined reference to `rtc::Thread::Clear(rtc::MessageHandler*, unsigned int, std::__cxx11::list<rtc::Message, std::allocator<rtc::Message> >*)'\r\n```\r\n\r\nBut I can build the test executable with this line:\r\n```\r\nc++ -o gang_rec_only_test_main './test/gang_rec_only_test_main.cc' -c -fmessage-length=0 -fno-rtti -std=c++11 -DWEBRTC_POSIX -DGANG_AV_LOG=0 -DSPDLOG_NO_DATETIME -DLOG_LEVEL=0 -I/home/savage/git/webrtcbuilds -I/home/savage/git/spdlog/include -I. `pkg-config --cflags --libs libavcodec libavformat libavfilter libssl` '-L/home/savage/soft/webrtc/webrtc-linux64/lib/Debug' -L/home/savage/git/ffmpeg-wrap/Release -lffmpeg-wrap '-lwebrtc_full' '-pthread' '-lrt' '-ldl'\r\n```\r\n\r\nI don't know how to make it build ok using meson."},"comment":{"url":"https://api.github.com/repos/mesonbuild/meson/issues/comments/153942802","html_url":"https://github.com/mesonbuild/meson/issues/305#issuecomment-153942802","issue_url":"https://api.github.com/repos/mesonbuild/meson/issues/305","id":153942802,"user":{"login":"empirefox","id":5887597,"avatar_url":"https://avatars.githubusercontent.com/u/5887597?v=3","gravatar_id":"","url":"https://api.github.com/users/empirefox","html_url":"https://github.com/empirefox","followers_url":"https://api.github.com/users/empirefox/followers","following_url":"https://api.github.com/users/empirefox/following{/other_user}","gists_url":"https://api.github.com/users/empirefox/gists{/gist_id}","starred_url":"https://api.github.com/users/empirefox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/empirefox/subscriptions","organizations_url":"https://api.github.com/users/empirefox/orgs","repos_url":"https://api.github.com/users/empirefox/repos","events_url":"https://api.github.com/users/empirefox/events{/privacy}","received_events_url":"https://api.github.com/users/empirefox/received_events","type":"User","site_admin":false},"created_at":"2015-11-05T03:18:23Z","updated_at":"2015-11-05T03:18:23Z","body":"Thanks for your answers, jpakkane.\r\nI finnally resolved it by adding '-D_GLIBCXX_USE_CXX11_ABI=0', following this gcc [article](https://gcc.gnu.org/gcc-5/changes.html) .\r\nBut I still have no idea about why the manual compile command can make it without  '-D_GLIBCXX_USE_CXX11_ABI=0'."}}