`

当安装了libiconv环境下安装lua-iconv 会出现报错 /usr/local/lib/lua/5.1/iconv.so: undefined symb

 
阅读更多
转自: 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
当安装了libiconv环境下安装lua-iconv 会出现报错 /usr/local/lib/lua/5.1/iconv.so: undefined symbol: libiconv
王 王海波 29天之前
当libiconv先安装的时候会出现报错
/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

简单的处理方式:
mv /usr/local/include/iconv.h ~/
luarocks install lua-iconv后再恢复

过程:
参考
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

经过查证(受到此文启发 http://tonybai.com/2013/04/25/a-libiconv-linkage-problem/),

分析为先安装了 libiconv库, 导致 此库的iconv.h拷贝到 usr/local/include/iconv.h

然后编译 luaiconv工程,编译文件iconv.c文件时候, gcc先找到 usr/local/include/iconv.h 此文件, 以此文件内部的函数声明为准,编译出iconv.so

实际上次应该以系统提供的 iconv.h 为准, 此文件在 /usr/include/iconv.h

头文件gcc搜索次序:

:~/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.c 中 libiconv_open 定义收到宏控制, 应该未开启, 或者编译 luaiconv未链接libiconv库

#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

解决方法: 修改实现文件中, 引用的 iconv.h 引用方式, 将标准方式, 修改为自定义,并且写为全路径 /usr/include/iconv.h

然后再次 make && make install, 运行ok

vim luaiconv.c

#include <lua.h>
#include <lauxlib.h>
#include <stdlib.h>

#include "/usr/include/iconv.h"
#include <errno.h>



花下眠工作室: http://huaxiamian.cc
分享到:
评论

相关推荐

    windows字符编码转换库(iconv.dll)32位和64位

    iconv库32位版和64位版都含有,其中包含编译好的: charset.lib、iconv.lib、iconv.dll、charset.dll、iconv.exe 以及头文件:iconv.h、libcharset.h、localcharset.h 还有说明:iconv.1.html、iconv.3.html 等资源

    libiconv-1.15.rpm centos7,安装php的扩展

    编译安装时需要的libiconv包,安装完指定php的--with-iconv-dir=/usr/share/libiconv即可,不与系统自带的冲突。 php rpm包下载地址: https://download.csdn.net/download/sinat_24092079/10598887

    ffprobe-20190623-bc3306f-win64-static可执行文件

    libiconv 1.15 &lt;http://gnu.org/software/libiconv&gt; libass 0.14.0 &lt;https://github.com/libass/libass&gt; dav1d 20190620-4a2ea99 &lt;https://code.videolan.org/videolan/dav1d&gt; libbluray 20180913-2d18c70 ...

    libiconv.lib and iconv.h for win64

    iconv_t cd; int rc; char **pin = &inbuf; char **pout = &outbuf; cd = iconv_open(to_charset, from_charset); int argument = 1; if (cd == 0) return -1; if (iconv(cd,(char **)pin, &inlen;, pout, &...

    php5.3.8 终极安装 /home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2419: undefi

    通常,它会被安装到`/usr/local/php`这样的目录下。 6. 配置PHP与Web服务器集成:如Apache或Nginx,需要编辑配置文件,使PHP能够处理`.php`文件。 7. 测试运行:使用`php -v`检查PHP是否成功安装,并显示版本信息...

    本人编译的iconv.so 与其头文件

    我在做一个加密芯片项目...1.如要iconv_open、iconv_close这样的名字,需在iconv.h中加入#define LIBICONV_PLUG即可。 2.如要libiconv_open、libiconv_close这样的名字,需在iconv.h中移除#define LIBICONV_PLUG即可。

    luaiconv.dll for windows

    release build with 1. LuaForWindows_v5.1.5-52 2. libiconv-1.15 3. lua-iconv-lua-iconv-7

    nginx配置指南

    jpeg-dir=/usr/local/webserver/jpeg/ --with-png-dir=/usr/local/webserver/png/ --with-zlib-dir=/usr/local/webserver/zlib/ --with-freetype-dir=/usr/local/webserver/freetype/ --with-iconv-dir=/usr/local/...

    Mac 系统下PHP源码包安装

    --with-iconv=/usr/local/Cellar/libiconv/1.16 \ --with-icu-dir=/usr/local/opt/icu4c \ --disable-phpdbg \ --disable-phpdbg-webhelper \ --enable-opcache \ --enable-fileinfo \ --with-openssl=/usr/...

    centos系统编译安装nginx+php环境另加独立mysql教程.docx

    --with-iconv=/usr/local/libiconv \ --with-mysql=/usr/local/mysql \ --with-mysqli=/usr/local/mysql/bin/mysql_config \ --without-pear ``` 知识点4:安装Nginx 安装Nginx,编译安装过程不再赘述,请参照之前...

    ffmpeg-2.5.2-win64-dev.7z

    libiconv 1.14 &lt;http://gnu.org/software/libiconv/&gt; libass 0.12.0 &lt;http://code.google.com/p/libass/&gt; libbluray 0.6.2 &lt;http://videolan.org/developers/libbluray.html&gt; libbs2b 3.1.0 &lt;http://bs2b....

    linux+apache2+php5+mysql5--Install&Config

    如果出现错误提示“无法创建一般文件”,请先创建`/usr/local/jpeg6/lib`目录再重新执行`make install-lib`。 - **libpng**:用于处理PNG图像 ```bash tar zxvf libpng-1.2.43.tar.gz cd libpng-1.2.43 ./...

    linux上源码安装apache2.4 nginx1.2 php5.3.10 mysql5.3

    ./configure --prefix=/usr/local/mysql --with-plugins=innobase --with-extra-charsets=all --with-innodb --with-plugins=all ``` 3. **编译并安装MySQL**: ```bash make make install ``` 4. **初始化...

    Centos搭建PHP5.3.8+Nginx1.0.9+Mysql5.5.17

    在本文中,我们将讨论如何在CentOS系统上搭建PHP5.3.8、Nginx1.0.9和Mysql5.5.17的环境。这个过程对于初学者来说是一个基础的LNMP(Linux、Nginx、MySQL、PHP)服务器配置,旨在..../configure --prefix=/usr/local/...

    php安装命令

    LD_LIBRARY_PATH=/usr/local/lib ./configure make make install ``` 在执行`./configure`时可能会遇到问题,可以通过编辑`configure`脚本来解决: ```bash # 替换 $RM $cfgfile 为 rm -f $cfgfile sed -i ...

    apr-iconv-1.2.1-win32-src.zip

    在Windows环境下,apr-iconv源码包(apr-iconv-1.2.1)的编译和使用对于本地化和跨平台通信具有重要意义。 解压"apr-iconv-1.2.1-win32-src.zip"后,你将得到apr-iconv 1.2.1的源码文件,包括头文件、源代码文件和...

    ffmpeg-2.5.2-win64-shared.7z

    libiconv 1.14 &lt;http://gnu.org/software/libiconv/&gt; libass 0.12.0 &lt;http://code.google.com/p/libass/&gt; libbluray 0.6.2 &lt;http://videolan.org/developers/libbluray.html&gt; libbs2b 3.1.0 &lt;http://bs2b....

    linxu系统php环境配置

    ln -s /usr/local/libiconv/lib/libiconv.so.2 /usr/lib64/libiconv.so.2 ``` 五、安装Zend Optimizer 3.3.3 1. 下载Zend Optimizer源码包: ```bash wget ...

    FFmpeg win64

    libiconv 1.14 &lt;http://gnu.org/software/libiconv/&gt; libass 0.13.2 &lt;https://github.com/libass/libass&gt; libbluray 0.9.2 &lt;http://videolan.org/developers/libbluray.html&gt; libbs2b 3.1.0 &lt;http://bs2b....

Global site tag (gtag.js) - Google Analytics