Does anyone know the command to use, if I want to look in an executable compiled with gcc to determine if there were any variables defined for use by #define.
Thank you,
Related
I have OpenMPI which is using gcc to compile. I need to cross compile from an x86_64 host architecture to an aarch64 target architecture. Instead of using gcc to compile, I want to use aarch64-linux-gnu-gcc to cross compile.
Anyone know how to change the compiler from gcc to aarch64-linux-gnu-gcc?
Thanks in advance.
openmpi allows using their mpi-wrappers (i.e., mpicc, mpic++, ...) with a different compiler by specifying:
OMPI_CC=COMPILER_NAME_OR_PATH
OMPI_CXX=COMPILER_NAME_OR_PATH
e.g.,
OMPI_CC=clang
OMPI_CXX=clang++
or
OMPI_CC=/usr/bin/gcc-11
OMPI_CXX=/usr/bin/g++-11
In some cases, you might need to export these variables by prepending the export keyword.
I was trying to run c program but this problem arise.. I don't know what it's trying to convey.. need help here
It looks like a pop up from some application rather than GCC. It says that it couldn't find the GCC on your computer, or may be GCC is installed but isn't included in your PATH environment variable.
You can find and install GCC here
https://gcc.gnu.org/wiki/InstallingGCC
I have some OpenCV/C++ application which compiles with a CMake definitions file, in which I did not find a way to pass flags to the compiler.
I know that there are the flags C_INCLUDE_PATH CPLUS_INCLUDE_PATH, and all the rest of their friends...
But, is there an environment variable for definition of any other flags, in which I'd be able to define -std=c++11 ?
If you're using CMake, equally easy and nicer solution will be to pass
-DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON
to CMake.
The easiest but certainly not nicest solution if you want to force it by hand would be:
add_compile_options(-std=c++11)
However CMake should be able to pick the necessary standard for you. Have a look to this answer:
How to detect c++11 support of a compiler with cmake
I am trying to compile an SDK with the an embedded arm gcc compiler in cygwin. It is a makefile based SDK. My target is a cortex m3 device. My problem is, the SDK has a custom libc implementation for the target, and when I compile with the arm compiler (arm-none-eabi-gcc) it looks to pick up the gnu arm libc, not the SDK libc. This is resulting in a compilation error. I am positive the makefiles are correct (I copy and pasted the entire SDK from a computer where this was working). I no longer have access to that computer to try and verify / compare settings. I don't know how to prevent the arm gcc compiler from looking for its own implementation of the libc and instead point it to the correct implementation. Any help is greatly appreciated.
There are perhaps two solutions:
Create an environment specific to your tool - the GNU toolchain uses a number of environment variables to define default behaviour. For a custom toolchain, you will need to set all necessary variables to override the system defaults.
Use the -nostdlib linker option and explicitly link your desired library and C Runtime start-up code, so your linker command line might include the following:
-nostdlib -L/usr/myarmtools/gcc/lib -lc crt0.o
Note that -nostdlib suppresses the default linking of libc libstdc++ and crt0.o, so you must provide search path (-L) to the libraries, or explicitly link them by their full path and file name and link the C runtime object code for your target.
I use option 2 for preference as it will work in any environment. However if you wish to use common makefiles for building for multiple targets, option 1 may be useful.
I know how to build gcc from source, what I still have to figure out is what are the exact environmental variables used by gcc when configure and building gcc itself, I'm actually trying to build the compiler from source using another version of gcc with different ABI.
Any idea on how to get this kind of information beside "try to grep all the variable that starts with $ inside all makefiles and configuration files" ?
You can see a list of Environment Variables Affecting GCC.
To create a completly independent gcc with a new toolset, have a look at LFS, they explain how to build gcc from an existing OS for a future OS.
There is also a page about building gcc, which talks about BOOT_CFLAGS='-O' and CFLAGS_FOR_TARGET and STAGE1_TFLAGS and BUILD_CONFIG. There is also some additional variables for cross-compiling and ada compiler.