2013-02-14 72 views
1

我想編譯一個庫,liblo。我正在安裝它,因爲它是我正在嘗試安裝的另一個庫的必需庫,osc-mex。爲了在Windows上使用libloosc-mex一起工作,我需要使用「pthreads commented out」編譯liblo「註釋掉pthreads」來編譯庫

據我所知,pthread是一個用於Unix的協議嗎?無論如何,我需要刪除pthread中的liblo代碼。但是我遇到了一個問題;有'pthread'提到的代碼的多個區域。搜索的(未編譯)來源liblo目錄文本「並行線程」產量25個結果在八檔:

Filename Line # Line text 
********************************************************************************* 
ChangeLog 165  * Fixed pthread resource leak, when stopping thread 
NEWS  153  * Fixed pthread resource leak, when stopping server 
config.h.in 18  /* Define to 1 if you have the `pthread' library (-lpthread). */ 
config.h.in 19  #undef HAVE_LIBPTHREAD 
configure 11000 { echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 
configure 11001 echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6; } 
configure 11002 if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then 
configure 11006 LIBS="-lpthread $LIBS" 
configure 11020 char pthread_create(); 
configure 11024 return pthread_create(); 
configure 11047 ac_cv_lib_pthread_pthread_create=yes 
configure 11052 ac_cv_lib_pthread_pthread_create=no 
configure 11059 { echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5 
configure 11060 echo "${ECHO_T}$ac_cv_lib_pthread_pthread_create" >&6; } 
configure 11061 if test $ac_cv_lib_pthread_pthread_create = yes; then 
configure 11063 #define HAVE_LIBPTHREAD 1 
configure 11066 LIBS="-lpthread $LIBS" 
configure.ac43  AC_CHECK_LIB([pthread], [pthread_create]) 
liblo.pc.in 9  Libs: -L${libdir} -llo -lpthread 
libtool  4511 # Do not include libc_r directly, use -pthread flag. 
libtool  4536 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 
libtool  5030 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 
ltmain.sh 4027 # Do not include libc_r directly, use -pthread flag. 
ltmain.sh 4052 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 
ltmain.sh 4546 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 

顯然,上述的一些線路已經評價,但也有線路在這裏這可以通過許多不同的方式進行修改以實現相同的目標。 「註釋pthreads」的指令是我不完全理解或知道如何實現的。任何意見,將不勝感激。

+0

我假設你在Windows上也使用configure腳本;如果是這樣,'./configure --help'是否提供禁用pthread的選項? – 2013-02-14 11:32:50

+0

請問您可以添加一個腳註,說這個問題與[this one](http://stackoverflow.com/questions/14853603/unable-to-compile-mex)和[this one](http:// stackoverflow .COM /問題/ 14789656 /鏈接與Matlab至A-DLL庫)? – Shai 2013-02-14 11:52:37

+1

有一個與Windows兼容的pthreads版本。如果你已經安裝了,那麼你不需要重新配置liblo來不使用它。 – Neil 2013-02-14 13:14:02

回答

3

osc-mex的鏈接指令指的是幾年前的liblo版本。目前git version of liblo應該在沒有變化的情況下在Windows(帶有MingW)上編譯。 pthread現在是可選的。它會檢測pthread是否可用,如果不是,則會「爲其註釋」。

0

config.h.in文件中的行18和19似乎具有指示存在/不存在pthread庫的常量HAVE_LIBPTHREAD

您是否試圖編譯代碼HAVE_LIBPTHREAD而不是定義?

+0

謝謝Shai。我已經評論這一點,並嘗試再次編譯。問題是,我不知道這是否有效 - 我遇到的最初問題是在MATLAB中編譯osc-mex。即使您的解決方案已經實施,這仍然會失敗,我不知道這是由於liblo未被正確編譯,還是由於其他問題。這證明是非常困難的! – CaptainProg 2013-02-14 15:27:33

+0

@CaptainProg - 你通過這個過程學到了很多東西,所以要堅強! (1)請驗證您是否具有從liblo正確編譯的lib或dll庫。您可能需要使用[依賴walker](http://www.dependencywalker.com/)來檢查庫文件。 (2)在matlab中,嘗試使用'-v'編譯(mexing)以獲得詳細信息。看看有什麼問題。 – Shai 2013-02-14 15:52:38