Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/142.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 使用OpenWRT工具链交叉编译OpenWRT Linux环境的POCO库_C++_Linux_Ubuntu_Poco_Openwrt - Fatal编程技术网

C++ 使用OpenWRT工具链交叉编译OpenWRT Linux环境的POCO库

C++ 使用OpenWRT工具链交叉编译OpenWRT Linux环境的POCO库,c++,linux,ubuntu,poco,openwrt,C++,Linux,Ubuntu,Poco,Openwrt,我正在尝试使用OpenWRT工具链为OpenWRT Linux环境交叉编译POCO源代码包。我已经下载了POCO源代码包,并试图交叉编译它,但我得到的错误日志如下 src/Error.cpp: In static member function 'static std::string Poco::Error::getMessage(int)': src/Error.cpp:71:55: error: invalid conversion from 'int' to 'const char*' [

我正在尝试使用OpenWRT工具链为OpenWRT Linux环境交叉编译POCO源代码包。我已经下载了POCO源代码包,并试图交叉编译它,但我得到的错误日志如下

src/Error.cpp: In static member function 'static std::string
Poco::Error::getMessage(int)': src/Error.cpp:71:55: error: invalid
conversion from 'int' to 'const char*' [-fpermissive]
return std::string(strerror_r(errorCode, errmsg, 256));
                                                       ^
In file included from
/home/ubuntu/subhendu/options_cg/trunk/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_musl-1.1.10/mips-openwrt-linux-musl/include/c++/4.8.3/string:53:0,
                 from include/Poco/Bugcheck.h:24,
                 from include/Poco/Foundation.h:148,
                 from src/Error.cpp:17: /home/ubuntu/subhendu/options_cg/trunk/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_musl-1.1.10/mips-openwrt-linux-musl/include/c++/4.8.3/bits/basic_string.tcc:212:5:
error:   initializing argument 1 of 'std::basic_string<_CharT,
_Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' [-fpermissive]
     basic_string<_CharT, _Traits, _Alloc>::
     ^
/home/ubuntu/subhendu/Poco/poco-1.6.0/build/rules/compile:53: recipe for target
'/home/ubuntu/subhendu/Poco/poco-1.6.0/Foundation/obj/Linux/x86_64/debug_shared/Error.o'
failed make[1]: ***
[/home/ubuntu/subhendu/Poco/poco-1.6.0/Foundation/obj/Linux/x86_64/debug_shared/Error.o]
Error 1 make[1]: Leaving directory
'/home/ubuntu/subhendu/Poco/poco-1.6.0/Foundation' Makefile:69: recipe
for target 'Foundation-libexec' failed make: *** [Foundation-libexec]
Error 2
src/Error.cpp:在静态成员函数“static std::string”中
Poco::Error::getMessage(int)':src/Error.cpp:71:55:错误:无效
从“int”转换为“const char*”[-fppermissive]
返回std::string(strerror_r(errorCode,errmsg,256));
^
在文件中包括从
/home/ubuntu/subhundu/options\u cg/trunk/staging\u dir/toolchain-mips\u 34kc\u gcc-4.8-linaro\u musl-1.1.10/mips openwrt linux musl/include/c++/4.8.3/string:53:0,
从include/Poco/Bugcheck.h:24,
摘自include/Poco/Foundation.h:148,
来自src/Error.cpp:17:/home/ubuntu/subhundu/options\u cg/trunk/staging\u dir/toolchain-mips\u 34kc\u gcc-4.8-linaro\u musl-1.1.10/mips openwrt linux musl/include/c++/4.8.3/bits/basic\u string.tcc:212:5:
错误:初始化'std::basic_string::basic_string(const\u CharT*,const\u Alloc&)[带_CharT=char;_Traits=std::char\u Traits;_Alloc=std::allocator]'[-fppermissive]
基本字符串::
^
/home/ubuntu/subpendu/Poco/Poco-1.6.0/build/rules/compile:53:目标的配方
“/home/ubuntu/subhandu/Poco/Poco-1.6.0/Foundation/obj/Linux/x86_64/debug_shared/Error.o”
无法生成[1]:***
[/home/ubuntu/subpendu/Poco/Poco-1.6.0/Foundation/obj/Linux/x86\u 64/debug\u shared/Error.o]
错误1生成[1]:正在离开目录
“/home/ubuntu/subpendu/Poco/Poco-1.6.0/Foundation”Makefile:69:recipe
对于目标'Foundation libexec',生成失败:**[Foundation libexec]
错误2
如果有人面临同样的问题或对如何解决有任何想法,请给出您的解决方案…

看看,我明白了:

请注意返回类型的差异

查看您的错误消息:

error: invalid conversion from 'int' to 'const char*' [-fpermissive]
return std::string(strerror_r(errorCode, errmsg, 256));
                                                       ^
您正在编译的源代码似乎期望的是GNU特定版本的
strerror\u r
,但得到的是符合XSI的版本。要么您的目标没有提供GNU扩展,要么您的工具链设置不正确

手册页的内容如下:

glibc的功能测试宏要求(参见功能测试宏(7)): 如果满足以下条件,则提供符合XSI的strerror_r()版本:

(_POSIX_C_SOURCE>=200112L|||u XOPEN_SOURCE>=600)和&_GNU_源代码

否则,将提供特定于GNU的版本

所以你可能想朝这个方向调查。(当您试图编译时,
\u POSIX\u C\u SOURCE
\u XOPEN\u SOURCE
\u GNU\u SOURCE
设置为什么?

查看,我看到:

请注意返回类型的差异

查看您的错误消息:

error: invalid conversion from 'int' to 'const char*' [-fpermissive]
return std::string(strerror_r(errorCode, errmsg, 256));
                                                       ^
您正在编译的源代码似乎期望的是GNU特定版本的
strerror\u r
,但得到的是符合XSI的版本。要么您的目标没有提供GNU扩展,要么您的工具链设置不正确

手册页的内容如下:

glibc的功能测试宏要求(参见功能测试宏(7)): 如果满足以下条件,则提供符合XSI的strerror_r()版本:

(_POSIX_C_SOURCE>=200112L|||u XOPEN_SOURCE>=600)和&_GNU_源代码

否则,将提供特定于GNU的版本


所以你可能想朝这个方向调查。(当您试图编译时,
\u POSIX\u C_SOURCE
\u XOPEN\u SOURCE
\u GNU_SOURCE
设置为什么?

@wifiapidev:不客气。事实上,这是我最喜欢的问题——从未使用过该功能,甚至连名字都不知道有问题的软件包,没有环境来重现问题,但仍然能想出一些有用的方法。;-)@维菲亚皮德夫:不客气。事实上,这是我最喜欢的问题——从未使用过该功能,甚至连名字都不知道有问题的软件包,没有环境来重现问题,但仍然能想出一些有用的方法。;-)