Questions tagged [gcc]
GCC is the GNU Compiler Collection. It's the de facto standard compiler for C, C++, Go, Fortran, and Ada on Linux and supports many other languages and platforms as well.
41,203
questions
0
votes
0
answers
9
views
GCC errors on Aarch64 (RK3568 SoC board) from Buildroot
I have loaded GCC (11.4.0) onto a custom Buildroot distribution (kernel 4.19), and am unable to compile an intro "hello.c" (hello world) program due to ranlib and header errors.
# gcc -g -...
0
votes
0
answers
32
views
What's the best way to find all the function declarations in C source code [closed]
I'm trying to write a python script that searches a set of C files and returns all function declarations in them for further processing.
I as of yet have been unable to find any effective and ...
1
vote
1
answer
31
views
Cannot specify the operands when using inline asm outside a function
My code is
unsigned long user_stack_pointer;
__asm__(
".global exception_handling_entry\n"
"exception_handling_entry:\n"
"add %0, sp, x0\n"
: "=r&...
-1
votes
0
answers
45
views
Ubuntu GCC/G++ strange linker error for log(x) [duplicate]
I'm porting my working code into native Ubuntu compiled with GCC/G++. Mostly it has been painless apart from a few minor niggles. Unix capitalisation rules take some getting used to...
This code is ...
0
votes
1
answer
47
views
GCC/G++ on Unbuntu makes a.exe that won't run: "Exec format error"
I'm trying to get my working C/C++ code to compile with GCC/G++ on Ubuntu - apart from one weird bug and a few very minor differences from the MinGW GCC port, Intel and MSC compilers it compiled and ...
0
votes
1
answer
7
views
cffi.VerificationError: CompileError: command '/usr/bin/gcc' failed with exit code 1
While installing the package pewanalytics with the command: pip install git+https://github.com/pewresearch/pewanalytics#egg=pewanalytics I have got the following error:
× python setup.py ...
5
votes
0
answers
93
views
Why does GCC fail to reduce a loop that increments two locations of the same buffer?
Here is a bounded loop that increments two locations of the same buffer.
unsigned int getid();
void foo(unsigned int *counter, unsigned int n) {
unsigned int A = getid();
unsigned int ...
-1
votes
2
answers
95
views
GCC warning for unintended pointer arithmetic on string literals
With the constant chopping and changing back and forth between different languages, every now and then I find myself trying to write fragments of Python or JS syntax in C/C++.
One that's caught me out ...
0
votes
0
answers
20
views
GDB reads debug symbols locally but not in cloud
I have a suite of programs that I developed locally, and I have uploaded the files to a cloud server at Digital Ocean -- a procedure I have done many times before. However, this is a new cloud server ...
-1
votes
1
answer
43
views
compilation errors when using make when installing gcc
I have already turned the .tar.bz2 (I was installing gcc-4.2.2) file into a folder, entered this folder, and used its ./configure, wrote make on the command line. It was after make that I got a lot of ...
0
votes
0
answers
15
views
Undefined symbol "_mcount" when cross-compiling for aarch64
I'm trying to use gprof for a project that runs in a small embedded OS (https://github.com/smartobjectoriented/so3). Compilation for this OS is done using the "aarch64-none-linux-gnu-" ...
0
votes
0
answers
11
views
CFLAGS ignores -std=c++11 or -std=gnu++11 Ubuntu 14.04
I am trying to compile the latest Open VM Tools from VMWARE on Ubuntu 14.04.
Running "make" I get the following:
/usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This
file ...
0
votes
1
answer
10
views
g++ mistake the meaning of rdi and rsi register
First of all, i make use of clang++ to generate one library named libbase-core.so.
Then i wrote one main.cc.
#include <string>
#include "base/single_thread_task_runner.h"
#include &...
0
votes
0
answers
35
views
Issue with Code Optimization in STM32CubeIDE for STM32
I have written code for my STM32 that manages the settings of an external circuit via SPI. When I use the Og optimization setting in STM32CubeIDE (which uses GCC), everything works as expected, and ...
0
votes
0
answers
12
views
How to exclude some instructions when compiling C code for arm v6 core using gcc?
When I am compiling C code for ARM v6 core, I don't want to use 'half-word' instructions like 'strh' or 'ldrh', because some of the peripherals don't support half-word access, they can only support ...
-1
votes
0
answers
71
views
Trying to install glibc source on Ubuntu 22.04
BeIow is the source code for a C program I use to memory map files. This program is compiled to a shared object and linked into the main program. Its only function is to create a memory mapping for ...
0
votes
1
answer
31
views
How to configure R 4.3 to run on RHEL 8?
While trying to install the Rcpp package in R on our RHEL 8 server, I get this series of errors/warnings:
make: *** No rule to make target 'compilers'. Stop.
Warning in system(paste(MAKE, p1(paste(&...
0
votes
0
answers
34
views
backtrace_symbols() on aarch64 device returns empty on SIGSEGV
I was trying to get backtrace in signal handler. The simple code from manpage worked on armv7 inside a signal handler. But I was unable to run the same code on an aarch64. Compiled with the -rdynamic -...
1
vote
1
answer
53
views
Rust cross compile to ARM: Undefined refernce to printf when linking against static C library
Problem
I am learning how to do C interop in bare metal Rust project. I have a simple C project that takes a struct and prints it. I compile it with arm-none-eabi-gcc to generate a libfoo.a and link ...
1
vote
2
answers
55
views
Isn't the -Wnonnull-compare warning misleading?
I have an API in which some functions are declared with the nonnull GCC function attribute, for example:
// declaration in .h
__attribute__((nonnull))
int foo(const char *bar);
[...]
// definition in ....
0
votes
0
answers
49
views
What do the numbers in "%0" or "%1" mean in C/C++ GCC Inline Assembly [duplicate]
I'm Reading the gcc documentation about the inline assembly,there was an operand syntax like %0,%1,%2 what this number mean ?, in their documentation this is not explained.
0
votes
0
answers
94
views
How to tell GCC/Clang optimizer to generate specific sequence of operations
I have a loop that needs to execute sequences of operations in a specific order. What I am doing here is manually unrolling the loop a number of times:
loop
{
delta = get_delta();
sum1 += ...
0
votes
0
answers
17
views
Proper header file pathing when referencing from multiple headers
I have a software package with many headers that are under a folder and reference each other.
(inside header 1)
#include "math/header2.h"
(inside header 2)
#include "math/header1.h"...
2
votes
0
answers
96
views
C "pass by pointer" value not updated when expected [closed]
I have a function where the data value is updated by a library call and returned via pointer. Note that in the body of the function, I print the de-referenced value of data following the call to ...
0
votes
0
answers
49
views
Baremetal Cortex-M7 gcc and unwind tables without libunwind
I'm working on a project using an STM32H743 MCU which has a Cortex-M7. I'm building outside of ST's toolchain and IDE with gcc-arm-none-eabi (13.2 Rel 1). My project is written entirely in C and ...
-1
votes
0
answers
84
views
Why does GCC inline memset but Clang does not?
I have three functions below (create1(), create2(), create3()). Each does the same thing, initializing an object to contain zeros. The first two do it explicitly, the last function uses C++ default ...
0
votes
0
answers
34
views
VS code is showing file directory error even after many changes
I use vs code in for my college and make multiple source files which I save in a folder on my desktop and VS code and mingw is installed in c folder so every time I try to run my code it gives out ...
1
vote
1
answer
118
views
Limits on optimization reordering C++ function execution
My understanding is that in the C++ specification the compiler can an reorder statements so long as the input/output order and information remain unchanged.
I'm a little bit confused how this ...
0
votes
2
answers
86
views
With C++11, how can I generate a warning message in a manner that works in gcc, clang, and MSVC?
When compiling C++11 using clang or gcc, I can generate a warning message at compilation time using:
#warning My message here
This doesn't work on Windows when I use MSVC, though. How can I ...
2
votes
2
answers
65
views
Why this function are in infinite loop?
This function just stay in a loop while my user dont type the right input(in this case an integer). The infinite loop happens when the user type the wrong value(like a string). But why this happen? ...
0
votes
0
answers
14
views
modifying AST as constructed in gcc
I would like to add a few branches to the AST as being constructed by the parser of gcc, https://github.com/gcc-mirror/gcc/blob/master/gcc/cp/parser.cc
What is the variable that holds the AST as being ...
0
votes
1
answer
63
views
Is C++ coroutine_handle invoking undefined behaviour?
I was going through the coroutine_handle implementation from https://github.com/gcc-mirror/gcc/blob/master/libstdc++-v3/include/std/coroutine#L251 and I stumbled across the fact that coroutine_handle ...
-1
votes
0
answers
48
views
Is the assignment to a returned pointer with side effects on both sides unspecified behaviour? [duplicate]
The following code has different behavior when comparing the result between GCC and Clang.
I originally thought it was a expression ordering issue but instead it looks like the behavior of the ...
0
votes
2
answers
82
views
gcc doesn't detect array out of bounds for inline function
extern void myprint(unsigned char *);
static inline void
myfunc(unsigned char *buf)
{
for (unsigned int i = 0; i < 20; i++) {
buf[i] = i;
}
}
int
main(void)
{
unsigned char ...
0
votes
0
answers
41
views
How to use modularized functions inside other modularized functions in C
I'm doing a more complex project in c, but this example here is the same for what i need and the names of examples will just changed, but, again, is the same thing from what i am doing.
Let's say I ...
2
votes
2
answers
124
views
Pointer of number in C
Assume there's function that get int * parameter.
void foo(int *x)
{
}
If I want to call this function without creating an int variable
int main()
{
foo(&1);
return 0;
}
compilation ...
0
votes
1
answer
72
views
Installing the gcc file format .tar.gz
I am installing an old version of gcc, namely 4.2.2, and here it can only be done through tar.gz file. I have already made of .tar.gz the usual folder and met the README document. Who can tell me what ...
1
vote
1
answer
49
views
gcc error, shareMemory undefined reference to?
server.h
// server.h
#ifndef SERVER_H
#define SERVER_H
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include &...
1
vote
1
answer
54
views
Array placed in weird address different from linker script (arm64 baremetal)
In aarch64 baremetal program build, some array in the C program is given section attirubtes so that they are placed at .axpudata_args0, .axpudata_args1, ... sections and This is the linkadd.h file ...
-1
votes
1
answer
60
views
How do I forbid avx512 while compile a program with -static option?
I have a program that can compile at local machine and need to run at remote server, and it's not allowed to be compiled at remote server.
Now cpus of these local machine all have AVX512 instruments ...
0
votes
0
answers
12
views
Unable to Compile Code in LXC BusyBox Container
I'm facing issues compiling code within an LXC container based on BusyBox. I've tried installing GCC using both apk and apt-get, but it outputs the command not found. I've heard about cross-...
-1
votes
2
answers
122
views
Overriding a method returning a reference to an array does not work in gcc, but works in clang/icx
I want to return a reference to an array in C++. I am referring to the getColor2 member function and its overrides in the example below.
I have a pure virtual member function in my base class ILed:
[[...
0
votes
1
answer
55
views
My C program keeps running without appearing any output
#include <stdio.h>
#include <stdlib.h>
int leNumeroInteiro();
void leDadosRetangulo(int *comp, int *larg);
void areaRetangulo(int comp, int larg);
void limparBufferStdin();
int main() {
...
1
vote
1
answer
57
views
Linking an object file to the C standard library with ld
Say I'm trying to create an executable binary from:
// main.c
#include <stdio.h>
int main() {
printf("Hello, world!");
return 0;
}
I can just run gcc main.c and I get the ...
0
votes
1
answer
78
views
While deploying on cloud run I face the ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects
I am deploying a docker containerised Application on Google cloud run and facing the issue
Building wheels for collected packages: Secret-Manager, pycocotools, termcolor, treelib, coverage, xhtml2pdf, ...
0
votes
1
answer
23
views
Compiling ns3 using clang results in undefined symbol linker error
I've downloaded ns-3.39, unpacked and compiled it using
wget https://www.nsnam.org/releases/ns-allinone-3.39.tar.bz2
tar xfj ns-allinone-3.39.tar.bz2
cd ns-allinone-3.39/ns-3.39/
./ns3 configure --...
0
votes
1
answer
29
views
Program isn't running on VS Code, FullyQualifiedError and gcc.exe error
Image of terminal showing the error
On running C program it is showing
+FullyQualifiedErrorId: NativeCommandFailed and gcc.exe error in the VS code terminal.
I tried using V
Terminal commands to ...
0
votes
2
answers
56
views
Flex + Bison integration errors: stray '\' and expected ';' before '{' token
I'm encountering issues with my Flex and Bison integration, specifically related to errors like "stray ` in program"and"expected ';' before '{' token." I've checked my code, but I'...
0
votes
0
answers
26
views
ARM1176JZF-S not allowing banked register access [duplicate]
Today I've encountered a problem while trying to access the SPSR_abt status register from supervisor mode while in a data abort exception, on ARM1176JZF-S (RPi 1's and RPi Zero W's CPU architecture). ...
1
vote
0
answers
33
views
cannot read spec file ‘libgomp.spec’
trying to compile a C++ application with OpenMP offloading on Ubuntu 23.10 with GCC 13, and I get the error message
x86_64-linux-gnu-accel-nvptx-none-gcc-13: fatal error: cannot read spec file ‘...