Numeric file identifier like __FILE__ for logging purposes
I have a couple of rather large gcc-based C-projects (more than 400 files, partially shared by the projects) where each file has something like a file id for logging output. This boils down to...
View ArticleWhy std::chrono::time_point is not large enough to store struct timespec?
I'm trying the recent std::chrono api and I found that on 64 bit Linux architecture and gcc compiler the time_point and duration classes are not able to handle the maximum time range of the operating...
View ArticleHow to make a compiled kernel android "Image.gz" to "zImage" or "Image.gz-dtb"
How to make a compiled kernel android "Image.gz" to "zImage" or "Image.gz-dtb" ? In arch/arm64/boot only shows Image and Image.gz
View Articlegcc linker error, 'not declared in this scope'
file1.cppgcc version 4.9.2..#ifdef _WIN32__declspec(dllexport)std::vector<int> g_vDelay;#else __attribute__((visibility("default")))extern std::vector<int> g_vDelay;#endif..void...
View ArticleWhy do gcc and clang generate so much code for std::find?
I entered the following code into godbolt.org, and compiled it with gcc 10.1 and clang 10:#include <algorithm>#include <vector>typedef std::vector<int> V;template<class InputIt,...
View Articlegcc - Local variable overwritting a static variable in .data
In a arm-gcc program (precisely a Atmel Studio 7 Project on a ATSAMC20E18A), I have a weird behavior where a local variable in a function (uint8_t tmp_buffer[ROWS][COLUMNS]) is placed at the beginning...
View ArticleSegmentation Fault in gcc linux [closed]
I am running a C program on linux terminal using gcc, but I keep getting a segmentation fault error for various different commands. I used gdb to debug my program but I still can't figure out where the...
View ArticleDynamically Allocating a 2D Matrix of Structs in C
I am writing a program in C which will read in an image in Bitmap format, and adjust some image parameters like colours, making the image greyscale, etc. I have the image loaded in, and have stored the...
View ArticleInstall MPICH & OpenMPI with both gcc and icc
I need to have the following 4 optionsOpenMPI running with gcc and iccMPICH running with gcc and iccIs there any good to way/practice to achieve this without screwing up your system. I am on a MacOS...
View ArticleGCC cross-compiler for DOS gives a bunch of linker errors for "Hello world!"...
I've tried to configure GCC 9.3.0 to produce executable files for DOS. However, for a simple "Hello world!" program in C, it...
View Articlemeta-toolchain-qt5 on yocto zeus, gcc-cross-canatian-aarch64 fail
I'm trying to cross compile C++ application during yocto image building. I'm working on yocto zeus with meta-tegra and machine is Jetson Nano.At the beginning I've tried to just add inherit...
View ArticleCross compile busybox source code using arm-linux-androideabi-gcc...
Can anyone please tell how to cross-compile busybox source code with arm-linux-androideabi-gcc cross-compiler.Please provide the busybox source code along with the steps to be followed.I tried to...
View ArticleHow to prevent GCC from optimizing out a busy wait loop?
I want to write a C code firmware for Atmel AVR microcontrollers. I will compile it using GCC. Also, I want to enable compiler optimizations (-Os or -O2), as I see no reason to not enable them, and...
View ArticleC program confusing output for increment operation [duplicate]
I have simple C program which uses increment operator: int main() { int a = 6; a+= ++a +++a; printf("value of a is %d\n", a); }As per my calculation output should be 23 but when I run it, output...
View ArticleUsing HP Fortify SCA to scan Linux Kernel
I'm trying to use HP Fortify SCA to scan RHEL7.5 server kernel [linux-3.10.0-862.el7]. I'm on the RHEL workstation OS which is on virtualbox.In the working dir I'm doing:"sourceanalyzer -b mybuild...
View ArticleAzure IoT C SDK - library linking problem
I've created a simple application that uses the Azure IoT SDK for C to provision and connect to my Azure IoT Hub. This is cross-compiled using Debian for an ARM device.This application builds and runs...
View ArticleWhat's the difference between Python built by MSC and Python built by GCC?
I'm a Windows user. I used to install the official CPython from python.org. But recently I tried the mingw-w64-x86_64-python offered by MSYS2.The two interpreters show different banners at...
View ArticleHow to Crosscompile Busybox for MIPS in Little-Endian
I try to cross-compile busybox for an IoT-Gadget. The goal is to replace a tiny Busybox with a complete Busybox binary. If I do an read-elf -a busybox on the original binary, it says that its...
View Articlevariable not exported causing linker error in gcc 4.9.2
symbol not exported:I have a variable in a .cpp file that gets built into a .so file. This variable added is not found during the linking process. Both the .so and executable existed- ie just added the...
View ArticleEmbedding binary blobs using gcc mingw
I am trying to embed binary blobs into an exe file. I am using mingw gcc.I make the object file like this:ld -r -b binary -o binary.o input.txtI then look objdump output to get the symbols:objdump -x...
View Article