Does anyone know this g++ internal compiler error? - g++

Has anyone encountered this internal compiler error in g++ 11.1 (Ubuntu) before? Line number points to the closing bracket of main(). Seems to be specific for flags -mavx512f or -mavx512dq. Or is that an overflow (fairly complex code with template acrobatics)?
G++ g++-11.1
CCFLAGS -Wall -O3 -funroll-loops -pedantic -ggdb -fno-var-tracking -Wextra -mavx512f -mfpmath=sse -D_G_NO_NRV -fno-operator-names -Wno-non-virtual-dtor
CPPSTD_DEFINES -std=c++11
during RTL pass: fwprop1
In function 'int main(int, char**)':
internal compiler error: in set_accesses, at rtl-ssa/internals.inl:449
218 | }
| ^
0x175b827 internal_error(char const*, ...)
???:0
0x6a66a9 fancy_abort(char const*, int, char const*)
???:0
0x1741f7c rtl_ssa::function_info::start_block(rtl_ssa::function_info::build_info&, rtl_ssa::bb_info*)
???:0
0x174201f rtl_ssa::function_info::bb_walker::before_dom_children(basic_block_def*)
???:0
0x15d00e7 dom_walker::walk(basic_block_def*)
???:0
0x1742d62 rtl_ssa::function_info::process_all_blocks()
???:0
0x16e5e5e rtl_ssa::function_info::function_info(function*)
???:0
Thanks for your help!

Related

I have found this problem failed to get away from me

~/pset1/mario/ $ make mario
clang -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow mario.c -lcrypt -lcs50 -lm -o mario
mario.c:6:1: error: expected identifier or '('
{
^
1 error generated.
make: *** [<builtin>: mario] Error 1
~/pset1/mario/ $
This error message means you are missing a bracket ")" or "(" in line 6 of your source code.
mario.c:6:1: refers to the address or the location of the error.

MinGW+cmake on Windows 10 produce error: '__MINGW_EXTENSION' does not name a type

I have spent long time developing C/C++ under Linux, now I'm trying to port/compile my project under windows where I have no experinece. I want to keep the workflow as close to Linux as possible so I go with g++/MinGW and cmake.
When I do standard approach
cd Build
cmake .. -G "MinGW Makefiles"
make
I got tons of following errors:
PS D:\git\SimpleSimulationEngine\cpp\Build> make VERBOSE=1
"C:\Program Files\CMake\bin\cmake.exe" -SD:\git\SimpleSimulationEngine\cpp -BD:\git\SimpleSimulationEngine\cpp\Build --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_progress_start D:\git\SimpleSimulationEngine\cpp\Build\CMakeFiles D:\git\SimpleSimulationEngine\cpp\Build\\CMakeFiles\progress.marks
C:/MinGW/bin/make -f CMakeFiles\Makefile2 all
make[1]: Entering directory 'D:/git/SimpleSimulationEngine/cpp/Build'
C:/MinGW/bin/make -f common\algorithms\CMakeFiles\algorithms.dir\build.make common/algorithms/CMakeFiles/algorithms.dir/depend
make[2]: Entering directory 'D:/git/SimpleSimulationEngine/cpp/Build'
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" D:\git\SimpleSimulationEngine\cpp D:\git\SimpleSimulationEngine\cpp\common\algorithms D:\git\SimpleSimulationEngine\cpp\Build D:\git\SimpleSimulationEngine\cpp\Build\common\algorithms D:\git\SimpleSimulationEngine\cpp\Build\common\algorithms\CMakeFiles\algorithms.dir\DependInfo.cmake --color=
make[2]: Leaving directory 'D:/git/SimpleSimulationEngine/cpp/Build'
C:/MinGW/bin/make -f common\algorithms\CMakeFiles\algorithms.dir\build.make common/algorithms/CMakeFiles/algorithms.dir/build
make[2]: Entering directory 'D:/git/SimpleSimulationEngine/cpp/Build'
[ 1%] Building CXX object common/algorithms/CMakeFiles/algorithms.dir/main.cpp.obj
cd /d D:\git\SimpleSimulationEngine\cpp\Build\common\algorithms && C:\MinGW\bin\g++.exe #CMakeFiles/algorithms.dir/includes_CXX.rsp -Wall -std=c++17 -g -Og -fPIC -fno-strict-aliasing -Wno-maybe-uninitialized -Wno-char-subscripts -Wno-write-strings -Wno-format -Wno-parentheses -Wno-unused-but-set-variable -Wno-narrowing -Wno-unused-result -Wno-sign-compare -Wno-strict-aliasing -Wno-unused-variable -Wno-unused-value -Wno-comment -Wno-misleading-indentation -Werror=return-type -o CMakeFiles\algorithms.dir\main.cpp.obj -c D:\git\SimpleSimulationEngine\cpp\common\algorithms\main.cpp
In file included from c:\mingw\x86_64-w64-mingw32\include\stdlib.h:9:0,
from c:\mingw\include\c++\6.1.0\cstdlib:75,
from D:/git/SimpleSimulationEngine/cpp/common/utils/testUtils.h:6,
from D:\git\SimpleSimulationEngine\cpp\common\algorithms\main.cpp:2:
c:\mingw\x86_64-w64-mingw32\include\crtdefs.h:35:1: error: '__MINGW_EXTENSION' does not name a type
__MINGW_EXTENSION typedef unsigned __int64 size_t;
^~~~~~~~~~~~~~~~~
c:\mingw\x86_64-w64-mingw32\include\crtdefs.h:45:1: error: '__MINGW_EXTENSION' does not name a type
__MINGW_EXTENSION typedef __int64 ssize_t;
^~~~~~~~~~~~~~~~~
c:\mingw\x86_64-w64-mingw32\include\crtdefs.h:52:9: error: 'size_t' does not name a type
typedef size_t rsize_t;
^~~~~~
c:\mingw\x86_64-w64-mingw32\include\crtdefs.h:62:1: error: '__MINGW_EXTENSION' does not name a type
__MINGW_EXTENSION typedef __int64 intptr_t;
^~~~~~~~~~~~~~~~~
c:\mingw\x86_64-w64-mingw32\include\crtdefs.h:75:1: error: '__MINGW_EXTENSION' does not name a type
__MINGW_EXTENSION typedef unsigned __int64 uintptr_t;
I'm not sure my MinGW environment and libraries are setup properly, since I tried some older minGW version before, than I reinstalled it. Also I have installed MSYS2 in an atempt to install GLEW. But I do not use MSYS2 now, I use some stand alone instalation of MinGW and cmake.
There is nothing special in my CMakeLists.txt
cmake_minimum_required ( VERSION 2.8 )
project ( SimpleSimulationEngine )
set(default_build_type Release)
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++17" )
SET( IGNORE_WARRNING_FLAGS "-Wno-maybe-uninitialized -Wno-char-subscripts -Wno-write-strings -Wno-format -Wno-parentheses -Wno-unused-but-set-variable -Wno-narrowing -Wno-unused-result -Wno-sign-compare -Wno-strict-aliasing -Wno-unused-variable -Wno-unused-value -Wno-comment -Wno-misleading-indentation " )
SET( WARRNING_TO_ERROR "-Werror=return-type")
SET( AXULIARY_COMPILE_FLAGS "-g -Og -fPIC -fno-strict-aliasing ")
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${AXULIARY_COMPILE_FLAGS} ${IGNORE_WARRNING_FLAGS}
message ( "CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} )
When I check my environment variables/path there does not seem to be anything fishy (like two versions of MinGW)

How to fix /usr/bin/ld: cannot find -lboost_python

I just installed boost.python following the instructions on https://www.boost.org/doc/libs/1_69_0/libs/python/doc/html/building/no_install_quickstart.html
but when I try to run the code
bjam toolset=gcc --verbose-test test
it throws:
...found 23 targets...
...updating 6 targets...
gcc.link.dll extending.so
/usr/bin/ld: cannot find -lboost_python
collect2: error: ld returned 1 exit status
"g++" -o "extending.so" -Wl,-h -Wl,extending.so -shared -Wl,--start-group "extending.o" -Wl,-Bstatic -Wl,-Bdynamic -lboost_python -ldl -lpthread -lutil -Wl,--end-group -fPIC -g
...failed gcc.link.dll extending.so...
...skipped <p.>test_ext for lack of <p.>extending.so...
gcc.link test_embed
/usr/bin/ld: cannot find -lboost_python
collect2: error: ld returned 1 exit status
"g++" -L"/usr/lib" -L"/usr/lib/python2.7/config" -Wl,-rpath -Wl,"/usr/lib" -Wl,-rpath -Wl,"/usr/lib/python2.7/config" -o "test_embed" -Wl,--start-group "embedding.o" -Wl,-Bstatic -Wl,-Bdynamic -lboost_python -ldl -lpthread -lutil -lpython2.7 -Wl,--end-group -fPIC -g
...failed gcc.link test_embed...
...skipped <p.>test_embed.run for lack of <p.>test_embed...
...failed updating 2 targets...
...skipped 4 targets...
Anyone knows how to solve it? I only want boost to use boost.python.
Thanks
It's a linker error. Probably the lib file is under a different name, so have to create a symbolic link manually.
Search and locate the "libboost_pythonXX.so" file in the usr/lib directory
XX will match the python version with which you configured boost while building, From the exception thrown you probably configured it with python2.7, so the file probably will be named as libboost_python27.so
and then create a symbolic link :
sudo ln -s "libboost_pythonXX.so" libboost_python.so
You can use this link for reference.
https://github.com/BVLC/caffe/issues/4843
It helped me to solve the error for me.

Argument unused during compilation?

From the research I have done, the problem seems to be with clang. If that is the case, how would I fix this on a Mac? Would switching to Ubuntu/Linux be a better option?
I'm not sure if it is relevant, but my professor is having us code using C syntax using g++ and saving our files as '.cpp' before we dive into C++.
Warning:
clang: warning: argument unused during compilation: '-ansi'
[-Wunused-command-line-argument]
Makefile:
CC = g++
calendar: main.o calendar.o appt.o day.o time.o
$(CC) main.o calendar.o appt.o day.o time.o -g -ansi -Wall -o calendar.out
%.o: %.cpp
$(CC) -Wall -c $<
You are correct in believing that this warning is issued by clang++ in these
circumstances and not by g++, and that you see it on your Mac because g++ is
really clang++.
The GCC option -ansi is meaningful for compilation and not meaningful
for linkage. Clang is warning you because you are passing it in your linkage recipe:
$(CC) main.o calendar.o appt.o day.o time.o -g -ansi -Wall -o calendar.out
where it is ineffective, and not passing it to your compilation recipe:
$(CC) -Wall -c $<
The wording of the diagnostic is misleading since it is provoked here
precisely by the absence of compilation. Nevertheless, it does
draw attention to a mistake on your part. Remove -ansi from your linkage recipe and add it to your compilation recipe.

Link errors while using G++ for MPI code

My code is as simple as this:
#include <mpi.h>
int main(int argc, char**args) {
MPI_Init(&argc, &args);
int mpiSize;
int mpiRank;
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
MPI_Finalize();
}
I first compile it to object file:
g++ -c src/mpitest.cpp -o src/mpitest.o
Then I can easily use mpicxx:
mpicxx src/mpitest.o -o mpi
But I want to use g++ instead, because It's easier for automake, so I tried:
mpicxx src/mpitest.o -o mpi -show
It prints out:
g++ src/mpitest.o -o mpi -I/usr/local/include -L/usr/local/lib -L/usr/local/lib -lmpichcxx -lmpich -lopa -lpthread -lrt
And yes, that command actually does the same thing successfully. However, If I tried to change it to (I just change the object file and output to the end):
g++ -I/usr/local/include -L/usr/local/lib -L/usr/local/lib -lmpichcxx -lmpich -lopa -lpthread -lrt src/mpitest.o -o mpi
Which is what automake does when it adds LDFLAGS, the g++ start complaining...
src/mpitest.o: In function `main':
..src/mpitest.cpp:5: undefined reference to `MPI_Init'
../src/mpitest.cpp:8: undefined reference to `MPI_Comm_size'
../src/mpitest.cpp:9: undefined reference to `MPI_Comm_rank'
../src/mpitest.cpp:10: undefined reference to `MPI_Finalize'
collect2: ld returned 1 exit status
What happens with g++ ? I couldn't figure out. Please enlighten me. Why the order here matter at all ? What is the proper way to do what I want from the beginning ?
Thanks a lot
p/s : g++ --version
g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3
mpi is mvapich2
I didn't really remember, maybe since version 4, library to link with -l must be passed after all source and object files.