How do I compile my application with static library?
I am currently trying to use reactphysics3d library to make simple pariticle collision simulator. https://www.reactphysics3d.com/I tried to compile my c++ file with the static library but it doesn't...
View ArticleStrange address of a C variable in Mac OS X
Given the following C code:void *ptr;ptr = malloc(100);printf("Address: %p\n", ptr);When compiling this code using GCC 4.9 in Ubuntu 64 bit and running it the output is similar to this:Address:...
View ArticleSTM32 MCU GCC Compilation behavior
I have some misunderstanding about MCU GCC compilation behavior regarding function that return other things that 32bits value.MCU: STM32 L0 Series (STM32L083)GCC : gcc version 7.3.1 20180622 (release)...
View ArticleThere is a way to reduce RISC-V code size
I used the RVC compressed instructions of the ISA RISC-V. But, after I realized that the gcc compiler does not maybe use these instructions. So, I added some flags to the linker and the size is...
View ArticleForce GCC/Clang to always issue a call to __tls_get_addr
From what I understand, if I have some code that contains a _Thread_local variable, and I compile it to a shared library, then all accesses to the variable go through __tls_get_addr(). However, if I...
View ArticleHow to fix python-dev install in Docker Linuxkit?
I have a rather complex stack in my Dockerfile. I need to be able to allow gcc access the Python headers for the pip to install a lib (py-lmdb) which has CPython dependency that needs to be built....
View ArticleCopy pre compiled gcc binaries to another Raspbian
I am trying to upgrade the gcc compiler from version 8.3 to 8.4. The official gcc documentation suggests compiling from source method which takes 5 hours on average. I need gcc-8.4 version to build...
View ArticleCan I store pointer to __PRETTY_FUNCTION__ for later use or do I need to copy...
What is the lifetime of the string __PRETTY_FUNCTION__ produces?I know __func__ generates equivalent of static const char __func__[] = "function-name";, Thanks to that static, if I want to create a...
View Articleodd linker error occuring when making program: 'multiple definition of...
So I am programming a program that grew so much that I decided to create many files for this project (as I have done before). After creating 2 files and putting the appropriate functions in them these...
View Articler move package compilation fails. Possible incorrect file location
I'm trying to upgrade the move package in R. It needs to be compiled from source. The compilation failed. I have copied some the error messages below. But I'm wondering if this might be related to an...
View Articleis it possible to execute C code during C++ stack unwinding / exception
I need to write a C library which will be integrated into a C++ code base. This library may call C++ code passed as a callback. These functions may throw C++ exceptions.I'd like to ensure that the...
View ArticleInvalid conversion of const to const char*, how do I fix it? Fails with gcc7
This compiles with older versions of gcc, but fails with GCC 7 with C++17.This is the error I get:error: invalid conversion from 'char' to 'const char*' [-fpermissive] end_of_line = '\0';Can't seem to...
View ArticleUnderstanding the gibberish error when compiling LLVM from source
Here are the things I did, Compiled and installed gcc-9.2.Compiled and installed GNU binutils-2.32Compiled and installed GNU Make-4.2I downloaded the source codes for LLVM, Clang, LLD, libcxx,...
View ArticleTrouble compiling C code: error: expected '=', ',', ';', 'asm' or...
I'm using James M tutorials on writing a kernel. I writing the code with a cross compiler for the elf-i386 arch on macOS 10.12 with GCC 6.2.0 and Binutils.Everything compiles exceptmain.c, which fails...
View Articlegcc fails to obey #pragma once with precompiled headers (via cmake)
I have a weird problem with gcc trying to include a file twice in one compilation unit, even though there's #pragma once in that file.The files needed to reproduce the issue...
View ArticleAddress of C++ local variable is before the address returned by gdb info...
I have the following source code (in a file named vuln.cpp) in C:#include <stdio.h>#include <string.h>int main(int argc, char ** argv){ char real[20]; char pass[20] = "dddddddddddddddd";...
View ArticleHow to check why some symbol is required for linkage?
This question gets cumbersome, lets try short version:Usually when you fail with unresolved symbol reference it is quite strait forward, here you call something that linker cant find. You just feed...
View ArticleDebug vs Release in CMake
In a GCC compiled project,How do I run CMake for each target type (debug/release)?How do I specify debug and release C/C++ flags using CMake?How do I express that the main executable will be compiled...
View ArticleIs nested function in GCC safe now? Class definition in GNU C
Before, the use of nested function in GCC is controversial. Its main drawback is that it uses a technique called trampoline. Now that you can prevent this by specifying -fno-trampolines while...
View ArticleUnmangling the result of std::type_info::name
I'm currently working on some logging code that supposed to - among other things - print information about the calling function. This should be relatively easy, standard C++ has a type_info class. This...
View Article