Questions tagged [gnu]

This tag is for programming questions related to software and tools provided by the GNU ("GNU's Not Unix") project.

The GNU Project is a free software, mass collaboration project, announced on September 27, 1983, by Richard Stallman at MIT. It initiated GNU operating system development in 1984. The founding goal of the project was, in the words of its initial announcement, to develop "a sufficient body of free software [...] to get along without any software that is not free."

To make this happen, the GNU Project began working on an operating system called GNU ("GNU" is a recursive acronym that stands for "GNU's Not Unix"). This goal of making a free software operating system was achieved in 1992 when the last gap in the GNU system, a kernel, was filled by the third-party Linux kernel being released as Free Software, under version 2 of the GNU GPL.

2807 questions
73
votes
8 answers

Disable make builtin rules and variables from inside the make file

I want to disable builtin rules and variables as per passing the -r and -R options to GNU make, from inside the make file. Other solutions that allow me to do this implicitly and transparently are also welcome. I've found several references to using…
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526
73
votes
5 answers

How to use the GDB (Gnu Debugger) and OpenOCD for microcontroller debugging - from the terminal?

The standard (low-cost) way to program ARM microcontrollers is using Eclipse with a complex toolchain plugged into it. Eclipse has definitely its merits, but I'd like to feel independent from this IDE. I'd like to discover what happens behind the…
K.Mulier
  • 8,069
  • 15
  • 79
  • 141
72
votes
11 answers

Invoking GCC as "cc" versus "gcc"

I am aware that on most GNU/Linux systems, GCC can be invoked by the name "cc" from the command line (as opposed to "gcc"). Is there any difference in GCC's behavior when it is invoked one way versus the other? For example, I know that invoking GCC…
Dan Moulding
  • 211,373
  • 23
  • 97
  • 98
70
votes
2 answers

Why use asprintf() instead of sprintf()?

I'm having a hard time understanding why you would need asprintf. Here in the manual it says The functions asprintf() and vasprintf() are analogs of sprintf(3) and vsprintf(3), except that they allocate a string large enough to hold the output…
Brandon Ling
  • 3,841
  • 6
  • 34
  • 49
69
votes
5 answers

What is GLIBC? What is it used for?

I was searching for the source code of the C standard libraries. What I mean with it is, for example, how are cos, abs, printf, scanf, fopen, and all the other standard C functions written, I mean to see their source code. So while searching for…
user1261015
65
votes
4 answers

GNU make yields "commands commence before first target" error

In my makefile, I would like to check for the existence of a library and give an informative error message. I created a conditional that should exit the make process when the file is not found: 9: ifeq ($(${JSONLIBPATH}),) 10: JSONLIBPATH =…
Alex Reynolds
  • 95,983
  • 54
  • 240
  • 345
65
votes
5 answers

Change stack size for a C++ application in Linux during compilation with GNU compiler

In OSX during C++ program compilation with g++ I use LD_FLAGS= -Wl,-stack_size,0x100000000 but in SUSE Linux I constantly get errors like: x86_64-suse-linux/bin/ld: unrecognized option '--stack' and similar. I know that it is possible to…
asdf
  • 2,281
  • 5
  • 28
  • 29
59
votes
9 answers

Use GNU find to show only the leaf directories

I'm trying to use GNU find to find only the directories that contain no other directories, but may or may not contain regular files. My best guess so far has been: find dir -type d \( -not -exec ls -dA ';' \) but this just gets me a long list of…
Thomas G Henry LLC
  • 10,887
  • 8
  • 30
  • 32
58
votes
5 answers

Limiting visibility of symbols when linking shared libraries

Some platforms mandate that you provide a list of a shared library's external symbols to the linker. However, on most unixish systems that's not necessary: all non-static symbols will be available by default. My understanding is that the GNU…
rafl
  • 11,980
  • 2
  • 55
  • 77
58
votes
4 answers

GNU parallel not working at all

I have been trying to use GNU parallel for some time, but I have never been able to get it to function at all! For example, running (in a non-empty directory!): ls | parallel echo # Outputs single new line ls | parallel echo echo echo #…
WaelJ
  • 2,942
  • 4
  • 22
  • 28
56
votes
8 answers

How can I make GNU Screen start a new window at the CURRENT working directory?

By default, when you create a new window in GNU Screen, it will start in the directory where Screen is invoked. I want to start a new window in GNU Screen at the current working directory of the window I'm currently in. How can I do that?
Rio
  • 1,877
  • 3
  • 25
  • 25
55
votes
2 answers

How to get the invoking target of makefile?

How to get the invoking target of the GNU make Makefile? for example, I invoke make with the following command line: make a-target How can I get the invoking target "a-target" in the Makefile and assign it to a variable? Further more, if more than…
Justin
  • 693
  • 1
  • 5
  • 7
54
votes
2 answers

How can I detect g++ and MinGW in C++ preprocessor?

I want to do something like: #ifdef GCC #define GetFunctionName() string("My function name is ") + __PRETTY_FUNCTION__; #endif Since I want to use __PRETTY_FUNCTION__, this is only supported by GNU as far as I know so I need to detect if I am…
EddieV223
  • 5,085
  • 11
  • 36
  • 38
52
votes
3 answers

__attribute__((const)) vs __attribute__((pure)) in GNU C

What is the difference between __attribute__((const)) and __attribute__((pure)) in GNU C? __attribute__((const)) int f() { /* ... */ return 4; } vs __attribute__((pure)) int f() { /* ... */ return 4; }
wefwefa3
  • 3,872
  • 2
  • 29
  • 51
50
votes
1 answer

gdb: How do I pause during loop execution?

I'm writing a software renderer in g++ under mingw32 in Windows 7, using NetBeans 7 as my IDE. I've been needing to profile it of late, and this need has reached critical mass now that I'm past laying down the structure. I looked around, and to me…
Engineer
  • 8,529
  • 7
  • 65
  • 105