The glog library is printing (unknown) for certain stack frames in a stacktrace.
I'm on Ubuntu 18.04 using the standard libgoogle-glog-dev package:
$ cat > t.cc
#include <glog/logging.h>
void h() { LOG(FATAL) << "test"; }
void g() { h(); }
void f() { g(); }
int main(int argc, char** argv) {
google::InitGoogleLogging(argv[0]);
f();
}
^D
The above program when compiled...
$ g++ t.cc -lglog
...and run...
$ ./a.out
...outputs the following:
F1219 13:54:46.608317 13408 t.cc:3] test
*** Check failure stack trace: ***
# 0x7f90ddd970cd google::LogMessage::Fail()
# 0x7f90ddd98f33 google::LogMessage::SendToLog()
# 0x7f90ddd96c28 google::LogMessage::Flush()
# 0x7f90ddd99999 google::LogMessageFatal::~LogMessageFatal()
# 0x56279a0a7b30 (unknown)
# 0x56279a0a7b45 (unknown)
# 0x56279a0a7b51 (unknown)
# 0x56279a0a7b77 (unknown)
# 0x7f90dd632b97 __libc_start_main
# 0x56279a0a79fa (unknown)
Aborted (core dumped)
See the frames with (unknown) - I would expect them to read main, f, g, h
I've tried adding -rdynamic, but I still observe the same behaviour:
$ g++ t.cc -lglog -rdynamic
I've tried adding -g, but I still observe the same behaviour:
$ g++ t.cc -lglog -o t -g -rdynamic
I just tried it and it works for me.
My result where you can see h(), g(), f() is shown in the stack trace.
F1219 16:20:16.171772 20931 main.cpp:2] test
*** Check failure stack trace: ***
# 0x7f951ee03e6d (unknown)
# 0x7f951ee05ced (unknown)
# 0x7f951ee03a5c (unknown)
# 0x7f951ee0663e (unknown)
# 0x40089a h()
# 0x4008af g()
# 0x4008bb f()
# 0x4008e1 main
# 0x7f951e22e3d5 __libc_start_main
# 0x4007a9 (unknown)
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
Here is my CMakeLists.txt file
cmake_minimum_required(VERSION 3.13)
project(test_glog)
set(CMAKE_CXX_STANDARD 14)
include_directories(/usr/include)
link_libraries(glog)
add_executable(test_glog main.cpp)
Which expands to this when I compile:
I am on CentOS 7 and installed following libraries:
yum install glog-devel gflags-devel
Here is how I build it:
[user#cent1 build]$ make VERBOSE=1
/usr/bin/cmake3 -H/home/user/CLionProjects/test_glog -B/home/user/CLionProjects/test_glog/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake3 -E cmake_progress_start /home/user/CLionProjects/test_glog/build/CMakeFiles /home/user/CLionProjects/test_glog/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/user/CLionProjects/test_glog/build'
make -f CMakeFiles/test_glog.dir/build.make CMakeFiles/test_glog.dir/depend
make[2]: Entering directory `/home/user/CLionProjects/test_glog/build'
cd /home/user/CLionProjects/test_glog/build && /usr/bin/cmake3 -E cmake_depends "Unix Makefiles" /home/user/CLionProjects/test_glog /home/user/CLionProjects/test_glog /home/user/CLionProjects/test_glog/build /home/user/CLionProjects/test_glog/build /home/user/CLionProjects/test_glog/build/CMakeFiles/test_glog.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/user/CLionProjects/test_glog/build'
make -f CMakeFiles/test_glog.dir/build.make CMakeFiles/test_glog.dir/build
make[2]: Entering directory `/home/user/CLionProjects/test_glog/build'
[ 50%] Building CXX object CMakeFiles/test_glog.dir/main.cpp.o
/opt/rh/devtoolset-7/root/usr/bin/c++ -std=gnu++14 -o CMakeFiles/test_glog.dir/main.cpp.o -c /home/user/CLionProjects/test_glog/main.cpp
[100%] Linking CXX executable test_glog
/usr/bin/cmake3 -E cmake_link_script CMakeFiles/test_glog.dir/link.txt --verbose=1
/opt/rh/devtoolset-7/root/usr/bin/c++ CMakeFiles/test_glog.dir/main.cpp.o -o test_glog -lglog
make[2]: Leaving directory `/home/user/CLionProjects/test_glog/build'
[100%] Built target test_glog
make[1]: Leaving directory `/home/user/CLionProjects/test_glog/build'
/usr/bin/cmake3 -E cmake_progress_start /home/user/CLionProjects/test_glog/build/CMakeFiles 0
Update:
I install Debian ubuntu-18.04.1-desktop-amd64.iso in a vm and build glog from sources. Your example now shows:
$ ./a.out
F0102 23:54:15.603329 10358 t.cc:2] test
*** Check failure stack trace: ***
# 0x55c930b28d2c google::LogMessage::Fail()
# 0x55c930b28c74 google::LogMessage::SendToLog()
# 0x55c930b285b5 google::LogMessage::Flush()
# 0x55c930b2be66 google::LogMessageFatal::~LogMessageFatal()
# 0x55c930b25820 google::thread_msg_data
# 0x55c930b25835 google::thread_msg_data
# 0x55c930b25841 google::thread_msg_data
# 0x55c930b25867 google::thread_msg_data
# 0x7ff9fbf2eb97 __libc_start_main
# 0x55c930b256ea google::thread_msg_data
# (nil) (unknown)
Aborted (core dumped)
I can see there we an atempt to fix this so I advice you to open an issue with
glog.
https://github.com/google/glog/pull/347/commits/26459400f49850bda8e736882c6f22c2ce766761
I also tried to build it straight from the command link and show the settings.
Not sure if the settings for the build of the glog library would make a difference.
$ g++ t.cc -lglog --verbose
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-27ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04)
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/7/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE t.cc -quiet -dumpbase t.cc -mtune=generic -march=x86-64 -auxbase t -version -fstack-protector-strong -Wformat -Wformat-security -o /tmp/ccoFCYTb.s
GNU C++14 (Ubuntu 7.3.0-27ubuntu1~18.04) version 7.3.0 (x86_64-linux-gnu)
compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/7"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/7
/usr/include/x86_64-linux-gnu/c++/7
/usr/include/c++/7/backward
/usr/lib/gcc/x86_64-linux-gnu/7/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
GNU C++14 (Ubuntu 7.3.0-27ubuntu1~18.04) version 7.3.0 (x86_64-linux-gnu)
compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 1bfae38ae5df64de6196cbd8c3b07d86
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
as -v --64 -o /tmp/ccvUzQBB.o /tmp/ccoFCYTb.s
GNU assembler version 2.30 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.30
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/7/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/7/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper -plugin-opt=-fresolution=/tmp/ccNEOWk1.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/7/../../.. /tmp/ccvUzQBB.o -lglog -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
Here is the output when I run it:
$ ./a.out
F0106 12:07:11.753652 28547 t.cc:2] test
*** Check failure stack trace: ***
# 0x55c500dedd2c google::LogMessage::Fail()
# 0x55c500dedc74 google::LogMessage::SendToLog()
# 0x55c500ded5b5 google::LogMessage::Flush()
# 0x55c500df0e66 google::LogMessageFatal::~LogMessageFatal()
# 0x55c500dea820 google::thread_msg_data
# 0x55c500dea835 google::thread_msg_data
# 0x55c500dea841 google::thread_msg_data
# 0x55c500dea867 google::thread_msg_data
# 0x7f882d938b97 __libc_start_main
# 0x55c500dea6ea google::thread_msg_data
# (nil) (unknown)
Aborted (core dumped)
Update 2:
A glog developer Evgeny Prigorodov have been looking into the problem and have identified the issue. I am confident this issue will be fixed soon.
So here is what happens in src/symbolize.cc after a93a451:
Each line in the stack trace is being prepared in the function SymbolizeAndDemangle().
It calculates variables start_address / base_address and calls the function GetSymbolFromObjectFile(), which tries to look up symbol corresponding to a given frame instruction pointer (pc).
In v0.3.4 the call to GetSymbolFromObjectFile() passed value of start_address, a start address of a memory region, which can never be zero. GetSymbolFromObjectFile() did not check the value of start_address and just used it for lookups in two symbol tables.
In v0.3.5 the call to GetSymbolFromObjectFile() started passing value of base_address. That value can become zero if the frame program counter was found within the very first memory region and the executable image has been mapped with zero offset. That seems to be a common case.
Another change in GetSymbolFromObjectFile() added a code for symbol offset adjustment and a new check: if symbol_offset equals zero after all adjustments then the function returns a failure value meaning "symbol not found". Since the symbol_offset variable was then calculated from base_address, that condition became quite possible.
For full details see
I can get the same output and found a work around to see the function names.
I can reproduce your problem on ubuntu 18.10, I also get this output:
2019-01-07 22:55:59 joerg#dilbert:~/src/tmp/so5$ ./a.out
F0107 22:56:02.115654 23819 t.cc:2] test
*** Check failure stack trace: ***
# 0x7f15c11410cd google::LogMessage::Fail()
# 0x7f15c1142f33 google::LogMessage::SendToLog()
# 0x7f15c1140c28 google::LogMessage::Flush()
# 0x7f15c1143999 google::LogMessageFatal::~LogMessageFatal()
# 0x560617c379c0 (unknown)
# 0x560617c379d5 (unknown)
# 0x560617c379e1 (unknown)
# 0x560617c37a07 (unknown)
# 0x7f15c09dcb97 __libc_start_main
# 0x560617c3788a (unknown)
Aborted (core dumped)
Work around
use valgrind!
but, I see the actual function names when I use valgrind:
2019-01-07 22:56:02 joerg#dilbert:~/src/tmp/so5$ valgrind ./a.out
==32384== Memcheck, a memory error detector
==32384== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==32384== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==32384== Command: ./a.out
==32384==
F0107 22:56:58.129938 32384 t.cc:2] test
==32384== Syscall param msync(start) points to uninitialised byte(s)
==32384== at 0x5511B24: msync (msync.c:25)
==32384== by 0x5A102F3: ??? (in /usr/lib/x86_64-linux-gnu/libunwind.so.8.0.1)
==32384== by 0x5A14230: ??? (in /usr/lib/x86_64-linux-gnu/libunwind.so.8.0.1)
==32384== by 0x5A1453E: ??? (in /usr/lib/x86_64-linux-gnu/libunwind.so.8.0.1)
==32384== by 0x5A14A98: ??? (in /usr/lib/x86_64-linux-gnu/libunwind.so.8.0.1)
==32384== by 0x5A10E70: _ULx86_64_step (in /usr/lib/x86_64-linux-gnu/libunwind.so.8.0.1)
==32384== by 0x4E50F4A: ??? (in /usr/lib/x86_64-linux-gnu/libglog.so.0.0.0)
==32384== by 0x4E4809B: google::LogMessage::RecordCrashReason(google::glog_internal_namespace_::CrashReason*) (in /usr/lib/x86_64-linux-gnu/libglog.so.0.0.0)
==32384== by 0x4E49E94: google::LogMessage::SendToLog() (in /usr/lib/x86_64-linux-gnu/libglog.so.0.0.0)
==32384== by 0x4E47C27: google::LogMessage::Flush() (in /usr/lib/x86_64-linux-gnu/libglog.so.0.0.0)
==32384== by 0x4E4A998: google::LogMessageFatal::~LogMessageFatal() (in /usr/lib/x86_64-linux-gnu/libglog.so.0.0.0)
==32384== by 0x1089BF: h() (t.cc:2)
==32384== Address 0x1ffefff000 is on thread 1's stack
==32384==
*** Check failure stack trace: ***
# 0x4e480cd google::LogMessage::Fail()
# 0x4e49f33 google::LogMessage::SendToLog()
# 0x4e47c28 google::LogMessage::Flush()
# 0x4e4a999 google::LogMessageFatal::~LogMessageFatal()
# 0x1089c0 (unknown)
# 0x1089d5 (unknown)
# 0x1089e1 (unknown)
# 0x108a07 (unknown)
# 0x5417b97 __libc_start_main
# 0x10888a (unknown)
==32384==
==32384== Process terminating with default action of signal 6 (SIGABRT)
==32384== at 0x5434E97: raise (raise.c:51)
==32384== by 0x5436800: abort (abort.c:79)
==32384== by 0x4E514E6: ??? (in /usr/lib/x86_64-linux-gnu/libglog.so.0.0.0)
==32384== by 0x4E480CC: google::LogMessage::Fail() (in /usr/lib/x86_64-linux-gnu/libglog.so.0.0.0)
==32384== by 0x4E49F32: google::LogMessage::SendToLog() (in /usr/lib/x86_64-linux-gnu/libglog.so.0.0.0)
==32384== by 0x4E47C27: google::LogMessage::Flush() (in /usr/lib/x86_64-linux-gnu/libglog.so.0.0.0)
==32384== by 0x4E4A998: google::LogMessageFatal::~LogMessageFatal() (in /usr/lib/x86_64-linux-gnu/libglog.so.0.0.0)
==32384== by 0x1089BF: h() (t.cc:2)
==32384== by 0x1089D4: g() (t.cc:3)
==32384== by 0x1089E0: f() (t.cc:4)
==32384== by 0x108A06: main (t.cc:7)
==32384==
==32384== HEAP SUMMARY:
==32384== in use at exit: 10,949 bytes in 191 blocks
==32384== total heap usage: 238 allocs, 47 frees, 111,825 bytes allocated
==32384==
==32384== LEAK SUMMARY:
==32384== definitely lost: 0 bytes in 0 blocks
==32384== indirectly lost: 0 bytes in 0 blocks
==32384== possibly lost: 0 bytes in 0 blocks
==32384== still reachable: 10,949 bytes in 191 blocks
==32384== suppressed: 0 bytes in 0 blocks
==32384== Rerun with --leak-check=full to see details of leaked memory
==32384==
==32384== For counts of detected and suppressed errors, rerun with: -v
==32384== Use --track-origins=yes to see where uninitialised values come from
==32384== ERROR SUMMARY: 2 errors from 1 contexts (suppressed: 0 from 0)
Aborted (core dumped)
you see the same output as before at the beginning and at the end there is a stack trace with the function names. Does that help?
I used this to compile and link it:
g++ t.cc -lglog
so: no special compiler or linker flags.
and these are the g++ and valgrind versions:
2019-01-07 23:01:45 joerg#dilbert:~/src/tmp/so5$ g++ --version
g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2019-01-07 23:01:49 joerg#dilbert:~/src/tmp/so5$ valgrind --version
valgrind-3.13.0
That seem to be a regression introduced in the glog v0.3.5 by this commit.
The sample code works correctly when compiled in Ubuntu 16.04 with the stock version of libgoogle-glog-dev v0.3.4
And the problem can be reliably reproduced on the AWS Ubuntu Server 18.04 (AMI ID ami-00035f41c82244dab) with the stock version of libgoogle-glog-dev v0.3.5.
Downgrading package libgoogle-glog-dev to version v0.3.4 fixes the problem on Ubuntu 18.04.
In order to downgrade the version apply the following workaround: 1) add Xenial repository with the previous versions and 2) make apt prefer the version 0.3.4 of libgoogle-glog-dev to (a.k.a package pinning):
ubuntu#ec-ubuntu18:~$ dpkg -l | grep glog
ii libgoogle-glog-dev 0.3.5-1 amd64 library that implements application-level logging.
ii libgoogle-glog0v5 0.3.5-1 amd64 library that implements application-level logging.
ubuntu#ec-ubuntu18:~$ ./a.out
F0108 19:22:08.617049 19750 t.cc:2] test
*** Check failure stack trace: ***
# 0x7ffa821240cd google::LogMessage::Fail()
# 0x7ffa82125f33 google::LogMessage::SendToLog()
# 0x7ffa82123c28 google::LogMessage::Flush()
# 0x7ffa82126999 google::LogMessageFatal::~LogMessageFatal()
# 0x563949dd89c0 (unknown)
# 0x563949dd89d5 (unknown)
# 0x563949dd89e1 (unknown)
# 0x563949dd8a07 (unknown)
# 0x7ffa819bfb97 __libc_start_main
# 0x563949dd888a (unknown)
Aborted (core dumped)
ubuntu#ec-ubuntu18:~$ echo "deb http://archive.ubuntu.com/ubuntu/ xenial universe" | sudo tee /etc/apt/sources.list.d/xenial.list
ubuntu#ec-ubuntu18:~$ cat << EOF | sudo tee /etc/apt/preferences.d/libgoogle-glog-dev
# Pin down the version of google-glog
Package: libgoogle-glog-dev libgoogle-glog0v5
Pin: version 0.3.4*
Pin-Priority: 1000
# Make sure that other packages from Xenial cannot be installed
Package: *
Pin: release v=16.04, l=Ubuntu
Pin-Priority: -10
EOF
ubuntu#ec-ubuntu18:~$ sudo apt-get update
ubuntu#ec-ubuntu18:~$ sudo apt-get upgrade libgoogle-glog-dev
ubuntu#ec-ubuntu18:~$ dpkg -l | grep glog
ii libgoogle-glog-dev 0.3.4-0.1 amd64 library that implements application-level logging.
ii libgoogle-glog0v5 0.3.4-0.1 amd64 library that implements application-level logging.
ubuntu#ec-ubuntu18:~$ ./a.out
F0108 19:30:42.793792 19518 t.cc:2] test
*** Check failure stack trace: ***
# 0x7f3da453f5cd google::LogMessage::Fail()
# 0x7f3da4541433 google::LogMessage::SendToLog()
# 0x7f3da453f15b google::LogMessage::Flush()
# 0x7f3da4541e1e google::LogMessageFatal::~LogMessageFatal()
# 0x5625c9e069c0 h()
# 0x5625c9e069d5 g()
# 0x5625c9e069e1 f()
# 0x5625c9e06a07 main
# 0x7f3da3ddbb97 __libc_start_main
# 0x5625c9e0688a _start
Aborted (core dumped)
I have checked that reverting commit changes in lines 359 and 806 of the source package also fixes the issue on Ubuntu 18.04.
Related
My aim is to run cross compiled valgrind on an arm emulated environment.
I have cross-compiled valgrind 3.13 using the arm-linaro toolchain(http://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/arm-linux-gnueabi/) with command:
./configure --target=arm-none-linux-gnueabi --host=armv7-none-linux-gnueabi --prefix=/home/karan/valgrind/build CFLAGS=-static CPPFLAGS=-fPIC CFLAGS=-fPIC
make && make install
I have transferred the valgrind build folder on the docker container( docker image: https://hub.docker.com/r/arm32v7/ubuntu
in directory= /root/valgrind/build) and exported the PATH environment variable as well as VALGRIND_LIB variable.
After this when I try to run valgrind I get the output:
valgrind: no program specified
valgrind: Use --help for more information.
I created a simple demo file(try.cpp) which prints a string and compiled it on the docker itself with command = g++ try.cpp
//try.cpp
#include<iostream>
int main()
{
std::cout<<"HELLO";
return 0;
}
the linker used is the default one and the output of command = ldd a.out is
root#d170b9f5fc84:~# ldd a.out
libstdc++.so.6 => /lib/arm-linux-gnueabihf/libstdc++.so.6 (0xfe664000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xfe63b000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xfe53d000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xfe4d4000)
/lib/ld-linux-armhf.so.3 (0xfefc5000)
However on running valgrind on this simple demo file, I get the error:
root#d170b9f5fc84:~# valgrind ./a.out
==4064== Memcheck, a memory error detector
==4064== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==4064== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==4064== Command: ./a.out
==4064==
valgrind: Fatal error at startup: a function redirection
valgrind: which is mandatory for this platform-tool combination
valgrind: cannot be set up. Details of the redirection are:
valgrind:
valgrind: A must-be-redirected function
valgrind: whose name matches the pattern: strcmp
valgrind: in an object with soname matching: ld-linux-armhf.so.3
valgrind: was not found whilst processing
valgrind: symbols from the object with soname: ld-linux-armhf.so.3
valgrind:
valgrind: Possible fixes: (1, short term): install glibc's debuginfo
valgrind: package on this machine. (2, longer term): ask the packagers
valgrind: for your Linux distribution to please in future ship a non-
valgrind: stripped ld.so (or whatever the dynamic linker .so is called)
valgrind: that exports the above-named function using the standard
valgrind: calling conventions for this platform. The package you need
valgrind: to install for fix (1) is called
valgrind:
valgrind: On Debian, Ubuntu: libc6-dbg
valgrind: On SuSE, openSuSE, Fedora, RHEL: glibc-debuginfo
valgrind:
valgrind: Note that if you are debugging a 32 bit process on a
valgrind: 64 bit system, you will need a corresponding 32 bit debuginfo
valgrind: package (e.g. libc6-dbg:i386).
valgrind:
valgrind: Cannot continue -- exiting now. Sorry.
I installed libc6-dbg ( command apt-get install libc6-dbg) but to no avail. I am still getting the same error. I thought of replacing the default linker in /lib/ directory (ld-linux-armhf.so.3 -> ld-2.31.so) with the linker provided in toolchain because it had the .symtab section but that broke the OS itself and then I couldn't run any commands on bash.
Could someone tell me how to run valgrind on the arm docker.? I believe My replacement of loader is not correct or incomplete.
I've been trying to install the OpenMP 4.5 off-loading to Nvidia GPU version of gcc for a while and so far no success, although I'm getting closer.
This time, I followed this script, where I have made two changes: First I specified the trunk version of gcc instead of 7.2, secondly nvptx-newlib is now included in nvptx-tools according to the github repository, so I removed that part of the script. For easy reference, the original script is
#!/bin/sh
#
# Build GCC with support for offloading to NVIDIA GPUs.
#
work_dir=$HOME/offload/wrk
install_dir=$HOME/offload/install
# Location of the installed CUDA toolkit
cuda=/usr/local/cuda
# Build assembler and linking tools
mkdir -p $work_dir
cd $work_dir
git clone https://github.com/MentorEmbedded/nvptx-tools
cd nvptx-tools
./configure \
--with-cuda-driver-include=$cuda/include \
--with-cuda-driver-lib=$cuda/lib64 \
--prefix=$install_dir
make
make install
cd ..
# Set up the GCC source tree
git clone https://github.com/MentorEmbedded/nvptx-newlib
svn co svn://gcc.gnu.org/svn/gcc/tags/gcc_7_2_0_release gcc
cd gcc
contrib/download_prerequisites
ln -s ../nvptx-newlib/newlib newlib
cd ..
target=$(gcc/config.guess)
# Build nvptx GCC
mkdir build-nvptx-gcc
cd build-nvptx-gcc
../gcc/configure \
--target=nvptx-none --with-build-time-tools=$install_dir/nvptx-none/bin \
--enable-as-accelerator-for=$target \
--disable-sjlj-exceptions \
--enable-newlib-io-long-long \
--enable-languages="c,c++,fortran,lto" \
--prefix=$install_dir
make -j4
make install
cd ..
# Build host GCC
mkdir build-host-gcc
cd build-host-gcc
../gcc/configure \
--enable-offload-targets=nvptx-none \
--with-cuda-driver-include=$cuda/include \
--with-cuda-driver-lib=$cuda/lib64 \
--disable-bootstrap \
--disable-multilib \
--enable-languages="c,c++,fortran,lto" \
--prefix=$install_dir
make -j4
make install
cd ..
After quite a while, this successfully exits. Per the instructions on that webpage, I added $install_dir/lib64 to my LD_LIBRARY_PATH and additionally to LIBRARY_PATH.
Then as a test, I have the following basic test program
#include <omp.h>
#include <cmath>
#include <iostream>
int main()
{
double data_array[1000000];
#pragma omp target teams distribute
for (int idx = 0; idx < 1000000; ++idx)
{
data_array[idx] = idx;
}
std::cout << "Hopefully this ran on the gpu...\n";
}
Then I try to compile this using offload/install/bin/g++ -fopenmp -foffload=nvptx-none main.cpp then it returns with the following error message:
x86_64-pc-linux-gnu-accel-nvptx-none-gcc: error: libgomp.spec: No such file or directory
mkoffload: fatal error: offload/install/bin/x86_64-pc-linux-gnu-accel-nvptx-none-gcc returned 1 exit status
compilation terminated.
lto-wrapper: fatal error: /home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0//accel/nvptx-none/mkoffload returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
The file libgomp.spec can be found in the aforementioned $install_dir/lib64, which on my system is offload/install/lib64/.
Some more information about my system:
Ubuntu 16.04, accessed through slurm
Cuda 9.0.176
4x Nvidia Tesla V100
offload/install/bin/g++ -v reports:
Using built-in specs.
COLLECT_GCC=offload/install/bin/g++
COLLECT_LTO_WRAPPER=/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --enable-offload-targets=nvptx-none --with-cuda-driver-include=/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/cuda-9.0.176-m4ivnigh5kuty6u7tcnroxr5on5lot6s/include --with-cuda-driver-lib=/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/cuda-9.0.176-m4ivnigh5kuty6u7tcnroxr5on5lot6s/lib64 --disable-bootstrap --disable-multilib --enable-languages=c,c++,fortran,lto --prefix=/home/over_ng/offload/install
Thread model: posix
gcc version 9.0.0 20180627 (experimental) (GCC)
offload/install/bin/g++ -print-search-dirs reports
install: /home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/
programs: =/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/:/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/:/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu/9.0.0/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../x86_64-pc-linux-gnu/bin/x86_64-linux-gnu/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../x86_64-pc-linux-gnu/bin/
libraries: =/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/cuda-9.0.176-m4ivnigh5kuty6u7tcnroxr5on5lot6s/lib64/x86_64-pc-linux-gnu/9.0.0/:/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/cuda-9.0.176-m4ivnigh5kuty6u7tcnroxr5on5lot6s/lib64/x86_64-linux-gnu/:/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/cuda-9.0.176-m4ivnigh5kuty6u7tcnroxr5on5lot6s/lib64/../lib64/:/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/subversion-1.9.7-f5fbcx4xhwzrq5rhhco7byj7cbx2f4fs/lib/x86_64-pc-linux-gnu/9.0.0/:/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/subversion-1.9.7-f5fbcx4xhwzrq5rhhco7byj7cbx2f4fs/lib/x86_64-linux-gnu/:/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/subversion-1.9.7-f5fbcx4xhwzrq5rhhco7byj7cbx2f4fs/lib/../lib64/:/home/over_ng/offload/install/lib64/x86_64-pc-linux-gnu/9.0.0/:/home/over_ng/offload/install/lib64/x86_64-linux-gnu/:/home/over_ng/offload/install/lib64/../lib64/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../x86_64-pc-linux-gnu/lib/x86_64-pc-linux-gnu/9.0.0/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../x86_64-pc-linux-gnu/lib/x86_64-linux-gnu/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../x86_64-pc-linux-gnu/lib/../lib64/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../x86_64-pc-linux-gnu/9.0.0/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../x86_64-linux-gnu/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../lib64/:/lib/x86_64-pc-linux-gnu/9.0.0/:/lib/x86_64-linux-gnu/:/lib/../lib64/:/usr/lib/x86_64-pc-linux-gnu/9.0.0/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib64/:/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/cuda-9.0.176-m4ivnigh5kuty6u7tcnroxr5on5lot6s/lib64/:/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/subversion-1.9.7-f5fbcx4xhwzrq5rhhco7byj7cbx2f4fs/lib/:/home/over_ng/offload/install/lib64/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../x86_64-pc-linux-gnu/lib/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../:/lib/:/usr/lib/
And finally, offload/install/bin/g++ -fopenmp -foffload=nvptx-none -v main.cpp reports
Using built-in specs.
COLLECT_GCC=offload/install/bin/g++
COLLECT_LTO_WRAPPER=/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --enable-offload-targets=nvptx-none --with-cuda-driver-include=/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/cuda-9.0.176-m4ivnigh5kuty6u7tcnroxr5on5lot6s/include --with-cuda-driver-lib=/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/cuda-9.0.176-m4ivnigh5kuty6u7tcnroxr5on5lot6s/lib64 --disable-bootstrap --disable-multilib --enable-languages=c,c++,fortran,lto --prefix=/home/over_ng/offload/install
Thread model: posix
gcc version 9.0.0 20180627 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-fopenmp' '-foffload=nvptx-none' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-pthread'
/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE -D_REENTRANT main.cpp -quiet -dumpbase main.cpp -mtune=generic -march=x86-64 -auxbase main -version -fopenmp -foffload=nvptx-none -o /tmp/cc9FAd0p.s
GNU C++14 (GCC) version 9.0.0 20180627 (experimental) (x86_64-pc-linux-gnu)
compiled by GNU C version 8.1.0, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/cuda-9.0.176-m4ivnigh5kuty6u7tcnroxr5on5lot6s/include
/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/subversion-1.9.7-f5fbcx4xhwzrq5rhhco7byj7cbx2f4fs/include
/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../include/c++/9.0.0
/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../include/c++/9.0.0/x86_64-pc-linux-gnu
/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../include/c++/9.0.0/backward
/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include
/usr/local/include
/home/over_ng/offload/install/include
/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
GNU C++14 (GCC) version 9.0.0 20180627 (experimental) (x86_64-pc-linux-gnu)
compiled by GNU C version 8.1.0, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 716ed3567afb9cd0b736d2b474553211
COLLECT_GCC_OPTIONS='-fopenmp' '-foffload=nvptx-none' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-pthread'
as -v --64 -o /tmp/cc2TYtU2.o /tmp/cc9FAd0p.s
GNU assembler version 2.26.1 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.26.1
COMPILER_PATH=/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/:/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/:/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/
LIBRARY_PATH=/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/cuda-9.0.176-m4ivnigh5kuty6u7tcnroxr5on5lot6s/lib64/../lib64/:/home/over_ng/offload/install/lib64/../lib64/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../lib64/:/lib/x86_64-linux-gnu/:/lib/../lib64/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib64/:/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/cuda-9.0.176-m4ivnigh5kuty6u7tcnroxr5on5lot6s/lib64/:/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/subversion-1.9.7-f5fbcx4xhwzrq5rhhco7byj7cbx2f4fs/lib/:/home/over_ng/offload/install/lib64/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../:/lib/:/usr/lib/
Reading specs from /home/over_ng/offload/install/lib64/../lib64/libgomp.spec
COLLECT_GCC_OPTIONS='-fopenmp' '-foffload=nvptx-none' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-pthread'
/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/collect2 -plugin /home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/liblto_plugin.so -plugin-opt=/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccnGrpRF.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/x86_64-linux-gnu/crt1.o /usr/lib/x86_64-linux-gnu/crti.o /home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/crtbegin.o /home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/crtoffloadbegin.o -L/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/cuda-9.0.176-m4ivnigh5kuty6u7tcnroxr5on5lot6s/lib64/../lib64 -L/home/over_ng/offload/install/lib64/../lib64 -L/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0 -L/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/cuda-9.0.176-m4ivnigh5kuty6u7tcnroxr5on5lot6s/lib64 -L/tools/spack/install/linux-ubuntu16.04-x86_64/gcc-5.4.0/subversion-1.9.7-f5fbcx4xhwzrq5rhhco7byj7cbx2f4fs/lib -L/home/over_ng/offload/install/lib64 -L/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../.. /tmp/cc2TYtU2.o -lstdc++ -lm -lgomp -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc /home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/crtend.o /usr/lib/x86_64-linux-gnu/crtn.o /home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/crtoffloadend.o
/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper -fresolution=/tmp/ccnGrpRF.res -flinker-output=exec -foffload-objects=/tmp/ccQDi0zV.ofldlist
/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0//accel/nvptx-none/mkoffload #/tmp/ccJAbpMz
offload/install/bin/x86_64-pc-linux-gnu-accel-nvptx-none-gcc #/tmp/ccoh8KPc
Using built-in specs.
COLLECT_GCC=offload/install/bin/x86_64-pc-linux-gnu-accel-nvptx-none-gcc
COLLECT_LTO_WRAPPER=/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/accel/nvptx-none/lto-wrapper
Target: nvptx-none
Configured with: ../gcc/configure --target=nvptx-none --with-build-time-tools=/home/over_ng/offload/install/nvptx-none/bin --enable-as-accelerator-for=x86_64-pc-linux-gnu --disable-sjlj-exceptions --enable-newlib-io-long-long --enable-languages=c,c++,fortran,lto --prefix=/home/over_ng/offload/install
Thread model: single
gcc version 9.0.0 20180627 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-v' '-m64' '-mgomp' '-v' '-fno-openacc' '-foffload-abi=lp64' '-fopenmp' '-o' '/tmp/ccNVxXFz.mkoffload'
/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/accel/nvptx-none/lto1 -quiet -dumpbase cc2TYtU2.o -m64 -mgomp -auxbase cc2TYtU2 -version -fno-openacc -foffload-abi=lp64 -fopenmp #/tmp/cchKIS8V -o /tmp/ccZLBhjz.s
GNU GIMPLE (GCC) version 9.0.0 20180627 (experimental) (nvptx-none)
compiled by GNU C version 8.1.0, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU GIMPLE (GCC) version 9.0.0 20180627 (experimental) (nvptx-none)
compiled by GNU C version 8.1.0, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
COLLECT_GCC_OPTIONS='-v' '-m64' '-mgomp' '-v' '-fno-openacc' '-foffload-abi=lp64' '-fopenmp' '-o' '/tmp/ccNVxXFz.mkoffload'
/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/accel/nvptx-none/../../../../../../nvptx-none/bin/as -o /tmp/ccRJFdvc.o /tmp/ccZLBhjz.s
COMPILER_PATH=/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/accel/nvptx-none/:/home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/accel/nvptx-none/:/home/over_ng/offload/install/libexec/gcc/nvptx-none/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/accel/nvptx-none/:/home/over_ng/offload/install/lib/gcc/nvptx-none/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/accel/nvptx-none/../../../../../../nvptx-none/bin/
LIBRARY_PATH=/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/accel/nvptx-none/mgomp/:/home/over_ng/offload/install/lib/gcc/x86_64-pc-linux-gnu/9.0.0/accel/nvptx-none/
Reading specs from libgomp.spec
x86_64-pc-linux-gnu-accel-nvptx-none-gcc: error: libgomp.spec: No such file or directory
mkoffload: fatal error: offload/install/bin/x86_64-pc-linux-gnu-accel-nvptx-none-gcc returned 1 exit status
compilation terminated.
lto-wrapper: fatal error: /home/over_ng/offload/install/libexec/gcc/x86_64-pc-linux-gnu/9.0.0//accel/nvptx-none/mkoffload returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
On the same webpage as where I found the script, somebody else reported the same problem and reverting to gcc 7.2 is apparently a solution. Since I want to include the off-loading compiler in the Spack collection, I would like to be able to use any supported version. Although I can live with gcc 8 for the time being, as 9/trunk is still experimental.
This may imply that it is a bug in gcc, in that case I would like to report it to them!
Edit 1: As requested, a 'sane' CPU only program that seems to work fine:
#include <omp.h>
#include <cmath>
#include <vector>
#include <iostream>
int main()
{
const int size = 1000;
std::vector<double> sinTable(size);
#pragma omp parallel for
for(int n=0; n<size; ++n)
{
sinTable[n] = std::sin(2 * M_PI * n / size);
std::cout << sinTable[n] << '\n';
}
// the table is now initialized
}
This was compiled with offload/install/bin/g++ -fopenmp -v main_cpu.cpp -o cpu
I have been using the package gcc-offload-nvptx in the Ubuntu repository since Ubuntu 17.10. If I compile your test code like this
g++ test.cpp -fopenmp
I get a lto-wrapper failed error. This can be fixed using -fno-stack-protector like this
g++ test.cpp -fopenmp -fno-stack-protector
Then test code compiles and runs. You can see that it runs on the GPU using nvprof like this
sudo nvprof ./a.out
Some additional comments. In your test code I would use
#pragma omp target teams distribute parallel for
See OpenMP offloading to Nvidia wrong reduction
Also in your test code you should do something with data_array or the compiler might optimize your code away.
Ubuntu 18.04 also requires -fno-stack-protector.
I'm trying to use mingw32 to compile an application for windows32. It has a makefile, and when I normally use ./configure, it works fine.
However, when I set the host as --host=i686-w64-mingw32, this happens:
checking build system type... x86_64-unknown-linux-gnu
checking host system type... i686-w64-mingw32
checking target system type... i686-w64-mingw32
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for i686-w64-mingw32-strip... i686-w64-mingw32-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking building for Win32... yes
checking for i686-w64-mingw32-gcc... i686-w64-mingw32-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether i686-w64-mingw32-gcc accepts -g... yes
checking for i686-w64-mingw32-gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of i686-w64-mingw32-gcc... gcc3
checking for i686-w64-mingw32-g++... i686-w64-mingw32-g++
checking whether we are using the GNU C++ compiler... yes
checking whether i686-w64-mingw32-g++ accepts -g... yes
checking dependency style of i686-w64-mingw32-g++... gcc3
checking for i686-w64-mingw32-ranlib... i686-w64-mingw32-ranlib
checking for sdl-config... /usr/bin/sdl-config
checking for SDL - version >= 1.2.8... cross compiling; assumed OK...
yes
checking for wx-config... /usr/bin/wx-config
checking for wxWidgets version >= 2.8.9... no
configure: error:
wxWidgets does not seem to be installed on your system.
If you think wxWidgets >= 2.8.9 is installed,
please check that wx-config is in path, the directory
where wxWidgets libraries are installed (returned by
'wx-config --libs' command) is in LD_LIBRARY_PATH or
equivalent variable.
What's causing this? As you can see from the successful ./configure, I have wxWidgets 3.0.2 installed. MinGW version 4.0.4-2 is installed. Do these versions work with each other? Obviously wxWidgets is configured and everything because it normally works. I can't figure out why it suddenly can't find wxwidgets just because the host is different.
Config.log file:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by sound-of-sorting configure 0.6.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure --host=i686-w64-mingw32 --with-wx-prefix=/usr/i686-w64-mingw32
## --------- ##
## Platform. ##
## --------- ##
hostname = JOHNCENA
uname -m = x86_64
uname -r = 4.4.0-43-Microsoft
uname -s = Linux
uname -v = #1-Microsoft Wed Dec 31 14:42:53 PST 2014
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
PATH: /usr/local/games
PATH: /mnt/c/ProgramData/Oracle/Java/javapath_target_3578562
PATH: /mnt/c/Windows/System32
PATH: /mnt/c/Windows
PATH: /mnt/c/Windows/System32/wbem
PATH: /mnt/c/Windows/System32/WindowsPowerShell/v1.0
PATH: /mnt/c/Windows/System32
PATH: /mnt/c/Windows
PATH: /mnt/c/Windows/System32/wbem
PATH: /mnt/c/Windows/System32/WindowsPowerShell/v1.0
PATH: /mnt/c/Program Files/Microsoft DNX/Dnvm
PATH: /mnt/c/Program Files/Microsoft SQL Server/110/Tools/Binn
PATH: /mnt/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit
PATH: /mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common
PATH: /mnt/c/Windows/System32
PATH: /mnt/c/Windows
PATH: /mnt/c/Windows/System32/wbem
PATH: /mnt/c/Windows/System32/WindowsPowerShell/v1.0
PATH: /mnt/c/Users/Bendy/AppData/Local/Microsoft/WindowsApps
PATH: /snap/bin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2067: checking build system type
configure:2081: result: x86_64-unknown-linux-gnu
configure:2101: checking host system type
configure:2114: result: i686-w64-mingw32
configure:2134: checking target system type
configure:2147: result: i686-w64-mingw32
configure:2190: checking for a BSD-compatible install
configure:2258: result: /usr/bin/install -c
configure:2269: checking whether build environment is sane
configure:2324: result: yes
configure:2383: checking for i686-w64-mingw32-strip
configure:2399: found /usr/bin/i686-w64-mingw32-strip
configure:2410: result: i686-w64-mingw32-strip
configure:2475: checking for a thread-safe mkdir -p
configure:2514: result: /bin/mkdir -p
configure:2521: checking for gawk
configure:2537: found /usr/bin/gawk
configure:2548: result: gawk
configure:2559: checking whether make sets $(MAKE)
configure:2581: result: yes
configure:2671: checking building for Win32
configure:2676: result: yes
configure:2730: checking for i686-w64-mingw32-gcc
configure:2746: found /usr/bin/i686-w64-mingw32-gcc
configure:2757: result: i686-w64-mingw32-gcc
configure:3026: checking for C compiler version
configure:3035: i686-w64-mingw32-gcc --version >&5
i686-w64-mingw32-gcc (GCC) 5.3.1 20160211
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:3046: $? = 0
configure:3035: i686-w64-mingw32-gcc -v >&5
Using built-in specs.
COLLECT_GCC=i686-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-w64-mingw32/5.3-win32/lto-wrapper
Target: i686-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' --mandir='/usr/share/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libexecdir='/usr/lib/gcc-mingw-w64' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-shared --enable-static --disable-multilib --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --libdir=/usr/lib --enable-libstdcxx-time=yes --with-tune=generic --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libgomp --enable-languages=c,c++,fortran,objc,obj-c++ --enable-lto --with-plugin-ld --enable-threads=win32 --program-suffix=-win32 --program-prefix=i686-w64-mingw32- --target=i686-w64-mingw32 --with-as=/usr/bin/i686-w64-mingw32-as --with-ld=/usr/bin/i686-w64-mingw32-ld --disable-libatomic
Thread model: win32
gcc version 5.3.1 20160211 (GCC)
configure:3046: $? = 0
configure:3035: i686-w64-mingw32-gcc -V >&5
i686-w64-mingw32-gcc: error: unrecognized command line option '-V'
i686-w64-mingw32-gcc: fatal error: no input files
compilation terminated.
configure:3046: $? = 1
configure:3035: i686-w64-mingw32-gcc -qversion >&5
i686-w64-mingw32-gcc: error: unrecognized command line option '-qversion'
i686-w64-mingw32-gcc: fatal error: no input files
compilation terminated.
configure:3046: $? = 1
configure:3066: checking whether the C compiler works
configure:3088: i686-w64-mingw32-gcc -g -Wno-unused-local-typedefs conftest.c >&5
configure:3092: $? = 0
configure:3140: result: yes
configure:3143: checking for C compiler default output file name
configure:3145: result: a.exe
configure:3151: checking for suffix of executables
configure:3158: i686-w64-mingw32-gcc -o conftest.exe -g -Wno-unused-local-typedefs conftest.c >&5
configure:3162: $? = 0
configure:3184: result: .exe
configure:3206: checking whether we are cross compiling
configure:3214: i686-w64-mingw32-gcc -o conftest.exe -g -Wno-unused-local-typedefs conftest.c >&5
configure:3218: $? = 0
configure:3225: ./conftest.exe
./conftest.exe: Invalid argument
configure:3229: $? = 1
configure:3244: result: yes
configure:3249: checking for suffix of object files
configure:3271: i686-w64-mingw32-gcc -c -g -Wno-unused-local-typedefs conftest.c >&5
configure:3275: $? = 0
configure:3296: result: o
configure:3300: checking whether we are using the GNU C compiler
configure:3319: i686-w64-mingw32-gcc -c -g -Wno-unused-local-typedefs conftest.c >&5
configure:3319: $? = 0
configure:3328: result: yes
configure:3337: checking whether i686-w64-mingw32-gcc accepts -g
configure:3357: i686-w64-mingw32-gcc -c -g conftest.c >&5
configure:3357: $? = 0
configure:3398: result: yes
configure:3415: checking for i686-w64-mingw32-gcc option to accept ISO C89
configure:3478: i686-w64-mingw32-gcc -c -g -Wno-unused-local-typedefs conftest.c >&5
configure:3478: $? = 0
configure:3491: result: none needed
configure:3522: checking for style of include used by make
configure:3550: result: GNU
configure:3576: checking dependency style of i686-w64-mingw32-gcc
configure:3687: result: gcc3
configure:3716: checking for i686-w64-mingw32-g++
configure:3732: found /usr/bin/i686-w64-mingw32-g++
configure:3743: result: i686-w64-mingw32-g++
configure:3814: checking for C++ compiler version
configure:3823: i686-w64-mingw32-g++ --version >&5
i686-w64-mingw32-g++ (GCC) 5.3.1 20160211
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:3834: $? = 0
configure:3823: i686-w64-mingw32-g++ -v >&5
Using built-in specs.
COLLECT_GCC=i686-w64-mingw32-g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-w64-mingw32/5.3-win32/lto-wrapper
Target: i686-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' --mandir='/usr/share/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libexecdir='/usr/lib/gcc-mingw-w64' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-shared --enable-static --disable-multilib --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --libdir=/usr/lib --enable-libstdcxx-time=yes --with-tune=generic --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libgomp --enable-languages=c,c++,fortran,objc,obj-c++ --enable-lto --with-plugin-ld --enable-threads=win32 --program-suffix=-win32 --program-prefix=i686-w64-mingw32- --target=i686-w64-mingw32 --with-as=/usr/bin/i686-w64-mingw32-as --with-ld=/usr/bin/i686-w64-mingw32-ld --disable-libatomic
Thread model: win32
gcc version 5.3.1 20160211 (GCC)
configure:3834: $? = 0
configure:3823: i686-w64-mingw32-g++ -V >&5
i686-w64-mingw32-g++: error: unrecognized command line option '-V'
i686-w64-mingw32-g++: fatal error: no input files
compilation terminated.
configure:3834: $? = 1
configure:3823: i686-w64-mingw32-g++ -qversion >&5
i686-w64-mingw32-g++: error: unrecognized command line option '-qversion'
i686-w64-mingw32-g++: fatal error: no input files
compilation terminated.
configure:3834: $? = 1
configure:3838: checking whether we are using the GNU C++ compiler
configure:3857: i686-w64-mingw32-g++ -c -g -Wno-unused-local-typedefs conftest.cpp >&5
configure:3857: $? = 0
configure:3866: result: yes
configure:3875: checking whether i686-w64-mingw32-g++ accepts -g
configure:3895: i686-w64-mingw32-g++ -c -g conftest.cpp >&5
configure:3895: $? = 0
configure:3936: result: yes
configure:3961: checking dependency style of i686-w64-mingw32-g++
configure:4072: result: gcc3
configure:4090: checking for i686-w64-mingw32-ranlib
configure:4106: found /usr/bin/i686-w64-mingw32-ranlib
configure:4117: result: i686-w64-mingw32-ranlib
configure:4234: checking for sdl-config
configure:4252: found /usr/bin/sdl-config
configure:4265: result: /usr/bin/sdl-config
configure:4275: checking for SDL - version >= 1.2.8
configure:4377: result: yes
configure:4513: checking for wx-config
configure:4532: found /usr/i686-w64-mingw32/bin/wx-config
configure:4545: result: /usr/i686-w64-mingw32/bin/wx-config
configure:4560: checking for wxWidgets version >= 2.8.9
configure:4675: result: no
configure:4749: error:
wxWidgets does not seem to be installed on your system.
If you think wxWidgets >= 2.8.9 is installed,
please check that wx-config is in path, the directory
where wxWidgets libraries are installed (returned by
'wx-config --libs' command) is in LD_LIBRARY_PATH or
equivalent variable.
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_build=x86_64-unknown-linux-gnu
ac_cv_c_compiler_gnu=yes
ac_cv_cxx_compiler_gnu=yes
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=i686-w64-mingw32
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_exeext=.exe
ac_cv_host=i686-w64-mingw32
ac_cv_objext=o
ac_cv_path_SDL_CONFIG=/usr/bin/sdl-config
ac_cv_path_WX_CONFIG_PATH=/usr/i686-w64-mingw32/bin/wx-config
ac_cv_path_install='/usr/bin/install -c'
ac_cv_path_mkdir=/bin/mkdir
ac_cv_prog_AWK=gawk
ac_cv_prog_CC=i686-w64-mingw32-gcc
ac_cv_prog_CXX=i686-w64-mingw32-g++
ac_cv_prog_RANLIB=i686-w64-mingw32-ranlib
ac_cv_prog_STRIP=i686-w64-mingw32-strip
ac_cv_prog_cc_c89=
ac_cv_prog_cc_g=yes
ac_cv_prog_cxx_g=yes
ac_cv_prog_make_make_set=yes
ac_cv_target=i686-w64-mingw32
am_cv_CC_dependencies_compiler_type=gcc3
am_cv_CXX_dependencies_compiler_type=gcc3
## ----------------- ##
## Output variables. ##
## ----------------- ##
ACLOCAL='${SHELL} /home/sound-of-sorting-master/sound-of-sorting-master/acscripts/missing --run aclocal-1.12'
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='$${TAR-tar}'
AUTOCONF='${SHELL} /home/sound-of-sorting-master/sound-of-sorting-master/acscripts/missing --run autoconf'
AUTOHEADER='${SHELL} /home/sound-of-sorting-master/sound-of-sorting-master/acscripts/missing --run autoheader'
AUTOMAKE='${SHELL} /home/sound-of-sorting-master/sound-of-sorting-master/acscripts/missing --run automake-1.12'
AWK='gawk'
CC='i686-w64-mingw32-gcc'
CCDEPMODE='depmode=gcc3'
CFLAGS='-g -Wno-unused-local-typedefs'
CPPFLAGS=''
CXX='i686-w64-mingw32-g++'
CXXDEPMODE='depmode=gcc3'
CXXFLAGS='-g -Wno-unused-local-typedefs'
CYGPATH_W='echo'
DEFS=''
DEPDIR='.deps'
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EXEEXT='.exe'
GOT_RESCOMP_FALSE=''
GOT_RESCOMP_TRUE=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LDFLAGS=''
LIBOBJS=''
LIBS=''
LTLIBOBJS=''
MAKEINFO='${SHELL} /home/sound-of-sorting-master/sound-of-sorting-master/acscripts/missing --run makeinfo'
MKDIR_P='/bin/mkdir -p'
OBJEXT='o'
ON_WIN32_FALSE='#'
ON_WIN32_TRUE=''
PACKAGE='sound-of-sorting'
PACKAGE_BUGREPORT=''
PACKAGE_NAME='sound-of-sorting'
PACKAGE_STRING='sound-of-sorting 0.6.5'
PACKAGE_TARNAME='sound-of-sorting'
PACKAGE_URL=''
PACKAGE_VERSION='0.6.5'
PATH_SEPARATOR=':'
RANLIB='i686-w64-mingw32-ranlib'
SDL_CFLAGS='-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT'
SDL_CONFIG='/usr/bin/sdl-config'
SDL_LIBS='-L/usr/lib/x86_64-linux-gnu -lSDL'
SET_MAKE=''
SHELL='/bin/bash'
STRIP='i686-w64-mingw32-strip'
VERSION='0.6.5'
WX_CFLAGS=''
WX_CFLAGS_ONLY=''
WX_CONFIG_PATH='/usr/i686-w64-mingw32/bin/wx-config'
WX_CPPFLAGS=''
WX_CXXFLAGS=''
WX_CXXFLAGS_ONLY=''
WX_LIBS=''
WX_LIBS_STATIC=''
WX_RESCOMP=''
WX_VERSION=''
WX_VERSION_MAJOR=''
WX_VERSION_MICRO=''
WX_VERSION_MINOR=''
ac_ct_CC=''
ac_ct_CXX=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCC_FALSE='#'
am__fastdepCC_TRUE=''
am__fastdepCXX_FALSE='#'
am__fastdepCXX_TRUE=''
am__include='include'
am__isrc=''
am__leading_dot='.'
am__nodep='_no'
am__quote=''
am__tar='$${TAR-tar} chof - "$$tardir"'
am__untar='$${TAR-tar} xf -'
bindir='${exec_prefix}/bin'
build='x86_64-unknown-linux-gnu'
build_alias=''
build_cpu='x86_64'
build_os='linux-gnu'
build_vendor='unknown'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host='i686-w64-mingw32'
host_alias='i686-w64-mingw32'
host_cpu='i686'
host_os='mingw32'
host_vendor='w64'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /home/sound-of-sorting-master/sound-of-sorting-master/acscripts/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='$(MKDIR_P)'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
runstatedir='${localstatedir}/run'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target='i686-w64-mingw32'
target_alias=''
target_cpu='i686'
target_os='mingw32'
target_vendor='w64'
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME "sound-of-sorting"
#define PACKAGE_TARNAME "sound-of-sorting"
#define PACKAGE_VERSION "0.6.5"
#define PACKAGE_STRING "sound-of-sorting 0.6.5"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define PACKAGE "sound-of-sorting"
#define VERSION "0.6.5"
configure: exit 1
You're trying to cross-compile from Linux to Windows. For this to work, you need a Windows version of wxWidgets and not the native Linux one which is found in your first example.
Do you actually want to cross-compile? Your phrase about "just because the host is different" leaves a doubt about whether you actually do it intentionally.
My environment is
Windows 10
Cygwin64
g++ 5.2.0
The following program works as expected (main executes without error, returns 0)
#include <iostream>
#include <string>
using namespace std;
//#define USE_STRING 1
int
main(int argc, char *argv[])
{
cout << "begin " << endl;
#ifdef USE_STRING
string w("fish");
#endif
cout << "blah " << endl;
return 0;
}
but if I uncomment the #define USE_STRING the program crashes before it can even hit a breakpoint in main.
Here is how I compiled:
g++ -ggdb -v my_string.cc -o my_string
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-5.2.0-1.x86_64/src/gcc-5.2.0/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-5.2. 0-1.x86_64/src/gcc-5.2.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --ht mldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-pr efix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-speci fic-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran, lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm --enable-libquadma th --enable-libquadmath-support --enable-libssp --enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers --wi th-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-pre fix --without-libintl-prefix --with-system-zlib --enable-linker-build-id
Thread model: posix
gcc version 5.2.0 (GCC)
COLLECT_GCC_OPTIONS='-ggdb' '-v' '-o' 'my_string.exe' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/cc1plus.exe -quiet -v -iprefix /bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/ -Dunix -idirafter /usr/lib/../lib/../include/w32api -idirafter ../../include/w32api my_string.cc -quiet -dumpbase my_string.cc -mtune=generic -marc h=x86-64 -auxbase my_string -ggdb -version -o /tmp/cc6aWK4I.s
GNU C++ (GCC) version 5.2.0 (x86_64-pc-cygwin)
compiled by GNU C version 5.2.0, GMP version 6.0.0, MPFR version 3.1.3, MPC version 1.0.3
warning: GMP header version 6.0.0 differs from library version 6.1.0.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/../../../../x86_64-pc-cygwin/include"
ignoring duplicate directory "/bin/../lib/gcc/../../lib/gcc/x86_64-pc-cygwin/5.2.0/include/c++"
ignoring duplicate directory "/bin/../lib/gcc/../../lib/gcc/x86_64-pc-cygwin/5.2.0/include/c++/x86_64-pc-cygwin"
ignoring duplicate directory "/bin/../lib/gcc/../../lib/gcc/x86_64-pc-cygwin/5.2.0/include/c++/backward"
ignoring duplicate directory "/bin/../lib/gcc/../../lib/gcc/x86_64-pc-cygwin/5.2.0/include"
ignoring nonexistent directory "/usr/local/include"
ignoring duplicate directory "/bin/../lib/gcc/../../lib/gcc/x86_64-pc-cygwin/5.2.0/include-fixed"
ignoring nonexistent directory "/bin/../lib/gcc/../../lib/gcc/x86_64-pc-cygwin/5.2.0/../../../../x86_64-pc-cygwin/include"
ignoring nonexistent directory "../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/include/c++
/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/include/c++/x86_64-pc-cygwin
/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/include/c++/backward
/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/include
/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/include-fixed
/usr/include
/usr/lib/../lib/../include/w32api
End of search list.
GNU C++ (GCC) version 5.2.0 (x86_64-pc-cygwin)
compiled by GNU C version 5.2.0, GMP version 6.0.0, MPFR version 3.1.3, MPC version 1.0.3
warning: GMP header version 6.0.0 differs from library version 6.1.0.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 594d57f36425b84b161aac261544e04e
COLLECT_GCC_OPTIONS='-ggdb' '-v' '-o' 'my_string.exe' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
as -v -o /tmp/ccEdjvZ0.o /tmp/cc6aWK4I.s
GNU assembler version 2.25.2 (x86_64-pc-cygwin) using BFD version (GNU Binutils) 2.25.2
COMPILER_PATH=/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/:/bin/../lib/gcc/
LIBRARY_PATH=/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/:/bin/../lib/gcc/:/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/../../../../lib/:/li b/../lib/:/usr/lib/../lib/:/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-ggdb' '-v' '-o' 'my_string.exe' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/collect2.exe -plugin /bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/cyglto_plugin.dll -plugin-opt =/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/lto-wrapper.exe -plugin-opt=-fresolution=/tmp/cc6lfDyO.res -plugin-opt=-pass-through=-lgc c_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lcygwin -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-thr ough=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lgcc_s -plugin- opt=-pass-through=-lgcc --build-id -m i386pep --wrap _Znwm --wrap _Znam --wrap _ZdlPv --wrap _ZdaPv --wrap _ZnwmRKSt9nothrow_t -- wrap _ZnamRKSt9nothrow_t --wrap _ZdlPvRKSt9nothrow_t --wrap _ZdaPvRKSt9nothrow_t -Bdynamic --dll-search-prefix=cyg --tsaware -o m y_string.exe -L/usr/lib/w32api /bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/../../../../lib/crt0.o /bin/../lib/gcc/x86_64-pc-cygwin/5.2 .0/crtbegin.o -L/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0 -L/bin/../lib/gcc -L/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/../../.. /tmp/ccEdjvZ0.o -lstdc++ -lgcc_s -lgcc -lcygwi n -ladvapi32 -lshell32 -luser32 -lkernel32 -lgcc_s -lgcc /bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/../../../../lib/default-manifest. o /bin/../lib/gcc/x86_64-pc-cygwin/5.2.0/crtend.o
and the failure case in gdb looks like this:
$ gdb ./my_string
GNU gdb (GDB) Cygwin 7.9.1-1
Copyright (C) 2015 Free Software Foundation, Inc.
...
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./my_string...done.
(gdb) b main
Breakpoint 1 at 0x1004010fa: file my_string.cc, line 10.
(gdb) run
Starting program: /home/Admin/progs/c++/word_bubbles/my_string
[New Thread 107280.0x1a15c]
[New Thread 107280.0x1a2ac]
[New Thread 107280.0x1a050]
[New Thread 107280.0x1a3f4]
[Thread 107280.0x1a3f4 exited with code 3221225785]
[Thread 107280.0x1a2ac exited with code 3221225785]
[Thread 107280.0x1a050 exited with code 3221225785]
During startup program exited with code 0xc0000139.
(gdb)
and lastly dynamic linkage looks like this:
$ ldd my_string
ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x7ffef9820000)
KERNEL32.DLL => /cygdrive/c/Windows/system32/KERNEL32.DLL (0x7ffef9370000)
KERNELBASE.dll => /cygdrive/c/Windows/system32/KERNELBASE.dll (0x7ffef6d10000)
I know the compiler output is a bit verbose but I'm trying to provide everything that might be needed to diagnose the problem.
EDIT 1: per suggestion, here is strace output:
$ strace ./my_string.exe
--- Process 105768 created
--- Process 105768 loaded C:\Windows\System32\ntdll.dll at 00007FFEF9820000
--- Process 105768 loaded C:\Windows\System32\kernel32.dll at 00007FFEF9370000
--- Process 105768 loaded C:\Windows\System32\KernelBase.dll at 00007FFEF6D10000
--- Process 105768 thread 107956 created
--- Process 105768 thread 56196 created
--- Process 105768 thread 92192 created
--- Process 105768 loaded E:\cygwin64\bin\cyggcc_s-seh-1.dll at 00000003F4260000
--- Process 105768 loaded E:\cygwin64\bin\cygstdc++-6.dll at 00000003EDF70000
--- Process 105768 loaded E:\cygwin64\bin\cygwin1.dll at 0000000180040000
--- Process 105768, exception c0000139 at 00007FFEF98B2F50
--- Process 105768 thread 92192 exited with status 0xc0000139
--- Process 105768 thread 105388 exited with status 0xc0000139
--- Process 105768 thread 56196 exited with status 0xc0000139
--- Process 105768 exited with status 0xc0000139
The process exception seems to be in one of the Windows DLL address ranges (ntdll.dll)?
EDIT 2: with strace, the following error message window pops up
my_string.exe entry point not found
The entry point
_ZNSt7__cxx1112basic_stringlcSt11char_traitslcESalcEEC1EPKcRKS3_ could
not be located in the dynamic link library.
I have the Anaconda Python distribution installed and, in the successful program strace, I saw some lines with Anaconda paths so I temporarily renamed the Anaconda directory to ensure that recompiling & rerunning wouldn't find Anaconda but that had no effect.
I am trying to build gcc 5.2.0 from source in my local $HOME directory and I get the following errors:
gcc-gcc_5_2_0_release> ./configure --prefix=$HOME/usr/local
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for gawk... gawk
checking for libatomic support... yes
checking for libcilkrts support... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... yes
checking for gcc... gcc
checking for C compiler default output file name...
configure: error: in `/home/s31941/tmp/gcc-gcc_5_2_0_release':
configure: error: C compiler cannot create executables
See `config.log' for more details.
here is a copy of the config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.64. Invocation command line was
$ ./configure --prefix=/home/username/usr/local
## --------- ##
## Platform. ##
## --------- ##
hostname = fmsserv
uname -m = x86_64
uname -r = 3.0.101-0.46-default
uname -s = Linux
uname -v = #1 SMP Wed Dec 17 11:04:10 UTC 2014 (8356111)
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = x86_64
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /home/username/usr/local/bin
PATH: /home/username/tools/git/bin
PATH: /home/username/tools/java/jre1.8.0_40/bin
PATH: /home/username/tools/eclipse
PATH: .
PATH: /usr/NX/bin
PATH: /usr/lib64/mpi/gcc/openmpi/bin
PATH: /home/username/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/bin/X11
PATH: /usr/X11R6/bin
PATH: /usr/games
PATH: /opt/kde3/bin
PATH: /usr/lib/mit/bin
PATH: /usr/lib/mit/sbin
PATH: /opt/gnome/bin
PATH: /usr/lib/qt3/bin
PATH: /home/fms/bin
PATH: /usr/gnat/bin
PATH: .
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2292: checking build system type
configure:2306: result: x86_64-unknown-linux-gnu
configure:2353: checking host system type
configure:2366: result: x86_64-unknown-linux-gnu
configure:2386: checking target system type
configure:2399: result: x86_64-unknown-linux-gnu
configure:2453: checking for a BSD-compatible install
configure:2521: result: /usr/bin/install -c
configure:2532: checking whether ln works
configure:2554: result: yes
configure:2558: checking whether ln -s works
configure:2562: result: yes
configure:2569: checking for a sed that does not truncate output
configure:2633: result: /usr/bin/sed
configure:2642: checking for gawk
configure:2658: found /usr/bin/gawk
configure:2669: result: gawk
configure:3183: checking for libatomic support
configure:3193: result: yes
configure:3202: checking for libcilkrts support
configure:3212: result: yes
configure:3240: checking for libitm support
configure:3250: result: yes
configure:3259: checking for libsanitizer support
configure:3269: result: yes
configure:3278: checking for libvtv support
configure:3288: result: yes
configure:4074: checking for gcc
configure:4090: found /usr/bin/gcc
configure:4101: result: gcc
configure:4330: checking for C compiler version
configure:4339: gcc --version >&5
gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973]
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:4350: $? = 0
configure:4339: gcc -v >&5
Using built-in specs.
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.3 --enable-ssp --disable-libssp --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --program-suffix=-4.3 --enable-linux-futex --without-system-libunwind --with-cpu=generic --build=x86_64-suse-linux
Thread model: posix
gcc version 4.3.4 [gcc-4_3-branch revision 152973] (SUSE Linux)
configure:4350: $? = 0
configure:4339: gcc -V >&5
gcc: '-V' option must have argument
configure:4350: $? = 1
configure:4339: gcc -qversion >&5
gcc: unrecognized option '-qversion'
gcc: no input files
configure:4350: $? = 1
configure:4370: checking for C compiler default output file name
configure:4392: gcc conftest.c >&5
gcc: error trying to exec 'cc1': execvp: No such file or directory
configure:4396: $? = 1
configure:4433: result:
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:4439: error: in `/home/username/tmp/gcc-gcc_5_2_0_release':
configure:4443: error: C compiler cannot create executables
See `config.log' for more details.
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_build=x86_64-unknown-linux-gnu
ac_cv_env_AR_FOR_TARGET_set=
ac_cv_env_AR_FOR_TARGET_value=
ac_cv_env_AR_set=
ac_cv_env_AR_value=
ac_cv_env_AS_FOR_TARGET_set=
ac_cv_env_AS_FOR_TARGET_value=
ac_cv_env_AS_set=
ac_cv_env_AS_value=
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_FOR_TARGET_set=
ac_cv_env_CC_FOR_TARGET_value=
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_FOR_TARGET_set=
ac_cv_env_CXX_FOR_TARGET_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_DLLTOOL_FOR_TARGET_set=
ac_cv_env_DLLTOOL_FOR_TARGET_value=
ac_cv_env_DLLTOOL_set=
ac_cv_env_DLLTOOL_value=
ac_cv_env_GCC_FOR_TARGET_set=
ac_cv_env_GCC_FOR_TARGET_value=
ac_cv_env_GCJ_FOR_TARGET_set=
ac_cv_env_GCJ_FOR_TARGET_value=
ac_cv_env_GFORTRAN_FOR_TARGET_set=
ac_cv_env_GFORTRAN_FOR_TARGET_value=
ac_cv_env_GOC_FOR_TARGET_set=
ac_cv_env_GOC_FOR_TARGET_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LD_FOR_TARGET_set=
ac_cv_env_LD_FOR_TARGET_value=
ac_cv_env_LD_set=
ac_cv_env_LD_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_LIPO_FOR_TARGET_set=
ac_cv_env_LIPO_FOR_TARGET_value=
ac_cv_env_LIPO_set=
ac_cv_env_LIPO_value=
ac_cv_env_NM_FOR_TARGET_set=
ac_cv_env_NM_FOR_TARGET_value=
ac_cv_env_NM_set=
ac_cv_env_NM_value=
ac_cv_env_OBJCOPY_FOR_TARGET_set=
ac_cv_env_OBJCOPY_FOR_TARGET_value=
ac_cv_env_OBJCOPY_set=
ac_cv_env_OBJCOPY_value=
ac_cv_env_OBJDUMP_FOR_TARGET_set=
ac_cv_env_OBJDUMP_FOR_TARGET_value=
ac_cv_env_OBJDUMP_set=
ac_cv_env_OBJDUMP_value=
ac_cv_env_RANLIB_FOR_TARGET_set=
ac_cv_env_RANLIB_FOR_TARGET_value=
ac_cv_env_RANLIB_set=
ac_cv_env_RANLIB_value=
ac_cv_env_READELF_FOR_TARGET_set=
ac_cv_env_READELF_FOR_TARGET_value=
ac_cv_env_READELF_set=
ac_cv_env_READELF_value=
ac_cv_env_STRIP_FOR_TARGET_set=
ac_cv_env_STRIP_FOR_TARGET_value=
ac_cv_env_STRIP_set=
ac_cv_env_STRIP_value=
ac_cv_env_WINDMC_FOR_TARGET_set=
ac_cv_env_WINDMC_FOR_TARGET_value=
ac_cv_env_WINDMC_set=
ac_cv_env_WINDMC_value=
ac_cv_env_WINDRES_FOR_TARGET_set=
ac_cv_env_WINDRES_FOR_TARGET_value=
ac_cv_env_WINDRES_set=
ac_cv_env_WINDRES_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_build_configargs_set=
ac_cv_env_build_configargs_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_host_configargs_set=
ac_cv_env_host_configargs_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_env_target_configargs_set=
ac_cv_env_target_configargs_value=
ac_cv_host=x86_64-unknown-linux-gnu
ac_cv_path_SED=/usr/bin/sed
ac_cv_path_install='/usr/bin/install -c'
ac_cv_prog_AWK=gawk
ac_cv_prog_ac_ct_CC=gcc
ac_cv_target=x86_64-unknown-linux-gnu
acx_cv_prog_LN=ln
## ----------------- ##
## Output variables. ##
## ----------------- ##
AR=''
AR_FOR_BUILD='$(AR)'
AR_FOR_TARGET=''
AS=''
AS_FOR_BUILD='$(AS)'
AS_FOR_TARGET=''
AWK='gawk'
BISON=''
BUILD_CONFIG=''
CC='gcc'
CC_FOR_BUILD='$(CC)'
CC_FOR_TARGET=''
CFLAGS=''
CFLAGS_FOR_BUILD=''
CFLAGS_FOR_TARGET=''
COMPILER_AS_FOR_TARGET=''
COMPILER_LD_FOR_TARGET=''
COMPILER_NM_FOR_TARGET=''
CONFIGURE_GDB_TK=''
CPPFLAGS=''
CXX=''
CXXFLAGS=''
CXXFLAGS_FOR_BUILD=''
CXXFLAGS_FOR_TARGET=''
CXX_FOR_BUILD='$(CXX)'
CXX_FOR_TARGET=''
DEBUG_PREFIX_CFLAGS_FOR_TARGET=''
DEFS=''
DLLTOOL=''
DLLTOOL_FOR_BUILD='$(DLLTOOL)'
DLLTOOL_FOR_TARGET=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EXEEXT=''
EXPECT=''
EXTRA_CONFIGARGS_LIBJAVA='--disable-static'
FLAGS_FOR_TARGET=''
FLEX=''
GCC_FOR_TARGET=''
GCC_SHLIB_SUBDIR=''
GCJ_FOR_BUILD='$(GCJ)'
GCJ_FOR_TARGET=''
GDB_TK=''
GFORTRAN_FOR_BUILD='$(GFORTRAN)'
GFORTRAN_FOR_TARGET=''
GNATBIND=''
GNATMAKE=''
GOC_FOR_BUILD='$(GOC)'
GOC_FOR_TARGET=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_GDB_TK=''
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
LD=''
LDFLAGS=''
LDFLAGS_FOR_BUILD=''
LDFLAGS_FOR_TARGET=''
LD_FOR_BUILD='$(LD)'
LD_FOR_TARGET=''
LEX=''
LIBOBJS=''
LIBS=''
LIPO=''
LIPO_FOR_TARGET=''
LN='ln'
LN_S='ln -s'
LTLIBOBJS=''
M4=''
MAINT=''
MAINTAINER_MODE_FALSE=''
MAINTAINER_MODE_TRUE=''
MAKEINFO=''
NM=''
NM_FOR_BUILD='$(NM)'
NM_FOR_TARGET=''
OBJCOPY=''
OBJCOPY_FOR_TARGET=''
OBJDUMP=''
OBJDUMP_FOR_TARGET=''
OBJEXT=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
RANLIB=''
RANLIB_FOR_BUILD='$(RANLIB)'
RANLIB_FOR_TARGET=''
RAW_CXX_FOR_TARGET=''
READELF=''
READELF_FOR_TARGET=''
RPATH_ENVVAR=''
RUNTEST=''
SED='/usr/bin/sed'
SHELL='/bin/sh'
STRIP=''
STRIP_FOR_TARGET=''
SYSROOT_CFLAGS_FOR_TARGET=''
TOPLEVEL_CONFIGURE_ARGUMENTS='./configure --prefix=/home/username/usr/local'
WINDMC=''
WINDMC_FOR_BUILD='$(WINDMC)'
WINDMC_FOR_TARGET=''
WINDRES=''
WINDRES_FOR_BUILD='$(WINDRES)'
WINDRES_FOR_TARGET=''
YACC=''
ac_ct_CC='gcc'
ac_ct_CXX=''
bindir='${exec_prefix}/bin'
build='x86_64-unknown-linux-gnu'
build_alias=''
build_configargs=''
build_configdirs='build-libiberty build-libcpp build-texinfo build-flex build-bison build-m4 build-fixincludes'
build_cpu='x86_64'
build_libsubdir='build-x86_64-unknown-linux-gnu'
build_noncanonical='x86_64-unknown-linux-gnu'
build_os='linux-gnu'
build_subdir='build-x86_64-unknown-linux-gnu'
build_tooldir=''
build_vendor='unknown'
compare_exclusions=''
configdirs='intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libdecnumber gmp mpfr mpc isl libelf libiconv texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
do_compare=''
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec_prefix='NONE'
extra_host_libiberty_configure_flags=''
extra_isl_gmp_configure_flags=''
extra_liboffloadmic_configure_flags=''
extra_linker_plugin_configure_flags=''
extra_linker_plugin_flags=''
extra_mpc_gmp_configure_flags=''
extra_mpc_mpfr_configure_flags=''
extra_mpfr_configure_flags=''
gmpinc=''
gmplibs=''
host='x86_64-unknown-linux-gnu'
host_alias=''
host_configargs=''
host_cpu='x86_64'
host_noncanonical='x86_64-unknown-linux-gnu'
host_os='linux-gnu'
host_shared=''
host_subdir='host-x86_64-unknown-linux-gnu'
host_vendor='unknown'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
islinc=''
isllibs=''
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
poststage1_ldflags=''
poststage1_libs=''
prefix='/home/username/usr/local'
program_transform_name='s,y,y,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
stage1_cflags=''
stage1_checking=''
stage1_languages=''
stage1_ldflags=''
stage1_libs=''
stage2_werror_flag=''
sysconfdir='${prefix}/etc'
target='x86_64-unknown-linux-gnu'
target_alias=''
target_configargs=''
target_configdirs='target-libgcc target-libbacktrace target-libgloss target-newlib target-libgomp target-libcilkrts target-liboffloadmic target-libatomic target-libitm target-libstdc++-v3 target-libsanitizer target-libvtv target-libmpx target-libssp target-libquadmath target-libgfortran target-boehm-gc target-libffi target-zlib target-libjava target-libobjc target-libada target-libgo target-rda'
target_cpu='x86_64'
target_noncanonical='x86_64-unknown-linux-gnu'
target_os='linux-gnu'
target_subdir='x86_64-unknown-linux-gnu'
target_vendor='unknown'
tooldir=''
## ------------------- ##
## File substitutions. ##
## ------------------- ##
alphaieee_frag=''
host_makefile_frag='/dev/null'
ospace_frag=''
serialization_dependencies=''
target_makefile_frag=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
configure: exit 77
Any help determining whats wrong would be greatly appreciated.
gcc-gcc_5_2_0_release> which ld
/usr/bin/ld
gcc-gcc_5_2_0_release> which gcc
/usr/bin/gcc
gcc-gcc_5_2_0_release> ld --version
GNU ld (GNU Binutils; SUSE Linux Enterprise 11) 2.23.1
Copyright 2012 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
gcc-gcc_5_2_0_release> gcc --version
gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973]
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
First, it is documented that GCC should not be built inside its source tree:
First, we highly recommend that GCC be built into a separate directory from the sources which does not reside within the source tree.
Then you need to be sure that the prefix tree exists. I believe that your choice $HOME/usr/local/ is a poor one (it is confusing). I suggest using $HOME/soft/ instead.
If you have a Debian or similar distribution, be sure to aptitude install build-dep gcc g++ before configuring (You might need some deb-src line in your /etc/apt/sources.list file). This will download all the software required to build GCC. Don't forget to aptitude install gcc g++ build-essential in all cases (to have a working gcc & g++ system compilers). On SUSE, try to find the equivalent packages and commands: gcc-c++ package, build service.
So I suggest to start again. Use
mkdir -p -$HOME/tmp/softbuilds
mkdir -p $HOME/soft/
cd $HOME/tmp/
## the following URL is not the best one, choose carefully the server
wget http://open-source-box.org/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2
cd softbuilds
tar xvf ../gcc-5.2.0.tar.bz2
mkdir _GCC-5.2_Build
cd _GCC-5.2_Build
../gcc-5.2.0/configure --help
## you could add some other configure options here:
../gcc-5.2.0/configure --prefix=$HOME/soft --program-suffix=-mine \
--enable-plugins --enable-languages=c,c++,jit,lto,go \
--enable-check=release --enable-host-shared
If the configuration step succeeded, you compile the thing with
make -j 3
Then (perhaps a few hours later) install it with:
make #to be sure all went ok
make install
Then add $HOME/soft/bin/ to your PATH (e.g. by editing .bashrc ...) and use gcc-mine as your compiler (e.g. make CC=gcc-mine)
If you want to always use your GCC, and if $HOME/bin/ is early in your $PATH, you might make symlinks from $HOME/soft/bin/gcc-mine to $HOME/bin/gcc (and likewise for g++-mine ...).
BTW, you could later install the MELT meta-plugin for your GCC. I have released MELT 1.2.0 for GCC 4.9 & 5.x a few days ago (end of july 2015).
configure:4370: checking for C compiler default output file name
configure:4392: gcc conftest.c >&5
gcc: error trying to exec 'cc1': execvp: No such file or directory
This indicates that your host compiler isn't working. Make sure it works before attempting to configure other software.
Whether it's caused by a missing package on your system, some environment variable you set that messes with the way GCC works, or perhaps even some local filesystem corruption, you'll see the same problem just compiling a simple "Hello, world!" program from the command line.
Fix that first, and only then start trying to build larger software packages.