小编Pus*_*dre的帖子

如何查找OSX上的进程加载了哪个共享库?

我试图编译并使用共享的C库作为python模块,并且我观察到这取决于DYLD_LIBRARY_PATH我的代码是否有效,否则它会崩溃并显示一条错误消息。

Jul 24 02:44:44 master 
$ DYLD_LIBRARY_PATH=/opt/local/lib  python -c 'import opengm' 
OKAY

Jul 24 02:45:41 master 
$ DYLD_LIBRARY_PATH= python -c 'import opengm' 
python(86214,0x7fff70ccdcc0) malloc: *** error for object 0x7fff70177500: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap
Run Code Online (Sandbox Code Playgroud)

我曾尝试手动检查哪些库之间的共同/usr/lib/usr/local/lib/opt/local/lib,但我一直没能找到失事的原因。找出问题原因的一种方法是找出dylib两个进程使用哪些文件?我无法弄清楚是否使用了该工具,opensnoop或者dtruss也许我使用了那些工具是错误的。

我如何找出崩溃的原因?

macos shared-libraries dylib dyld osx-snow-leopard

5
推荐指数
1
解决办法
1709
查看次数

Magit无法连接到docker内的emacsclient?

我在docker中运行emacs24.5.1(基本映像是Ubuntu).我通过apt-get安装了emacs.此外,我通过melpa(magit version magit-20170702.858)安装了magit,它很棒.但是,当我尝试提交某些内容时,magit会遇到以下错误:

1 git ? commit -- 
  /usr/bin/emacsclient.emacs24: connect: Connection refused 
  /usr/bin/emacsclient.emacs24: error executing alternate editor 
    "sh -c 'echo "WITH-EDITOR: $$ OPEN $0"; sleep 604800 & sleep=$!; trap "kill $sleep; exit 0" USR1; trap "kill $sleep; exit 1" USR2; wait $sleep'"
error: There was a problem with the editor 
  '/usr/bin/emacsclient.emacs24 --socket-name=/root/.emacs.d/server/server'.
Please supply the message using either -m or -F option.
Run Code Online (Sandbox Code Playgroud)

当我尝试手动启动emacsclient时,emacsclient有错误:

/usr/bin/emacsclient.emacs24 --socket-name=/root/.emacs.d/server/server tmp.make
/usr/bin/emacsclient.emacs24: connect: Connection refused
/usr/bin/emacsclient.emacs24: error accessing socket "/root/.emacs.d/server/server"
Run Code Online (Sandbox Code Playgroud)

这表明它不是一个真正的magit错误,但一个emacsclient错误,真的它可能正在发生,因为我泊坞窗内运行,虽然我不知道这一点.

有没有人知道如何启动emacsclient或绕过magit内部的emacsclient的要求.曾经有一个插件模式绕过内部magit emacsclient,但被弃用,较早前从melpa删除,所以我不是想它太热衷.

UPDATE emacs …

emacsclient magit docker

5
推荐指数
1
解决办法
183
查看次数

如何在不修改用户代码的情况下使使用cProfiler分析的代码超时?

通常在工作期间,我编写代码以从文件中读取行,然后一次处理这些行。

有时,行处理很复杂且文件很长,例如,今天处理200行需要大约一分钟的时间,文件中的总行数为175k。

我想弄清楚我的代码的哪一部分要花很长时间,为此,我决定在Python中使用cProfiler。

问题是我实际上无法运行整个代码,因为这将花费很长时间,并且如果我在退出信号中途中断​​了该过程,那么我的cProfiler也将死掉,而不会生成报告并修改逻辑以使代码在确定的时间内死掉仅读取前K行很烦人(因为我经常在工作中针对不同类型的数据进行此类操作。)我想避免仅出于分析目的而添加选项。

告诉cProfiler运行3分钟,分析发生的情况,停止然后报告其发现,最干净的方法是什么?

python profiling cprofile

4
推荐指数
1
解决办法
515
查看次数

为什么以下代码用`c ++ 03`编译而不用`c ++ 11`编译

boost::python在这个小小的mwe中使用了这个库.

#include <deque>
#include <boost/python.hpp>

typedef std::deque<long unsigned int>  DequeUInt64;

BOOST_PYTHON_MODULE_INIT(tmp) {

boost::python::class_<DequeUInt64>("DequeUInt64")
  .def("push_back"  ,&DequeUInt64::push_back)
  .def("push_front" ,&DequeUInt64::push_front);

} 
Run Code Online (Sandbox Code Playgroud)

我观察到的代码与上面编译std=c++03gnu++03,但不与c++11c++0x.错误是:

tmp.cpp: In function 'void init_module_tmp()':
tmp.cpp:8:47: error: no matching function for call to 'boost::python::class_<std::deque<long unsigned int> >::def(const char [10], <unresolved overloaded function type>)'
     .def("push_back"  ,&DequeUInt64::push_back)
                                               ^
In file included [from /opt/local/include/boost/python.hpp:18:0], [from tmp.cpp:2]:
/opt/local/include/boost/python/class.hpp:223:11: 
   note: candidate: 
       template<class Derived> boost::python::class_<T, X1, X2, X3>::self& 
                               boost::python::class_<T, X1, X2, X3>::def(const boost::python::def_visitor<Derived>&) 
                               [with Derived = Derived; …
Run Code Online (Sandbox Code Playgroud)

c++ boost boost-python c++11

4
推荐指数
2
解决办法
208
查看次数