rosrunでバイナリの実行ファイルがcannot launch nodeになるときは
devel/lib/(rospackage)/(executable) がちゃんと存在して、実行属性もついてて、絶対パスなら動くのに、
ERROR: cannot launch node of type [(rospackage)/(executable)]: can't locate node [(executable)] in package [(rospackage)]
などとエラーになって動かなかった。
だいたいこういうのはcatkin_makeのあとのsource devel/setup.bashを忘れているのだが、改めてこれを実行しても直らない。
ところであなたはワークスペースをシンボリックリンクにしていないか。
私はこのとき、ゆえあって~/catkin_ws_xxxを~/catkin_wsにシンボリックリンクしていた。
ふと思い立ってシンボリックリンクを削除し、~/catkin_ws_xxxを~/catkin_wsにリネームすると、嘘のようにエラーが消えた。
choreonoid_ros_pluginで、choreonoidとrvizが同期できないときは
AISTSimulator の実時間同期(realtimeSync)がfalseかもしれない。trueに変えてみよう。
Python+GUIでスレッドがらみのエラーがでるときは
PythonのOpenCVでGUIプログラムを作ったらこんなエラーが出る。
QObject::moveToThread: Current thread (0x10005b0) is not the object's thread (0x13fdb10). Cannot move to target thread (0x10005b0)
(カッコ内の16進値は不定と思われる)
Qtスレッドと関係があるようだが、これはどうもUbuntuでpipを使ってopencv-pythonをインストールすると起こるらしい。
$ sudo pip uninstall opencv-python
aptで同等のものを入れ直す。
$ sudo apt install python-opencv
Eigenでエラーが出てコンパイルできないときは
Ubuntu14.04でChoreonoid 1.6を使っているが、何かの拍子に、突然コンパイルが通らなくなって面食らった。
以下、長いうえに意味がさっぱりわからないエラーメッセージである。
/usr/local/include/eigen3/Eigen/src/Core/util/Memory.h: In instantiation of ‘void Eigen::aligned_allocator<T>::construct(Eigen::aligned_allocator<T>::pointer, const T&) [with T = std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u>; Eigen::aligned_allocator<T>::pointer = std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u>*]’: /usr/include/c++/4.8/bits/alloc_traits.h:254:4: required from ‘static typename std::enable_if<std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::value, void>::type std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u>; _Args = {const Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>}; _Alloc = Eigen::aligned_allocator<std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u> >; typename std::enable_if<std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::value, void>::type = void]’ /usr/include/c++/4.8/bits/alloc_traits.h:393:57: required from ‘static decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) std::allocator_traits<_Alloc>::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u>; _Args = {const Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>}; _Alloc = Eigen::aligned_allocator<std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u> >; decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) = <type error>]’ /usr/include/c++/4.8/bits/shared_ptr_base.h:503:37: required from ‘std::__shared_count<_Lp>::__shared_count(std::_Sp_make_shared_tag, _Tp*, const _Alloc&, _Args&& ...) [with _Tp = {anonymous}::TransparentShapeInfo; _Alloc = Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>; _Args = {}; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’ /usr/include/c++/4.8/bits/shared_ptr_base.h:957:35: required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>; _Args = {}; _Tp = {anonymous}::TransparentShapeInfo; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’ /usr/include/c++/4.8/bits/shared_ptr.h:316:64: required from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>; _Args = {}; _Tp = {anonymous}::TransparentShapeInfo]’ /usr/include/c++/4.8/bits/shared_ptr.h:598:39: required from ‘std::shared_ptr<_Tp1> std::allocate_shared(const _Alloc&, _Args&& ...) [with _Tp = {anonymous}::TransparentShapeInfo; _Alloc = Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>; _Args = {}]’ /home/*****/workspace/choreonoid-1.6/src/Util/EigenUtil.h:80:92: required from ‘std::shared_ptr<_Tp1> cnoid::make_shared_aligned(Args&& ...) [with T = {anonymous}::TransparentShapeInfo; Args = {}]’ /home/*****/workspace/choreonoid-1.6/src/Base/GL1SceneRenderer.cpp:1005:98: required from here /usr/local/include/eigen3/Eigen/src/Core/util/Memory.h:733:9: error: use of deleted function ‘std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u>::_Sp_counted_ptr_inplace(const std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u>&)’ ::new( p ) T( value ); ^ In file included from /usr/include/c++/4.8/bits/shared_ptr.h:52:0, from /usr/include/c++/4.8/memory:82, from /home/*****/workspace/choreonoid-1.6/src/Util/SceneDrawables.h:12, from /home/*****/workspace/choreonoid-1.6/include/cnoid/SceneDrawables:1, from /home/*****/workspace/choreonoid-1.6/src/Base/GL1SceneRenderer.cpp:7: /usr/include/c++/4.8/bits/shared_ptr_base.h:379:11: note: ‘std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u>::_Sp_counted_ptr_inplace(const std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u>&)’ is implicitly deleted because the default definition would be ill-formed: class _Sp_counted_ptr_inplace final : public _Sp_counted_base<_Lp> ^ /usr/include/c++/4.8/bits/shared_ptr_base.h:198:7: error: ‘std::_Sp_counted_base<_Lp>::_Sp_counted_base(const std::_Sp_counted_base<_Lp>&) [with __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’ is private _Sp_counted_base(_Sp_counted_base const&) = delete; ^ /usr/include/c++/4.8/bits/shared_ptr_base.h:379:11: error: within this context class _Sp_counted_ptr_inplace final : public _Sp_counted_base<_Lp> ^ /usr/include/c++/4.8/bits/shared_ptr_base.h:379:11: error: use of deleted function ‘std::_Sp_counted_base<_Lp>::_Sp_counted_base(const std::_Sp_counted_base<_Lp>&) [with __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’ /usr/include/c++/4.8/bits/shared_ptr_base.h:198:7: error: declared here _Sp_counted_base(_Sp_counted_base const&) = delete; ^
src/Base/GL1SceneRenderer.cppのコンパイルで発生するエラーだが、何が問題かというとEigenのバージョンが合ってないのである。
いろいろ調べた結果、/usr/local/include にEigen 3.2.8が入っていて、cmakeがこれを引っ張ってきたためにエラーが起きていた。(いつどうして入れたかは忘れたw)
/usr/include にある、Ubuntu14.04がもともと持っているEigen 3.2.0であればコンパイルは通る。
つまり、EIGEN_DIRが/usr/local/include/eigen3になっていたからエラーになるので、これを/usr/include/eigen3に修正すればビルドできる。
今後の修正で、こうしたEigenのバージョン違いによるエラーは起きなくなるということだ。
Ruby1.9.3でpryが動かないときは
Ubuntu 14.04のシステムのRubyが1.9.3で、この上でpryを使っていて引っかかった。
> pry 14:44:58 /var/lib/gems/1.9.1/gems/yard-0.9.9/lib/yard/globals.rb:21:in `log': /var/lib/gems/1.9.1/gems/yard-0.9.9/lib/yard/logging.rb:13: invalid multibyte char (US-ASCII) (SyntaxError) /var/lib/gems/1.9.1/gems/yard-0.9.9/lib/yard/logging.rb:13: invalid multibyte char (US-ASCII) /var/lib/gems/1.9.1/gems/yard-0.9.9/lib/yard/logging.rb:13: syntax error, unexpected $end, expecting keyword_end PROGRESS_INDICATORS = %w(⣷ ⣯ ⣟ ⡿ ⢿ ⣻ ⣽ ⣾) ^ from /var/lib/gems/1.9.1/gems/yard-0.9.9/lib/yard/serializers/yardoc_serializer.rb:104:in `deserialize' from /var/lib/gems/1.9.1/gems/yard-0.9.9/lib/yard/registry_store.rb:295:in `load_root' from /var/lib/gems/1.9.1/gems/yard-0.9.9/lib/yard/registry_store.rb:253:in `load_yardoc' from /var/lib/gems/1.9.1/gems/yard-0.9.9/lib/yard/registry_store.rb:127:in `load' from /var/lib/gems/1.9.1/gems/yard-0.9.9/lib/yard/registry.rb:132:in `load_yardoc' from /var/lib/gems/1.9.1/gems/pry-doc-0.10.0/lib/pry-doc.rb:16:in `load_yardoc' from /var/lib/gems/1.9.1/gems/pry-doc-0.10.0/lib/pry-doc.rb:20:in `<top (required)>' from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require' from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require' from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require' from /var/lib/gems/1.9.1/gems/pry-0.10.4/lib/pry/plugins.rb:49:in `activate!' from /var/lib/gems/1.9.1/gems/pry-0.10.4/lib/pry/plugins.rb:93:in `block in load_plugins' from /var/lib/gems/1.9.1/gems/pry-0.10.4/lib/pry/plugins.rb:92:in `each' from /var/lib/gems/1.9.1/gems/pry-0.10.4/lib/pry/plugins.rb:92:in `load_plugins' from /var/lib/gems/1.9.1/gems/pry-0.10.4/lib/pry/pry_class.rb:127:in `initial_session_setup' from /var/lib/gems/1.9.1/gems/pry-0.10.4/lib/pry/cli.rb:206:in `block in <top (required)>' from /var/lib/gems/1.9.1/gems/pry-0.10.4/lib/pry/cli.rb:83:in `call' from /var/lib/gems/1.9.1/gems/pry-0.10.4/lib/pry/cli.rb:83:in `block in parse_options' from /var/lib/gems/1.9.1/gems/pry-0.10.4/lib/pry/cli.rb:83:in `each' from /var/lib/gems/1.9.1/gems/pry-0.10.4/lib/pry/cli.rb:83:in `parse_options' from /var/lib/gems/1.9.1/gems/pry-0.10.4/bin/pry:16:in `<top (required)>' from /usr/local/bin/pry:23:in `load' from /usr/local/bin/pry:23:in `<main>'
yardでエンコーディングまわりのエラーが出ている。これはしばらくpryを使ったあとでインストールしたpry-docプラグインが連れてきたyardの悪さだった。
> gem uninstall pry-doc yard
とすればpryが復活する。(pry-docは使えないが)
もちろん最新版 Ruby 2.4.1(2017/07/07現在)を使うのが一番いいが、1.9.3でなければならないときもある。
Ubuntu14.04でpclのリンクに失敗するときは
Ubuntu14.04のpclが1.7だったので、gitで最新のソースを落としてきてビルドすると、こんなエラーが出る。
Linking CXX shared library ../lib/libpcl_common.so
/usr/bin/ld: CMakeFiles/pcl_common.dir/src/io.cpp.o: 再配置 R_X86_64_PC32 (シンボル `_Z9fieldCompPKN3pcl13PCLPointFieldES2_' に対する) は共有オブジェクト作成時には使用出来ません。 -fPIC を付けて再コンパイルしてください。
/usr/bin/ld: 最終リンクに失敗しました: 不正な値です
dockerで素のUbuntu環境を用意して同じことをすると、きちんと通る。
しかしdockerからmake installしてもホストマシンにpclをインストールできるわけではない(当たり前だ)。
少し考えて思い出した。以前何かのビルドのためにgccのバージョンをいじっている。
g++ -vで確認すると、はたしてdocker側はgcc 4.8.4, ホスト側はgcc 4.7.3であった。
はてgccのバージョンはどうやって切り替えるのであったか。
$ update-alternative gcc /usr/bin/gcc-4.8
これで無事ビルドが通った。
Rails 4.2で jQuery の $(document).ready が効かないときは
turbo_links を無効にしてみる。
turbo_links の副作用でonloadイベントが発生しないため、JavaScriptコードがさまざまな不具合を起こすのだ。
詳しくはこちら。
Rails 4 で turbolinks をオフにする方法 - Qiita
こちらの記事ではbundle installを実行する前にGemfileを修正しているが、
bundle install済みでもGemfileの「gem "turbolinks"」行を削除すればよさそう。
ついでにbundle cleanを実行すると、不要なGemを削除してくれる。
まあそもそも、$(document).readyが効いてないことがなかなかわからないんだが。