Build of nixos.avrgcclibc fails on NixOS - avr-gcc

I am trying to install avr-gcc-libc on NixOS, but run into a build error.
I try to install with the command
nix-env -iA nixos.avrgcclibc
The output this produces is very long and terminates with
g++ -c -DIN_GCC_FRONTEND -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -Icp -I../../gcc -I../../gcc/cp -I../../gcc/../include -I../../gcc/../libcpp/include -I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/../libbacktrace -o cp/except.o
-MT cp/except.o -MMD -MP -MF cp/.deps/except.TPo ../../gcc/cp/except.c
In file included from ./tm.h:18:0,
from ../../gcc/cp/except.c:27:
../../gcc/config/elfos.h:102:21: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
fprintf ((FILE), "%s"HOST_WIDE_INT_PRINT_UNSIGNED"\n",\
^
../../gcc/config/elfos.h:170:24: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
^
In file included from ../../gcc/cp/except.c:1023:0:
cfns.gperf: In function 'const char* libc_name_p(const char*, unsigned int)':
cfns.gperf:101:1: error: 'const char* libc_name_p(const char*, unsigned int)' redeclared inline with 'gnu_inline' attribute
cfns.gperf:26:14: note: 'const char* libc_name_p(const char*, unsigned int)' previously declared here
cfns.gperf: At global scope:
cfns.gperf:26:14: warning: inline function 'const char* libc_name_p(const char*, unsigned int)' used but never defined
make[2]: *** [Makefile:1064: cp/except.o] Error 1
make[2]: Leaving directory '/tmp/nix-build-avr-gcc-libc.drv-0/gcc-5.3.0/obj-avr/gcc'
make[1]: *** [Makefile:4094: all-gcc] Error 2
make[1]: Leaving directory '/tmp/nix-build-avr-gcc-libc.drv-0/gcc-5.3.0/obj-avr'
make: *** [Makefile:852: all] Error 2
builder for ‘/nix/store/0ypaa4x9x0lsyygciasw9m1v4jswgm49-avr-gcc-libc.drv’ failed with exit code 2
error: build of ‘/nix/store/0ypaa4x9x0lsyygciasw9m1v4jswgm49-avr-gcc-libc.drv’ failed
What might the problem be? What can I do to get avr-gcc-libc to install successfully?

Related

bash: ./main.o cannot execute binary file Exec format error

I have set up a ubuntu virtual machine on windows using virtual box.
I am trying to run a C++ project. The make file looks like this
CC = g++ -O2 -Wno-deprecated
tag = -i
ifdef linux
tag = -n
endif
test.out: Record.o Comparison.o ComparisonEngine.o Schema.o File.o DBFile.o y.tab.o lex.yy.o test.o
$(CC) -o test.out Record.o Comparison.o ComparisonEngine.o Schema.o File.o DBFile.o y.tab.o lex.yy.o test.o -lfl
main: Record.o Comparison.o ComparisonEngine.o Schema.o File.o y.tab.o lex.yy.o main.o
$(CC) -o main Record.o Comparison.o ComparisonEngine.o Schema.o File.o y.tab.o lex.yy.o main.o -lfl
test.o: test.cc
$(CC) -g -c test.cc
main.o: main.cc
$(CC) -g -c main.cc
Comparison.o: Comparison.cc
$(CC) -g -c Comparison.cc
ComparisonEngine.o: ComparisonEngine.cc
$(CC) -g -c ComparisonEngine.cc
DBFile.o: DBFile.cc
$(CC) -g -c DBFile.cc
File.o: File.cc
$(CC) -g -c File.cc
Record.o: Record.cc
$(CC) -g -c Record.cc
Schema.o: Schema.cc
$(CC) -g -c Schema.cc
y.tab.o: Parser.y
yacc -d Parser.y
sed $(tag) y.tab.c -e "s/ __attribute__ ((__unused__))$$/# ifndef __cplusplus\n __attribute__ ((__unused__));\n# endif/"
g++ -c y.tab.c
lex.yy.o: Lexer.l
lex Lexer.l
gcc -c lex.yy.c
clean:
rm -f *.o
rm -f *.out
rm -f y.tab.c
rm -f lex.yy.c
rm -f y.tab.h
After running the make command I get a bunch of warnings like
g++ -O2 -Wno-deprecated -g -c Record.cc
g++ -O2 -Wno-deprecated -g -c Comparison.cc
g++ -O2 -Wno-deprecated -g -c ComparisonEngine.cc
g++ -O2 -Wno-deprecated -g -c Schema.cc
Schema.cc: In constructor ‘Schema::Schema(const char*, const char*)’:
Schema.cc:46:9: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf (foo, "%s", space);
~~~~~~~^~~~~~~~~~~~~~~~~~
Schema.cc:58:10: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf (foo, "%s", space);
~~~~~~~^~~~~~~~~~~~~~~~~~
Schema.cc:84:9: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf (foo, "%s", space);
~~~~~~~^~~~~~~~~~~~~~~~~~
Schema.cc:91:10: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf (foo, "%s", space);
~~~~~~~^~~~~~~~~~~~~~~~~~
Schema.cc:95:11: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf (foo, "%s", space);
~~~~~~~^~~~~~~~~~~~~~~~~~
Schema.cc:106:10: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf (foo, "%s", space);
~~~~~~~^~~~~~~~~~~~~~~~~~
Schema.cc:114:10: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf (foo, "%s", space);
~~~~~~~^~~~~~~~~~~~~~~~~~
Schema.cc:118:10: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf (foo, "%s", space);
~~~~~~~^~~~~~~~~~~~~~~~~~
g++ -O2 -Wno-deprecated -g -c File.cc
File.cc: In member function ‘void File::GetPage(Page*, off_t)’:
File.cc:186:7: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
read (myFilDes, bits, PAGE_SIZE);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
File.cc: In member function ‘void File::AddPage(Page*, off_t)’:
File.cc:206:10: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
write (myFilDes, &foo, sizeof (int));
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
File.cc:223:8: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
write (myFilDes, bits, PAGE_SIZE);
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
File.cc: In member function ‘void File::Open(int, char*)’:
File.cc:258:8: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
read (myFilDes, &curLength, sizeof (off_t));
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
File.cc: In member function ‘int File::Close()’:
File.cc:276:8: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
write (myFilDes, &curLength, sizeof (off_t));
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
g++ -O2 -Wno-deprecated -g -c DBFile.cc
yacc -d Parser.y
sed -i y.tab.c -e "s/ __attribute__ ((__unused__))$/# ifndef __cplusplus\n __attribute__ ((__unused__));\n# endif/"
g++ -c y.tab.c
y.tab.c: In function ‘int yyparse()’:
y.tab.c:1427:35: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
yyerror (YY_("syntax error"));
^
y.tab.c:1571:35: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
yyerror (YY_("memory exhausted"));
^
lex Lexer.l
gcc -c lex.yy.c
g++ -O2 -Wno-deprecated -g -c test.cc
g++ -O2 -Wno-deprecated -o test.out Record.o Comparison.o ComparisonEngine.o Schema.o File.o DBFile.o y.tab.o lex.yy.o test.o -lfl
All files compile generating respective .o files except the main.cc. So I compile it using this command
g++ -O2 -Wno-deprecated -g -c -o main.o main.cc
Now the main.o file compiles and main.o is generated
I then run it using ./main.o and get Permission denied
So I get rid of this error by chmod 755 ./*
Now running the main.o gives this error
bash: ./main.o cannot execute binary file Exec format error
Through my research I found out that this error is because of the mismatch in arhitecture and file type.
file main.o outputs x86-64 and uname -m outputs x86_64
I cannot figure out the problem.
Any help would be greatly appreciated! Thank you!
You are trying to execute an object file. Object files like main.o are not executable. They only contain part of the code required to form an exectuable.
You need to run main (or maybe test.out), which is the actual executable.
The permission warnings were telling you the same thing (that main.o is not executable), but you overwrote that with chmod.
main should be created by make assuming there are no compilation/linking errors if you use make main or test.out if you use make or make test.out. The linker invocation is given in the main:/test.out: target of the Makefile. If make generates compiler or linker errors, then repeating the same commands manually is not going to fix it. Fix the code or Makefile instead.
Also note that the warnings/errors are there for a reason. Since C++11, you are not allowed to cast string literals to char*, only to const char*. This was deprecated already in C++03. Circumventing that rule is only going to cause you trouble in the future. Fix your code instead of adding -Wno-deprecated.

How to properly call C++ library function in Java Activity

I am using GitHub in-paint library https://github.com/cheind/inpaint in android studio
and trying to call jni fuction of inpainter in main activity but it is not resolving or getting recognized.
C++ is new to me so i am having issue.
in criminisi_inpainter.cpp file
there is this function
void inpaintCriminisi(
cv::InputArray image,
cv::InputArray targetMask,
cv::InputArray sourceMask,
int patchSize)
{
CriminisiInpainter ci;
ci.setSourceImage(image.getMat());
ci.setSourceMask(sourceMask.getMat());
ci.setTargetMask(targetMask.getMat());
ci.setPatchSize(patchSize);
ci.initialize();
while (ci.hasMoreSteps()) {
ci.step();
}
ci.image().copyTo(image.getMat());
}
this native function i have to call in main activity
public native void inpaintCriminisi( ? , ? ,? , int z);
The issue is i do not understand what parameters would be provided here in main activity (JAVA)
In nativelib.cpp i am exporting jnicall function i give object parameters which is not exact parameters that should be defined.
extern "C"
JNIEXPORT void JNICALL
Java_com_example_raweeda_applicationc_MainActivity_inpaintCriminisi(JNIEnv *env, jobject instance,
jobject a, jobject b, jobject c,
jint xl) {
// TODO
inpaintCriminisi(x,y,z,xl);
parameters are not object it just an example
}
this is the error i am recieving
Build command failed.
Error while executing process C:\Users\abc\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build D:\2019_android\ApplicationC\app\.externalNativeBuild\cmake\debug\x86 --target native-lib}
[1/3] Building CXX object CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o
[2/3] Building CXX object CMakeFiles/native-lib.dir/src/main/cpp/criminisi_inpainter.cpp.o
FAILED: C:\Users\abc\AppData\Local\Android\Sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=i686-none-linux-android19 --gcc-toolchain=C:/Users/abc/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64 -Dnative_lib_EXPORTS -ID:/opencv-sdk/OpenCV-android-sdk/sdk/native/jni/include --sysroot C:/Users/abc/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security -stdlib=libc++ -std=c++11 -frtti -fexceptions -O0 -fno-limit-debug-info -fPIC -MD -MT CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o -MF CMakeFiles\native-lib.dir\src\main\cpp\native-lib.cpp.o.d -o CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o -c D:\2019_android\ApplicationC\app\src\main\cpp\native-lib.cpp
D:\2019_android\ApplicationC\app\src\main\cpp\native-lib.cpp:13:5: warning: declaration does not declare anything [-Wmissing-declarations]
cv::InputArray ;
^~~~~~~~~~~~~~
D:\2019_android\ApplicationC\app\src\main\cpp\native-lib.cpp:23:39: error: expected '(' for function-style cast or type construction
inpaintCriminisi( cv::InputArray image,
~~~~~~~~~~~~~~ ^
D:\2019_android\ApplicationC\app\src\main\cpp\native-lib.cpp:24:28: error: expected '(' for function-style cast or type construction
cv::InputArray targetMask,
~~~~~~~~~~~~~~ ^
D:\2019_android\ApplicationC\app\src\main\cpp\native-lib.cpp:25:28: error: expected '(' for function-style cast or type construction
cv::InputArray sourceMask,
~~~~~~~~~~~~~~ ^
D:\2019_android\ApplicationC\app\src\main\cpp\native-lib.cpp:26:17: error: expected '(' for function-style cast or type construction
int patchSize);
~~~ ^
1 warning and 4 errors generated.
FAILED: C:\Users\abc\AppData\Local\Android\Sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=i686-none-linux-android19 --gcc-toolchain=C:/Users/abc/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64 -Dnative_lib_EXPORTS -ID:/opencv-sdk/OpenCV-android-sdk/sdk/native/jni/include --sysroot C:/Users/abc/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security -stdlib=libc++ -std=c++11 -frtti -fexceptions -O0 -fno-limit-debug-info -fPIC -MD -MT CMakeFiles/native-lib.dir/src/main/cpp/criminisi_inpainter.cpp.o -MF CMakeFiles\native-lib.dir\src\main\cpp\criminisi_inpainter.cpp.o.d -o CMakeFiles/native-lib.dir/src/main/cpp/criminisi_inpainter.cpp.o -c D:\2019_android\ApplicationC\app\src\main\cpp\criminisi_inpainter.cpp
In file included from D:\2019_android\ApplicationC\app\src\main\cpp\criminisi_inpainter.cpp:7:
D:\2019_android\ApplicationC\app\src\main\cpp/timer.h:83:1: error: extraneous closing brace ('}')
}
^
D:\2019_android\ApplicationC\app\src\main\cpp\criminisi_inpainter.cpp:10:10: fatal error: 'opencv' file not found
#include "opencv"
^~~~~~~~
2 errors generated.
ninja: build stopped: subcommand failed.
because in nativelib.cpp

Unable to build wxWidgets on Cygwin - xlocale.h

I've been attempting to build wxWidgets 3.1.0 in Cygwin. I followed the process described in the install.txt, summarized below:
cd $WXWIN
mkdir build-debug
cd build-debug
../configure --enable-debug
make -j4
I have also tried a couple other flags for configure such as --with-X11, as suggest by this guide. The error I keep receiving, however, is the following:
/home/acohen8/wxWidgets-3.1.0/build-debug/bk-deps g++ -c -o basedll_strvararg.o -D__WXMSW__ -DWXBUILDING -I../src/regex -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE -DwxUSE_BASE=1 -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -D_FILE_OFFSET_BITS=64 -I/home/acohen8/wxWidgets-3.1.0/build-debug/lib/wx/include/msw-unicode-3.1 -I../include -g -O0 ../src/common/strvararg.cpp
In file included from ../src/common/string.cpp:39:0:
../include/wx/xlocale.h: In function ‘double wxStrtod_lA(const char*, char**, const wxXLocale&)’:
../include/wx/xlocale.h:243:54: error: ‘strtod_l’ was not declared in this scope
{ return wxCRT_Strtod_lA(c, endptr, loc.Get()); }
^
../include/wx/xlocale.h: In function ‘long int wxStrtol_lA(const char*, char**, int, const wxXLocale&)’:
../include/wx/xlocale.h:245:60: error: ‘strtol_l’ was not declared in this scope
{ return wxCRT_Strtol_lA(c, endptr, base, loc.Get()); }
^
../include/wx/xlocale.h: In function ‘long unsigned int wxStrtoul_lA(const char*, char**, int, const wxXLocale&)’:
../include/wx/xlocale.h:247:61: error: ‘strtoul_l’ was not declared in this scope
{ return wxCRT_Strtoul_lA(c, endptr, base, loc.Get()); }
^
../include/wx/xlocale.h: In function ‘double wxStrtod_l(const wchar_t*, wchar_t**, const wxXLocale&)’:
../include/wx/xlocale.h:301:58: error: ‘wcstod_l’ was not declared in this scope
{ return wxCRT_Strtod_lW(c, endptr, loc.Get()); }
^
../include/wx/xlocale.h: In function ‘long int wxStrtol_l(const wchar_t*, wchar_t**, int, const wxXLocale&)’:
../include/wx/xlocale.h:303:64: error: ‘wcstol_l’ was not declared in this scope
{ return wxCRT_Strtol_lW(c, endptr, base, loc.Get()); }
^
../include/wx/xlocale.h: In function ‘long unsigned int wxStrtoul_l(const wchar_t*, wchar_t**, int, const wxXLocale&)’:
../include/wx/xlocale.h:305:65: error: ‘wcstoul_l’ was not declared in this scope
{ return wxCRT_Strtoul_lW(c, endptr, base, loc.Get()); }
^
/home/acohen8/wxWidgets-3.1.0/build-debug/bk-deps g++ -c -o basedll_sysopt.o -D__WXMSW__ -DWXBUILDING -I../src/regex -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE -DwxUSE_BASE=1 -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -D_FILE_OFFSET_BITS=64 -I/home/acohen8/wxWidgets-3.1.0/build-debug/lib/wx/include/msw-unicode-3.1 -I../include -g -O0 ../src/common/sysopt.cpp
make: *** [Makefile:25366: basedll_string.o] Error 1
make: *** Waiting for unfinished jobs....
I would very much appreciate some suggestions on this!
This is most likely already fixed in wx's git master by this commit. But you can work around the problem by using configure --disable-xlocale.

Why the linker does not see my function (define macro to substitute the syslog)?

I try to substitute the syslog function in such a manner:
#include <cstdio>
#include <cstdarg>
void syslog_printf(int level, char* format, ...)
{
va_list params;
va_start(params, format);
vprintf(format, params);
printf("\n");
va_end(params);
}
#define syslog(...) syslog_printf(__VA_ARGS__)
#include <modbus/modbus.c>
This is a listing of my modbus.cpp file. The modbus.c is there too, but I can't modify it because it used in several places. The modbus.cpp compiled right but the linker reports that it can't find the syslog_printf function.
The question is simple: why?
EDIT:
make -k all
Building file: ../modbus.cpp
Invoking: GCC C++ Compiler
g++ -std=c++0x -DDEBUG -I../../include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"modbus.d" -MT"modbus.d" -o "modbus.o" "../modbus.cpp"
Finished building: ../modbus.cpp
Building target: fire
Invoking: GCC C++ Linker
g++ -o "fire" ./main.o ./modbus.o
./modbus.o: In function `error_treat(modbus_param_t*, int, char const*)':
../../include/modbus/modbus.c:144: undefined reference to `syslog_printf'
./modbus.o: In function `modbus_send(modbus_param_t*, unsigned char*, int)':
../../include/modbus/modbus.c:379: undefined reference to `syslog_printf'
./modbus.o: In function `receive_msg(modbus_param_t*, int, unsigned char*, int*)':
../../include/modbus/modbus.c:482: undefined reference to `syslog_printf'
../../include/modbus/modbus.c:484: undefined reference to `syslog_printf'
../../include/modbus/modbus.c:511: undefined reference to `syslog_printf'
./modbus.o:../../include/modbus/modbus.c:524: more undefined references to `syslog_printf' follow
collect2: error: ld returned 1 exit status
make: *** [makefile:46: fire] Error 1
make: Target 'all' not remade because of errors.
EDIT:
If I try to switch the modbus.cpp to the modbus.c, I get this:
make -k all
Building file: ../modbus.c
Invoking: GCC C Compiler
gcc -DDEBUG -I../../include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"modbus.d" -MT"modbus.d" -o "modbus.o" "../modbus.c"
../modbus.c:13:21: error: conflicting types for ‘syslog_printf’
#define syslog(...) syslog_printf(__VA_ARGS__)
^
../modbus.c:4:6: note: previous definition of ‘syslog_printf’ was here
void syslog_printf(int level, char* format, ...)
^~~~~~~~~~~~~
make: *** [subdir.mk:34: modbus.o] Error 1
make: Target 'all' not remade because of errors.
The right variant of the "outer" modbus.c is
#include <stdio.h>
#include <stdarg.h>
#include <syslog.h> // I could include it earlier than the "inner" modbus.c will do...
void syslog_printf(int level, char* format, ...)
{
va_list params;
va_start(params, format);
vprintf(format, params);
printf("\n");
va_end(params);
}
#define syslog(...) syslog_printf(__VA_ARGS__)
#include <modbus/modbus.c>
Thanks to all of you, commented my question.

Qt + iperf3 = lconv has not been declared

Sorry for my english.
I try to add iperf3 (like static link library) to my Qt project (Qt version 4.8.5, OpenSuse 13.1), and has several errors:
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../lperftest -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I../lperf/include -I. -I../lperftest -I. -o main.o ../lperftest/main.cpp
In file included from /usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h:41:0,
from /usr/include/c++/4.8/bits/localefwd.h:40,
from /usr/include/c++/4.8/string:43,
from /usr/include/QtCore/qstring.h:54,
from /usr/include/QtCore/qobject.h:48,
from /usr/include/QtCore/QObject:1,
from ../lperftest/main.cpp:9:
/usr/include/c++/4.8/clocale:53:11: error: '::lconv' has not been declared
using ::lconv;
^
/usr/include/c++/4.8/clocale:54:11: error: '::setlocale' has not been declared
using ::setlocale;
^
/usr/include/c++/4.8/clocale:55:11: error: '::localeconv' has not been declared
using ::localeconv;
^
In file included from /usr/include/c++/4.8/bits/localefwd.h:40:0,
from /usr/include/c++/4.8/string:43,
from /usr/include/QtCore/qstring.h:54,
from /usr/include/QtCore/qobject.h:48,
from /usr/include/QtCore/QObject:1,
from ../lperftest/main.cpp:9:
/usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h:52:23: error: 'uselocale' was not declared in this scope
extern "C" __typeof(uselocale) __uselocale;
^
/usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h:52:45: error: invalid type in declaration before ';' token
extern "C" __typeof(uselocale) __uselocale;
^
/usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h: In function 'int std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)':
/usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h:75:53: error: '__gnu_cxx::__uselocale' cannot be used as a function
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
^
/usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h:100:33: error: '__gnu_cxx::__uselocale' cannot be used as a function
__gnu_cxx::__uselocale(__old);
^
../lperftest/main.cpp: At global scope:
../lperftest/main.cpp:11:5: warning: unused parameter 'argc' [-Wunused-parameter]
int main(int argc, char *argv[])
^
../lperftest/main.cpp:11:5: warning: unused parameter 'argv' [-Wunused-parameter]
make: *** [main.o] Error 1
When i try to add iperf3 to the only C++ project all is good. This error exist only in Qt project. Is any idea?
I have the same problem with iperf3 and Qt. Basically it seems that you have to use similar compilation for iperf3 library and your project (both gcc or both g++).
Let us know how it goes. Or share your solution if already done.
-- edit --
or do the following for iperf_api.h
extern "C" {
#include <iperf_api.h>
}