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.

Filter by
Sorted by
Tagged with
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 -...
hal's user avatar
  • 33
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 ...
Zamyatin's user avatar
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&...
maplgebra's user avatar
  • 123
-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 ...
Martin Brown's user avatar
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 ...
Martin Brown's user avatar
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 ...
hafiz031's user avatar
  • 2,342
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 ...
AceSrc's user avatar
  • 61
-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 ...
Richard Lang's user avatar
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 ...
RTC222's user avatar
  • 2,125
-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 ...
OnlyShadow's user avatar
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-" ...
AnthoJack's user avatar
  • 169
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 ...
JustAGuy's user avatar
  • 5,291
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 &...
josephWu's user avatar
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 ...
WITC's user avatar
  • 155
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 ...
Henry Weilings's user avatar
-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 ...
RTC222's user avatar
  • 2,125
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(&...
pince-nez's user avatar
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 -...
Adlmc's user avatar
  • 1
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 ...
Tony Yuen's user avatar
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 ....
ncarrier's user avatar
  • 455
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.
Darevil294's user avatar
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 += ...
Milhouse Vanhouten's user avatar
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"...
keith bradley's user avatar
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 ...
fearless_fool's user avatar
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 ...
David Wotherspoon's user avatar
-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 ...
user5406764's user avatar
  • 1,689
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 ...
Sarvagnya Kunal's user avatar
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 ...
FourierFlux's user avatar
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 ...
Bri Bri's user avatar
  • 2,085
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? ...
Ramon Jales's user avatar
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 ...
0x11111's user avatar
  • 165
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 ...
Aakash Gupta's user avatar
-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 ...
broomhead123's user avatar
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 ...
pozzugno's user avatar
  • 806
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 ...
Ramon Jales's user avatar
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 ...
Ertugrul's user avatar
  • 124
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 ...
OnlyShadow's user avatar
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 &...
noob_code's user avatar
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 ...
Chan Kim's user avatar
  • 5,351
-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 ...
overthinker mark's user avatar
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-...
Gunotham Solanki's user avatar
-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: [[...
Igor's user avatar
  • 1,589
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() { ...
Vasco Vicente's user avatar
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 ...
fmg's user avatar
  • 825
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, ...
DevDenim007's user avatar
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 --...
kunterbunt's user avatar
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 ...
AnujDTechtive's user avatar
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'...
xlao1241's user avatar
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). ...
arongeo's user avatar
  • 35
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 ‘...
Simon's user avatar
  • 268

1
2 3 4 5
825