Spin: gcc-6: unrecognized command line option - gcc

I want to use SPIN model checker on Windows 10 (64bit) and I have followed the instructions on the spin website:
I installed MinGW and gcc, updated path, and checked in the command prompt it shows version 6.3.0
I installed ActiveTCL updated path, updated path with iSpin too, I can get iSpin to open
when I try to compile pre-included example file leader.pml I get this error:
spin: preprocessing failed gcc -std=gnu99 -Wformat-overflow=0 -E -x c "leader.pml" > "pan.pre"
gcc: error: unrecognized command line option '-Wformat-overflow=0'; did you mean '-Wstrict-overflow='?
I don't understand the error, does someone know what is missing?

The error says exactly what the problem is: -Wformat-overflow=0 is not a recognized command line option.
Not that you are using MinGW GCC 6.3.0, which is very old.
Consider using MinGW-w64 which is much more recent. Currently GCC 11.2.0 is the latest version. You can find a standalone build at https://winlibs.com/
So please try with a newer GCC. If it still does't work run gcc --help -v to see all command line options.

Related

Could not build gem5 on a machine with anaconda: "lto1: fatal error: bytecode stream"

When I tried to build gem5 with command scons build/X86/gem5.opt -j12, I received an error message saying
lto1: fatal error: bytecode stream in file '/home/beihai/anaconda3/lib/python3.8/config-3.8-x86_64-linux-gnu/libpython3.8.a' generated with LTO version 6.0 instead of the expected 8.1
I think it might be the problem of wrong gcc version. But I do not know how to fix it.
My system is Kubuntu 20.04
By running gcc -v, I got the global gcc version gcc version 9.3.0
By running /home/beihai/anaconda/envs/gem5build/bin/x86_64-conda_cos6-linux-gnu-gcc -v, I got the anaconda gcc version gcc version 7.3.0 (crosstoll-NG 1.23.0.449-a04d0)
Please tell me how to fix this problem.
I came across almost the same issue, except that mine said "LTO version 6.0 instead of the expected 6.2".
I searched for general solution for LTO compatibility issue and got some inspiration from this link: https://github.com/rust-lang/rust/issues/57176
Quick take from the above link: "I've looked into how this is related to python and found that the error only happens with python installed through anaconda."
So I removed my entire anaconda software package, and removed the build directory inside Gem5, and rerun the scon commands with an additional "--force-lto" arguments, now the installation is successful. Hope it can solve your issue as well.
The command I used: "scons --force-lto build/X86/gem5.opt -j6"
My setups is:
Ubuntu 18 withe kernel 4.15.0-134-generic
g++ --version = g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

how to update mpicc?

I run a mpicc with -std=c++11 and meet an error, the message is :
cc1plus: error: unrecognized command line option "-std=c++11"
I search it and find that it's because the gcc version is too old. I download gcc 5.1 tgz then make and install, and replace old gcc with new gcc , by add the direction to path , and I use gcc --version /g++ --version , I find the version is new now.
But when I use mpicc --versioin, I find it's still old version, so I still cannot compile my file. I try to make mpich and install it again, but there is nothing changed.
This problem can be solved in this way:
firstly, use "mpicc -compile_info" to get what mpicc call
in my system, it calls c++ ...
then, use "which c++" to find the path and use the new g++ to update it
If you are using OpenMPI, you can set OMPI_CC and OMPI_CXX to provide the C or C++ compiler, respectively.
I.e.
export OMPI_CXX=$(which g++)

c++: error: unrecognized command line option ‘-std=c++14’

I just moved my PC from Ubuntu 15.10 to Linux Mint 17.3.
Before this shift, this project compiled just fine in CLion. Now, it gives the following error:
c++: error: unrecognized command line option ‘-std=c++14’
This is probably due to this line in my CMake file:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -W -Wall -Wextra -pedantic")
I suspect this error is due to some outdated library/compiler. I don't know exactly what I need to do.
P.S.: I know that C++14 is not completely supported in CLion, and the editor will complain about syntax errors, but it will compile fine nonetheless.
-std=c++14 is called -std=c++1y in old gcc versions (at least 4.9 and older).
I am working on a high-performance cluster and the "default" version of gcc is 4.8.5, which is why I also ran into the error c++: error: unrecognized command line option ‘-std=c++14’.
Not having sudo rights, I could solve the issue by loading a module (https://modules.readthedocs.io/en/latest/) containing a more recent gcc version (module load compiler/gnu/9.1). So if you are working on a cluster check out module avail (or in general the documentation of the cluster).

fatal error: 'omp.h' file not found

I'm trying to compile my OpenMP program, but it doesn't work, this error message shows:
fatal error: 'omp.h' file not found
I've tried the solutions for this problem here, but nothing worked with me.
please help
I'm Mac user
You probably need to reinstall with:
brew reinstall gcc --without-multilib
Then you need to make sure you use the homebrew version of gcc (rather than anything Apple supplies) by running gcc-5 rather than plain gcc. You can check its name and version by running the following because homebrew normally always installs everything to /usr/local/bin:
ls /usr/local/bin/gcc*
Finally, you need to add the -fopenmp flag to your compiler invocation to tell the compiler to do the OpenMP thing.
So, your command will look like:
gcc-5 -fopenmp program.c -o program

Nim compiler fails with "Requested command not found: gcc.exe"

I tried to launch first program in nim. I downloaded Windows installer from the official site and did the installation with all possible components. But when I try to run the program I get the message:
"unhandled exception: Requested command not found: 'gcc.exe -c -w -IC:nimlib -o
c:nimworknimcacheaa.o c:nimworknimcacheaa.c'. OS error: [OSError] >
Process terminated with exit code 1"
is it possible to fix this situation?
From Nim's website:
Note: The Nim compiler requires a C compiler to compile software. On Windows we recommend that you use Mingw-w64. GCC is recommended on Linux and Clang on Mac.
Make sure to add the gcc binaries to your PATH.
download nim lag and exract the file and paste it in your directory lib

Resources