Using GCC with new glibc and binutils to build software for system with older...
I have a question since some months and I can't come to an answer with Google for a long time.Background: I am cross compiling software for arm based controllers which are running the linux...
View ArticleHow to include needed C library using gcc?
I am trying to compile the simple C example from this Tutorial on Ubuntu using gcc. What do I have to use as argument for gcc to include the needed libraries for #include...
View Articleclang9(or trunk) vs gcc9: member array size as non-type template parameter...
I have the following mock code#include <array> template<int N> struct S { std::array<int, N> m{}; }; template<int N> auto copy (S<N> const& i) { return...
View Article"cannot find -lcrypto -lssl" with OpenSSL on Windows with MinGW
Trying out a c code for openssl, and this error showed up while compiling it in the command prompt.c:\openssl>gcc -lssl -lcrypto -o test test.c -IC:\openssl\include\...
View ArticleAzure IoT SDK linux sample compile error: In function Send_Sample undefined...
I know there are many questions like this one and I've read many of them but I can't solve my Problem.I'm trying to compile a sample code of the azure iot sdk with gcc on ubuntu.My command line looks...
View ArticleHow can I use gfortran from a non-standard directory under Linux?
I have installed a relatively new version of gfortran in a non-standard library under Linux. It seems that compiled fortran programs cannot access the gfortran library. Compiling with the -static...
View ArticleStripping out static text from log messages and save only variables [closed]
I know that there is a way to get rid of static text from log messages and keep only the variables part of the message in memory. But I am not sure exactly how it is done.To give a concrete example to...
View ArticleSwallowing comma in variadic macros on compilers that do not recognise ##
I need to write a variadic macro in C which must take zero or more arguments.In gcc, that can be achieved by adding "##" after the comma, e.g. ,##____VA_ARGS____ as answered in Variadic macros with...
View ArticleConda GCC compile OpenMP failure
I have a simple openmp example:#include <stdio.h> int main() { #pragma omp parallel { printf("https://helloacm.com\n"); } return 0; } I created two conda environments on different machine using...
View ArticleHow GCC handles built-in function
I have trouble understanding GCC built-in functions, and feel very confused.What is the difference between a library function and an built-in function? Is there something a built-in function can do but...
View ArticleNinja doesn't use CC and CXX?
I'm compiling Tesseract with Ninja. Clang has some linking problem, and gcc works. I exports CC and CXX to gcc and make -j8 runs fine. However, Ninja (using the given script in /build folder) still...
View ArticleDoes gcc optimize c++ code algebraically and if so to what extent?
Consider the following piece of code showing some simple arithmetic operations int result = 0; result = c * (a + b) + d * (a + b) + e; To get the result in the expression above the cpu would need to...
View ArticleInstalling GCC 4.7.1 on OS X
I am trying to install GCC 4.7.1 on my Mac because I want to update the LLVM GCC 4.2 given in XCode.I have downloaded GCC 4.7.1 and I've placed the gcc-4.7.1 folder in ~/Downloads, then I followed the...
View Articlecan't complie using gcc with -fopenmp in OS X
I just started learning OpenMP. I tried to compile a simple Hello World C code using gcc. Here's is my command line .gcc -fopenmp HelloWorld.c and this is my simple HelloWorld code ....
View ArticleHow do the likely/unlikely macros in the Linux kernel work and what is their...
I've been digging through some parts of the Linux kernel, and found calls like this:if (unlikely(fd < 0)) { /* Do something */ } orif (likely(!err)) { /* Do something */ } I've found the definition...
View ArticleWhat is the advantage of GCC's __builtin_expect in if else statements?
I came across a #define in which they use __builtin_expect.The documentation says:Built-in Function: long __builtin_expect (long exp, long c)You may use __builtin_expect to provide the compiler with...
View ArticleOMP reduction with Eigen array runs in GCC but not in Clang
I am using OpenMP to parallelize a loop summing Eigen arrays. Compiling the code with GCC and Clang works, but Clang gives me a SIGSEGV with the error:double free or corruption (!prev) Segmentation...
View ArticleIs there a compiler hint for GCC to force branch prediction to always go a...
For the Intel architectures, is there a way to instruct the GCC compiler to generate code that always forces branch prediction a particular way in my code? Does the Intel hardware even support this?...
View ArticleFailing comparison of floats NaNs on STM32F407 CORTEX-M4 [duplicate]
I'm trying to compare two floats returned from nanf("1") and the program is not entering if block.int main(void) { volatile float f; volatile float ff; uint32_t* view1; uint32_t* view2; view1 =...
View Articleinline assembly in C++ function with return statement
Consider this code:#include <cstdio> int get_value() { asm("movl $254, %eax"); } int main() { printf("%d\n", get_value()); } Now if one compiles this code with g++ main.cpp, one gets a compiler...
View Article