error: no C99 compiler found, eudev requires a C99 compiler - error-handling

I executed the command "make" after the configurations on the menuconfig of buildroot and then this error appeared.
It appears when i enable eudev.
Can someone help me???
when i do gcc --std=c99
the output is:
gcc: fatal error: no input files
compilation terminated.

You must inform your c++ or c file in the console:
gcc --std=c99 you_source_code.cpp
If you give more information about what you are doing will help understand your problem.

Related

Kotlin compiler error -d invalid argument

I am getting an error when I go to compile the kotlin cmd file for Windows, using their Hello, World! one, but I had to modify part of the compile command to get the -target part to be valid. I am not sure how to fix the invaled -d argument that they show to use.
The text editor is Visual Studio Code.
Compiler: Kotlin-native-windows-1.4.32.zip from JetBrains' GitHub account - https://github.com/JetBrains/kotlin/releases/tag/v1.4.32
My compiler command is kotlinc.bat helloworld.kt -target mingw_x64 -d "hello world/hello world.jar"
Output:
error: invalid argument: -d
info: use -help for more information
How can I fix this?
This is the Kotlin/Native compiler, and it supports a different set of command-line arguments.
The solution is to download the Kotlin/JVM compiler from the archive named kotlin-compiler-1.4.32.zip.
Since Kotlin 1.5-M1, the Native compiler will show a clarifying warning for this case: Native / CLI: provide a way to show difference between Jvm and Native compilers.

clang-tidy report error unknown argument when contain other compiler options

I have a project, I built it with intel compiler. I want use the clang-tidy to help detect code problems.
I am using CMake to generate compile_commands.json and I'm getting the follow error when I using clang-tidy:
$ run-clang-tidy
# output
# ...
clang-tidy-6.0 -header-filter=^/home/xuhui/temp/build/.* -p=/home/xuhui/temp/build /home/xuhui/temp/main.cpp
1 warning and 1 error generated.
Error while processing /home/xuhui/temp/main.cpp.
error: unknown argument: '-w2' [clang-diagnostic-error]
warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [clang-diagnostic-unknown-warning-option]
Actually, there is a very simliar question exist: clang-tidy reporting unknown warnings
However, when I try to using the method refered above, there is no help. The warning can be suppressed but error still exist.
$ run-clang-tidy -extra-arg=-Wno-unknown-warning-option
# output
# ...
clang-tidy-6.0 -header-filter=^/home/xuhui/temp/build/.* -extra-arg=-Wno-unknown-warning-option -p=/home/xuhui/temp/build /home/xuhui/temp/main.cpp
1 error generated.
Error while processing /home/xuhui/temp/main.cpp.
error: unknown argument: '-w2' [clang-diagnostic-error]
How can I deal with the error?
-w2 options is used to control warning in intel compiler.
Although the problem occurs to me because of the intel compiler, but may be other compiler's options can also leads to the problem.
Appendix
The follow code snippets can help reproduce the problem.
// CMakeLists.txt
SET(CMAKE_CXX_COMPILER "icc")
SET(CMAKE_CXX_COMPILER "icpc")
project(test)
# leads to warning, can be settled by refer link
add_compile_options("-Wno-maybe-uninitialized")
# leads to error, can not be settled by refer link
add_compile_options("-w2")
add_executable(a.out main.cpp)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
// main.cpp
#include <iostream>
int main()
{
std::cout << "hello!" << std::endl;
return 0;
}
the above code can generate compile_commands.json like follows:
[
{
"directory": "/home/xuhui/temp/build",
"command": "/opt/intel/compilers_and_libraries_2019.0.117/linux/bin/intel64/icpc -Wno-maybe-uninitialized -w2 -o CMakeFiles/a.out.dir/main.o -c /home/xuhui/temp/main.cpp",
"file": "/home/xuhui/temp/main.cpp"
}
]
Thanks for your time.
This is not a clang-tidy error per se. Clang-diagnostic-error is basically a compiler error. Clang has made unknown arguments a hard error some time ago and it cannot be degraded to a warning. There used to be -Qunused-arguments but that doesn't work in Clang 11 AFAIK.
You will have to remove the argument before passing the compile commands to clang-tidy, I suggest CMake - remove a compile flag for a single translation unit.
#pablo285 already give the perfect answer.
He said that:
have to remove the argument before passing the compile commands to
clang-tidy
He already provide a link to demonstate how to modify CMakeLists.txt to remove argument.
Also, we can do some modification directly on compile_commands.json to remove argument.
A script to tidy code can be written as follows:
# tidy_code.sh
cd build
cmake ..
# do modification on compile_commands.json to remove argument which clang can not recognized
# replace '-w2' to ' '
sed -i 's/-w2/ /g' compile_commands.json
# using clang tidy
run-clang-tidy -checks='*' -extra-arg=-Wno-unknown-warning-option

Can't build Nokia HEIF library with make

I'm trying to build the HEIF library in https://github.com/nokiatech/heif, but I'm having no luck.
I have CMake and the latest version of MinGW installed. I'm following the steps to build the library but I'm getting an error.
The first step, which is this:
cd heif/build
cmake --help
cmake ../srcs -G"<Generator listed by above command for your target platform>"
works, but the second step, which is this:
cmake --build .
seems to be working but when it gets to 41% done I get this error:
C:\Users\dantelo\Documents\heif-master\srcs\reader\heifstreamfile.cpp: In constructor 'HEIF::FileStream::FileStream(const char*)':
C:\Users\dantelo\Documents\heif-master\srcs\reader\heifstreamfile.cpp:44:9: error: 'fopen_s' was not declared in this scope
fopen_s(&m_file, filename, "rb");
^~~~~~~
C:\Users\dantelo\Documents\heif-master\srcs\reader\heifstreamfile.cpp:44:9: note: suggested alternative: 'fopen'
fopen_s(&m_file, filename, "rb");
^~~~~~~
fopen
reader\CMakeFiles\heif_static.dir\build.make:93: recipe for target 'reader/CMakeFiles/heif_static.dir/heifstreamfile.cpp.obj' failed
mingw32-make.exe[2]: *** [reader/CMakeFiles/heif_static.dir/heifstreamfile.cpp.obj] Error 1
mingw32-make.exe[2]: Leaving directory 'C:/Users/dantelo/Documents/heif-master/build'
CMakeFiles\Makefile2:233: recipe for target 'reader/CMakeFiles/heif_static.dir/all' failed
mingw32-make.exe[1]: *** [reader/CMakeFiles/heif_static.dir/all] Error 2
mingw32-make.exe[1]: Leaving directory 'C:/Users/dantelo/Documents/heif-master/build'
Makefile:85: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2
I'm on Windows 10 in case that's relevant. I have no idea why this is happening. Any help appreciated
It seems that fopen_s is only present in the C library provided by Microsoft, i.e. in MSVC. Source: Is there a way to use fopen_s() with GCC or at least create a #define about it?
Your best bet is then switching to MSVC, because the code you have was apparently never tested with MinGW, as it cannot be compiled by the latter.
Alternatively, if you are feeling lucky, you can just use some #define tricks to convert fopen_s to the standard fopen (see the answers in the linked question) and hope that this is the only incompatibility in the code.

How to give file as argument when running CLion Debugger

I have a c++ program that performs actions with getline(cin,line). When I compile the .c file with g++, I usually just run
g++ lr.cc -o lr
./lr < text
Where text is a file.
However I'm getting an error and would like to debug where in the code the error is being generated (it's a terminate called after throwing an instance of 'char const*'
Aborted (core dumped) error) but I can't seem to get CLion to compile the code and have the text file be a "argument".
I tried editing the arguments to < test, using the full path < /path/to/text/ and also adding the file to the set(SOURCE_FILES) of the CMakeLists.txt.
Any help would be greatly appreciated!
Turns out they don't support it (yet?). Used
std::ifstream in("/path/to/file/to/read");
std::cin.rdbuf(in.rdbuf());
at the beginning of my function that read cin and started the debugger

Cannot Compile StellaWare

I am trying to develop applications with Eclipse / Linux for Stellaris Launchpad (LM4F120). I am following this guide: http://kernelhacks.blogspot.de/2012/11/the-complete-tutorial-for-stellaris.html
However, I can't compile StellarisWare with make:
adc.c:1: error: bad value (cortex-m4) for -mcpu= switch
adc.c:1: error: invalid floating point option: -mfpu=fpv4-sp-d16
Obviously for compilation 'cc' instead of arm-*-gcc is used. How can I circumvent this problem?
I am using gcc-arm-none-eabi-4_7-2012q4. I did the following things for both a) the full StellarisWare Package (SW-LM3S-9453.exe) and the one for the Stellaris Launchpad (SW-EK-LM4F120XL-9453.exe):
1. Unzip: ../SW-*.zip
2. Try to compile: make
please follow the instruction in the below article
http://www.embeddedcircle.com/stellaris-lm4f120-launchpad-compiling-in-ubuntu-12-04/
do not forget to set the compiler path as per instruction 4