I'm using GCC v4.9.2 under Cygwin on Windows 7 64-bit, but running into an issue trying to compile uWSGI.
The error I'm receiving is -
gcc: error: unrecognized command line option ‘-rdynamic’
GCC version output -
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-4.9.2-3.x86_64/src/gcc-4.9.2/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-4.9.2-3.x86_64/src/gcc-4.9.2 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --libdir=/usr/lib --datarootdir=/usr/share --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-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-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id
Thread model: posix
gcc version 4.9.2 (GCC)
I'm invoking the build with CFLAGS="-Wno-error" make.
I'm not sure why I'm getting this error as I can see in the documentation from here that flag -rdynamic exists.
What am I missing?
I think I've got it...
Here's what happens on my laptop (Cygwin 2.831 (pc032) on Win7 (pc064)):
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-cygwin/4.8.2/lto-wrapper.exe
Target: i686-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.2-1/src/gcc-4.8.2/configure --srcdir=/cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.2-1/src/gcc-4.8.2 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --libdir=/usr/lib --datarootdir=/usr/share --docdir=/usr/share/doc/gcc -C --build=i686-pc-cygwin --host=i686-pc-cygwin --target=i686-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --disable-__cxa_atexit --with-dwarf2 --with-arch=i686 --with-tune=generic --disable-sjlj-exceptions --enable-languages=ada,c,c++,fortran,java,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libjava --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib
Thread model: posix
gcc version 4.8.2 (GCC)
When I pass -rdynamic:
gcc -rdynamic
gcc: fatal error: no input files
compilation terminated.
Compared to -rdynamic1:
gcc -rdynamic1
gcc: error: unrecognized command line option ‘-rdynamic1’
gcc: fatal error: no input files
compilation terminated.
[Man7]: GCC(1) mentions it (I'm not sure how relevant is that), but gcc -v --help doesn't display it under the linker specific options.
I thought that maybe something is different about how the GCCs are configured, but I didn't see any difference that would matter (both have --with-gnu-ld - which seems related - specified).
Then I downloaded v4.8.2 and v4.9.2 sources and start searching and comparing, but again I couldn't find anything (it's true, the search could be widely extended).
But while browsing the configure file, I noticed something that could be related, then I checked the ld command line options and I think I have an alternative:
Instead of -rdynamic, you could pass -Wl,--export-all-symbols. That works for me (that's not very relevant since -rdynamic also works for me, unlike in your case :) ).
The link you give says:
-rdynamic
Pass the flag -export-dynamic to the ELF linker, on targets that support it. This instructs the linker to add all symbols, not only used ones, to the dynamic symbol table. This option is needed for some uses of dlopen or to allow obtaining backtraces from within a program.
(Emphasis added.)
Is Cygwin using ELF format object files? It seems unlikely.
Related
Recently I got an NXP imx8 board. And I want to test my programme. But it didn't work on imx8.
When I use aarch64-poky-linux-gcc
$ source /opt/fsl-imx-internal-xwayland/5.15-kirkstone/environment-setup-armv8a-poky-linux
$ aarch64-poky-linux-gcc -o hello hello.c
In file included from hello.c:1:
/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/lib/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory
27 | #include <bits/libc-header-start.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
when I use ${CC}
$ source /opt/fsl-imx-internal-xwayland/5.15-kirkstone/environment-setup-armv8a-poky-linux
${CC} -o hello hello.c # it can work
So I want to know the reason.
And I do this thing:
$ echo 'main(){}'|aarch64-poky-linux-gcc -E -v -
Using built-in specs.
COLLECT_GCC=aarch64-poky-linux-gcc
Target: aarch64-poky-linux
Configured with: ../../../../../../work-shared/gcc-11.2.0-r0/gcc-11.2.0/configure --build=x86_64-linux --host=x86_64-pokysdk-linux --target=aarch64-poky-linux --prefix=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr --exec_prefix=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr --bindir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux --sbindir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux --libexecdir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux --datadir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/share --sysconfdir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/etc --sharedstatedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/com --localstatedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/var --libdir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/aarch64-poky-linux --includedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/include --oldincludedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/include --infodir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/share/info --mandir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/home/bamboo/build/5.15-kirkstone-full/fsl-imx-internal-xwayland/mx8m/yocto/build/tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-aarch64/11.2.0-r0/recipe-sysroot --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-default-pie --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=aarch64-poky-linux- --without-local-prefix --disable-install-libiberty --disable-libssp --enable-libitm --enable-lto --disable-bootstrap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --without-isl --with-gxx-include-dir=/not/exist/usr/include/c++/11.2.0 --with-build-time-tools=/home/bamboo/build/5.15-kirkstone-full/fsl-imx-internal-xwayland/mx8m/yocto/build/tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-aarch64/11.2.0-r0/recipe-sysroot-native/usr/aarch64-poky-linux/bin --with-sysroot=/not/exist --with-build-sysroot=/home/bamboo/build/5.15-kirkstone-full/fsl-imx-internal-xwayland/mx8m/yocto/build/tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-aarch64/11.2.0-r0/recipe-sysroot --enable-standard-branch-protection --enable-poison-system-directories --disable-static --enable-nls --with-glibc-version=2.28 --enable-initfini-array --enable-__cxa_atexit
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (GCC)
COLLECT_GCC_OPTIONS='-E' '-v' '-mlittle-endian' '-mabi=lp64'
/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/cc1 -E -quiet -v - -mlittle-endian -mabi=lp64 -dumpbase -
ignoring nonexistent directory "/not/exist/usr/lib/aarch64-poky-linux/11.2.0/include"
ignoring nonexistent directory "/not/exist/usr/local/include"
ignoring nonexistent directory "/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/lib/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/../../../../../aarch64-poky-linux/include"
ignoring nonexistent directory "/not/exist/usr/include/"
#include "..." search starts here:
#include <...> search starts here:
/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/lib/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/include
/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/lib/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/include-fixed
End of search list.
# 0 "<stdin>"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "<stdin>"
main(){}
COMPILER_PATH=/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/:/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/:/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/:/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/lib/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/:/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/lib/aarch64-poky-linux/gcc/aarch64-poky-linux/
LIBRARY_PATH=/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/lib/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/
COLLECT_GCC_OPTIONS='-E' '-v' '-mlittle-endian' '-mabi=lp64'
$ echo 'main(){}'|${CC} -E -v -
Using built-in specs.
COLLECT_GCC=aarch64-poky-linux-gcc
Target: aarch64-poky-linux
Configured with: ../../../../../../work-shared/gcc-11.2.0-r0/gcc-11.2.0/configure --build=x86_64-linux --host=x86_64-pokysdk-linux --target=aarch64-poky-linux --prefix=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr --exec_prefix=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr --bindir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux --sbindir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux --libexecdir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux --datadir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/share --sysconfdir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/etc --sharedstatedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/com --localstatedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/var --libdir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/aarch64-poky-linux --includedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/include --oldincludedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/include --infodir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/share/info --mandir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/home/bamboo/build/5.15-kirkstone-full/fsl-imx-internal-xwayland/mx8m/yocto/build/tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-aarch64/11.2.0-r0/recipe-sysroot --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-default-pie --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=aarch64-poky-linux- --without-local-prefix --disable-install-libiberty --disable-libssp --enable-libitm --enable-lto --disable-bootstrap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --without-isl --with-gxx-include-dir=/not/exist/usr/include/c++/11.2.0 --with-build-time-tools=/home/bamboo/build/5.15-kirkstone-full/fsl-imx-internal-xwayland/mx8m/yocto/build/tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-aarch64/11.2.0-r0/recipe-sysroot-native/usr/aarch64-poky-linux/bin --with-sysroot=/not/exist --with-build-sysroot=/home/bamboo/build/5.15-kirkstone-full/fsl-imx-internal-xwayland/mx8m/yocto/build/tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-aarch64/11.2.0-r0/recipe-sysroot --enable-standard-branch-protection --enable-poison-system-directories --disable-static --enable-nls --with-glibc-version=2.28 --enable-initfini-array --enable-__cxa_atexit
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (GCC)
COLLECT_GCC_OPTIONS='-march=armv8-a+crc+crypto' '-fstack-protector-strong' '-O2' '-D' '_FORTIFY_SOURCE=2' '-Wformat=1' '-Wformat-security' '-Werror=format-security' '-E' '-v' '-mlittle-endian' '-mabi=lp64'
/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/cc1 -E -quiet -v -isysroot /opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/armv8a-poky-linux -D _FORTIFY_SOURCE=2 - -march=armv8-a+crc+crypto -mlittle-endian -mabi=lp64 -Wformat=1 -Wformat-security -Werror=format-security -fstack-protector-strong -O2 -dumpbase -
ignoring nonexistent directory "/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/armv8a-poky-linux/usr/local/include"
ignoring nonexistent directory "/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/lib/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/../../../../../aarch64-poky-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/lib/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/include
/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/armv8a-poky-linux/usr/lib/aarch64-poky-linux/11.2.0/include
/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/lib/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/include-fixed
/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/armv8a-poky-linux/usr/include/
End of search list.
# 0 "<stdin>"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/armv8a-poky-linux/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "<stdin>"
main(){}
COMPILER_PATH=/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/:/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/:/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/:/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/lib/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/:/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/lib/aarch64-poky-linux/gcc/aarch64-poky-linux/
LIBRARY_PATH=/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/lib/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/:/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/armv8a-poky-linux/lib/:/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/armv8a-poky-linux/usr/lib/aarch64-poky-linux/11.2.0/:/opt/fsl-imx-internal-xwayland/5.15-kirkstone/sysroots/armv8a-poky-linux/usr/lib/
COLLECT_GCC_OPTIONS='-march=armv8-a+crc+crypto' '-fstack-protector-strong' '-O2' '-D' '_FORTIFY_SOURCE=2' '-Wformat=1' '-Wformat-security' '-Werror=format-security' '-E' '-v' '-mlittle-endian' '-mabi=lp64'
I found that they both use aarch64-poky-linux-gcc. But I still don't know the difference between them.
gcc is the name of a command. Your shell will look for it in the path.
${CC} is a variable substitution. Your shell will look for it in the environment of the shell process.
gcc is the compiler of your machine. You can find which one and where is located like this:
readlink -f $(which gcc): this will show you the path of the program used
gcc --version: will show you the version of your gcc compiler
In case you are building in a PC, then the gcc will build programs for x86 architectures. In your case you need a compiler to generate programs for arm64 architectures (the opensource is aarch64-linux-gnu-gcc but the providers usually give you a modified toolchain with the compiler and all necessary libraries/headers.
When you crosscompile, you must "source" an environment file, this will modify the environment variables in the terminal were you sourced the environment file this will create the environment variable CC, this will contains the path to the compiler with some parameters for the compiler.
If you run echo ${CC} you will see the toolchain and the parameters.
The idea always is to have an isolated environment which doesn't depend on the OS, gcc version of the host PC, that's why you were provided with the compiler and you must use ${CC} to crosscompile to the architecture arm which is the base of imx SOCs
When I tried to compile my helloworld.c with
gcc helloworld.c -v -o myhelloworld
I have the following error :
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-6' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --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 --enable-bootstrap --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 8.3.0 (Debian 8.3.0-6)
COLLECT_GCC_OPTIONS='-v' '-o' 'hellosqd' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/8/cc1 -quiet -v -imultiarch x86_64-linux-gnu helloworld.c -quiet -dumpbase helloworld.c -mtune=generic -march=x86-64 -auxbase helloworld -version -o /tmp/cc0TkZSM.s
gcc: internal compiler error: Erreur de segmentation signal terminated program cc1
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-8/README.Bugs> for instructions.
My source program is a simple helloworld.c :
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char const *argv[])
{
printf("Hello world\n");
return 0;
}
My host is a Debian Buster based on amd64. And gcc version is (dpkg -l | grep gcc):
ii gcc 4:8.3.0-1 amd64 GNU C compiler
ii gcc-8 8.3.0-6 amd64 GNU C compiler
ii gcc-8-base:amd64 8.3.0-6 amd64 GCC, the GNU Compiler Collection (base package)
ii libgcc-8-dev:amd64 8.3.0-6 amd64 GCC support library (development files)
ii libgcc1:amd64 1:8.3.0-6 amd64 GCC support library
I tried to reinstall build-essential, but not worked.
Thanks in advance.
So, essentially, I am trying to make a simple program that prints "Hello, World!" to the output, but it does literally nothing, no errors or anything.
This is my code:
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
And this is the command I use to run it;
gcc runtime.c
Also, the gcc -v command.
Using built-in specs.
COLLECT_GCC=C:\MinGW\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/8.2.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-8.2.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-8.2.0-3' --with-gmp=/mingw --with-mpfr=/mingw --with-mpc=/mingw --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --with-isl=/mingw --enable-libgomp --disable-libvtv --enable-nls --disable-build-format-warnings
Thread model: win32
gcc version 8.2.0 (MinGW.org GCC-8.2.0-3)
It should be printing out "Hello, World", but this is all it does:
PS C:\Users\myirlname\Coding\Lunar Language(c)> gcc runtime.c
PS C:\Users\myirlname\Coding\Lunar Language(c)>
If anyone can help, that would mean a lot to me, thanks!
You're not running the code, you're just compiling it.
The command as you've given it creates an executable called a.exe. After compiling, run the executable.
a.exe
in cmd, I type: gcc -v to get the version of my compiler, this is what I get
C:\Users\myStuff\Documents\C_Codes>gcc -v Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/lto-wrapper.exe Target: mingw32 Configured with: ../gcc-4.8.1/configure
--prefix=/mingw --host=mingw32 --build=m ingw32 --without-pic --enable-shared --enable-static --with-gnu-ld --enable-lto
--enable-libssp --disable-multilib --enable-languages=c,c++,fortran,objc,obj-c++ ,ada --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-l ibstdcxx-debug --enable-version-specific-runtime-libs --with-gmp=/usr/src/pkg/gm p-5.1.2-1-mingw32-src/bld --with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld -- with-mpfr= --with-system-zlib --with-gnu-as --enable-decimal-float=yes --enable- libgomp --enable-threads --with-libiconv-prefix=/mingw32
--with-libintl-prefix=/ mingw --disable-bootstrap LDFLAGS=-s CFLAGS=-D_USE_32BIT_TIME_T Thread model: win32 gcc version 4.8.1 (GCC)
I have looked in c:\minGW\include\ to try to find string.h and it is there but when I try to have I my C code something like:
string temp
I get the following compile error:
error: unknown type name 'string'
how can I fix this so I can use strings??
I have also included stdio.h, stdlib.h, and there are two string headers, string.h and strings.h
Try to compile the code using g++, because c language doesn't support a string type or else you can use character array for the same.
You can define character array and copy contents into array like this
char arr[SIZE];
strcpy(arr,"Your String");
int i = 3.1 / 2
does not cause any warnings,even with -Wall option.Sometimes,I would like to know where precision lose.Why gcc does not support this warning,while msvc support this one?
thanks.
EDIT: my gcc -v shows
Configured with: ../../gcc-4.4.1/configure --prefix=/mingw --build=mingw32 --enable-languages=c,ada,c++,fortran,objc,obj-c++ --disable-nls --disable-win32-registry --enable-libgomp --enable-cxx-flags='-fno-function-sections -fno-data-sections' --disable-werror --enable-threads --disable-symvers --enable-version-specific-runtime-libs --enable-fully-dynamic-string --with-pkgversion='TDM-2 mingw32' --enable-sjlj-exceptions --with-bugurl=http://www.tdragon.net/recentgcc/bugs.php
-Wconversion warns for implicit conversion.