Retrieved from:
http://bbs.iresty.com/topic/25/%E5%BD%93%E5%AE%89%E8%A3%85%E4%BA%86libiconv%E7%8E%AF%E5%A2 %83%E4%B8%8B%E5%AE%89%E8%A3%85lua-iconv-%E4%BC%9A%E5%87%BA%E7%8E%B0%E6%8A%A5%E9% 94%99-usr-local-lib-lua-5-1-iconv-so-undefined-symbol-libiconv
When installing lua-iconv in the libiconv environment, an error will appear /usr/local/lib/lua/5.1/iconv .so: undefined symbol: libiconv
Wang Wang Haibo 29 days ago
When libiconv is installed first, there will be an error
/usr/local/lib/lua/5.1/iconv.so: undefined symbol: libiconv
stack traceback:
[C]: at 0x0044dfb0
[ C]: in function 'require'
stdin:1: in main chunk
[C]: at 0x004045d0
Simple processing method:
mv /usr/local/include/iconv.h ~/
luarocks install lua-iconv and then restore
process :
reference
http://www.cnblogs.com/lightsong/p/4634642.html
https://github.com/ittner/lua-iconv/issues/3
https://groups.google.com/forum/#!msg/ openresty/blNGlzAl2ik/QuJBXtzLx9gJ
After
verification (inspired by this article http://tonybai.com/2013/04/25/a-libiconv-linkage-problem/), it
is analyzed that the libiconv library is installed first, resulting in the iconv of this library Copy .h to usr/local/include/iconv.h
and then compile the luaiconv project. When compiling the iconv.c file, gcc first finds the file usr/local/include/iconv.h, and the function declaration inside the file shall prevail , compiling iconv.so
should actually be based on the iconv.h provided by the system. This file is in the /usr/include/iconv.h
header file gcc search order:
:~/share_windows/openSource/lua/lua-iconv- lua-iconv-5$ ld -verbose | grep SEARCH
SEARCH_DIR("=/usr/i686-linux-gnu/lib32"); SEARCH_DIR("=/usr/local/lib32"); SEARCH_DIR("=/lib32"); SEARCH_DIR("=/usr/lib32"); SEARCH_DIR("=/usr/i686-linux-gnu/lib"); SEARCH_DIR("=/usr/local/lib/i386-linux-gnu"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib/i386-linux-gnu"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib/i386-linux-gnu"); SEARCH_DIR("=/usr/lib");
libiconv-------usr/local/include/iconv.h
#ifndef LIBICONV_PLUG
#define iconv_open libiconv_open
#endif
extern LIBICONV_DLL_EXPORTED iconv_t iconv_open (const char* tocode, const char* fromcode);
libiconv -- iconv.The definition of libiconv_open in c receives macro control, it should not be opened, or the libiconv library is not linked when compiling luaiconv
#if defined FreeBSD && !defined gnu_freebsd
/* GNU libiconv is the native FreeBSD iconv implementation since 2002.
It wants to define the symbols 'iconv_open', 'iconv', 'iconv_close'. */
#define strong_alias(name, aliasname) _strong_alias(name, aliasname)
#define _strong_alias (name, aliasname)
extern __typeof (name) aliasname attribute ((alias (#name)));
#undef iconv_open
#undef iconv
#undef iconv_close
strong_alias (libiconv_open, iconv_open)
strong_alias (libiconv, iconv)
strong_alias (libiconv_close, iconv_close)
# Endif
solution: Modify the reference method of iconv.h in the implementation file, change the standard method to custom, and write it as the full path /usr/include/iconv.h
and then make && make install again, run ok
vim luaiconv .c
#include <lua.h>
#include <lauxlib.h>
#include <stdlib.h>
#include "/usr/include/iconv.h"
#include <errno.h>
花下眠工作室:
http://huaxiamian.cc
When installing lua-iconv in the libiconv environment, an error will appear /usr/local/lib/lua/5.1/iconv.so: undefined symb
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326850219&siteId=291194637
Recommended
Ranking