Calendar

五月 2012
« 三月    
 123456
78910111213
14151617181920
21222324252627
28293031  

Categories

用 gcc-4.3+ 編 graphics/graphviz 遇到 libgvc.so: undefined reference to `sincos' 錯誤時的解法

錯誤訊息:

gmake[3]: Entering directory `/usr/ports/graphics/graphviz/work/graphviz-2.28.0/cmd/dot'
CC dot-dot.o
CC dot-no_builtins.o
CC dot_builtins-dot.o
CC dot_builtins-dot_builtins.o
CCLD dot_builtins
CCLD dot
../../lib/gvc/.libs/libgvc.so: undefined reference to `sincos'
collect2: ld returned 1 exit status
gmake[3]: *** [dot] Error 1

FreeBSD 的 libm 裡目前還沒有實作 sincos 這個函式。
autoconf 產生出的 configure script 測出來會說有,是因為它的測試參數下得跟實際編譯時不一樣,會用到 GCC 的 built-in function。
這個老外已經有說解法了:
http://markmail.org/thread/okslhtdmwckdweed#query:+page:1+mid:okslhtdmwckdweed+state:results
就是跑完 configure 之後直接把測試結果 edit 掉。
在 FreeBSD 要做這種事很簡單,在 Makefile 的 post-configure 加點料就可以搞定:

--- Makefile.orig       2011-08-28 23:30:48.000000000 +0800
+++ Makefile    2011-08-28 23:30:44.000000000 +0800
@@ -432,6 +432,10 @@
                ${WRKSRC}/Makefile.in
 .endif
 
+post-configure:
+       @${REINPLACE_CMD} -e 's|^#.*HAVE_SINCOS.*$$|#undef HAVE_SINCOS|' \
+               ${WRKSRC}/config.h
+
 post-install: install-ldconfig-file
        cd ${WRKSRC}/lib/expr && \
                ${MAKE} ${INSTALL_TARGET}

編 graphics/graphviz 遇到 'tsrm_ls' undeclared 的解決方法

這個也算是萬年 bug 了,
因為常常有人更新 ports 時會跑來哭,
所以趁這次更新遇到的時候來記錄一下。

Continue reading 編 graphics/graphviz 遇到 'tsrm_ls' undeclared 的解決方法 »