Questions tagged [gnu]
This tag is for programming questions related to software and tools provided by the GNU ("GNU's Not Unix") project.
2,711
questions
0
votes
0
answers
39
views
Different C++ compilers in one project? (MSVC and GNU C++ compatibility)
A very simple C++ question that is more aimed at the compilers:
Suppose I create a static library (.lib) or a dynamic linked library (.dll) with the latest Microsoft Visual C++ compiler.
Can I also ...
0
votes
2
answers
73
views
Why iterator type of priority_queue is wrong with range constructor?
The code is as following.
#include <iostream>
#include <queue>
#include <unordered_map>
using namespace std;
typedef unordered_map<int,int>::iterator myIt;
class cmpHelper {
...
0
votes
0
answers
7
views
Is it possible to determine a signal was the result of a raise(x) or kill(y) command?
From https://www.gnu.org/software/libc/manual/html_node/Program-Error-Signals.html
The default action for all of these signals is to cause the process to terminate. If you block or ignore these ...
0
votes
1
answer
21
views
cksum command doesn't recognize -a option
I'm trying to automate checksum generation with CRC32, SHA1, and SHA256 algorithms on a directory of files, and I'm getting errors from cksum (v.8.32)
According to the cksum manual at gnu.org, it ...
0
votes
0
answers
8
views
How do you configure file permission for a UPNP server [closed]
I installed Gerbera as a UPNP player and I'm running it as a system daemon with systemctl start gerbera.
The server is reading from file in this folder /home/gerbera so I made a symbolic link to my ...
-1
votes
1
answer
48
views
Can you compile C for other operating systems?
I was just wondering, if there is a way, to compile my code, from my windows machine to other os, or do I have to setup everything for the compilation on VMs.
I have already changed up the code, so ...
-1
votes
2
answers
54
views
GNU AWK Print Text Between Two Patterns Do Not Include Patterns
GNU AWK 5.1.1
I have an AWK expression below that I use to print the content between two patterns found in a .txt document but I'm not particularly happy with the expression, would like something more ...
2
votes
3
answers
82
views
Remove BASH in-line comments, but only after arrays and the first 11 occurrances
What I have
I over-documented my meta statements in my scripts. There are many. They all start with something like this:
#!/bin/bash
# Title and other notes information
## I may have other lines here,...
0
votes
2
answers
44
views
Why pthread_create does not work 100% of the times?
I am recently learning about threads in C, and I have noticed something I consider weird.
Let's take the next code:
#include <stdio.h>
#include <pthread.h>
void *sub_routine(void *p)
{
...
0
votes
0
answers
8
views
devtools::build issue with conda
this is my first Stack Overflow question so please do not mind the terminology.
I try to build a package using devtools::build using a conda environment from my WSL:
devtools::build('pkg')
However, i ...
0
votes
1
answer
34
views
How to edit multiple lines in sed
I have 45 lines of code that need a sed command. Due to the recent change in GNU all my scripts are breaking and need -std=legacy & -fallow-invalid-boz. The only way I know how to do this is ...
0
votes
0
answers
39
views
undefined reference to vtable, even though virtual function was indeed implemented [duplicate]
It is probably a sily mistake... I started to code using C++ language. I have created an abstract class:
class Animal{
protected:
string name;
int age;
string noise;
...
0
votes
1
answer
37
views
Compile error - Make error: *** multiple target patterns. Stop
I have a problem with a makefile that's part of a repository. I already posted this question but don't know how to add some code lines after, so I'm trying it here.There is a problem with the makefile ...
-1
votes
0
answers
36
views
Update: Function randomly terminates, and program continues? Original: different output on Linux (gnu) and Mac (g++)
Update:
It seems that the problem may have to do with something other than the output itself, and that it actually happens on both my mac and the external computer, just at different stages of the ...
0
votes
1
answer
54
views
sed print N lines after match
I have a file containing these lines:
some junk
in here
log number 1
line1, data, here
line2,data,here
line3,data,here
and so on
some other
junk
log number 2
line one, some,data
line two, some,data
...
0
votes
0
answers
16
views
make -j10/ arm-none-eabi-gcc: error: out/example_detector_distance/.o: No such file or directory
i had my own project which its name is example_detector distance , i m trying to build this project by using make -j10 . all the files were compiled correctly but when it comes to linking it gives me ...
-1
votes
1
answer
49
views
increment major and minor version of pom file using sed/awk [closed]
Requirement 1:
Version - 1.0.0
New Version - 2.0.0
next - 3.0.0. .... so on
Every time only Major version should increase .
Requirement 2:
Example 1
Version - 1.0.0
New Version - 1.1.0
next - 1.2.0 ...
0
votes
0
answers
9
views
About linking to the built riscv64 libgcc.a
I am new to riscv GNU toolchain. When compiling a program, some errors occured.
A hidden symbol named **'__gtdf2'** in /XXX/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/rv64imac/lp64/libgcc.a(gedf2.o) is ...
1
vote
0
answers
21
views
Data substitution in shell using awk & gsub? [duplicate]
I want to write a script to substitute data in a customer master extract. Read from a datafile and search for equivalences in the CM extract(inputfile), once found substitute those records in ...
0
votes
0
answers
30
views
Segmentation fault with pushq %rax [duplicate]
I have this assembly code which gives me a segmentation fault and I do not know why.
.global _main
_main:
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
movl $0, -4(%rbp)
...
0
votes
0
answers
52
views
Rebuild QEMU (For RISCV-GNU-TOOLCHAIN)
This is a follow-up from the following question Custom Instruction crashing with SIGNAL 4 (Illegal Instruction): RISC-V (32) GNU-Toolchain with QEMU (apologies if I have missed any etiquette points in ...
0
votes
1
answer
51
views
Memory leak? Strange characters writing to file
Good Morning. This kinda ties in to a question I posted a few days ago, this is sort of a smaller example that all ties in. When I write the contents of array b to a text file it prints a bunch of ...
1
vote
6
answers
77
views
How to capture a substring from each lines of a file using grep?
How to capture specific substring from each line of a file when the required substring is at the end of each line.
code
sed 's/.*\(by user [0-9a-zA-Z]*\).*/\1/p' file > output
$cat file
2021-04-...
0
votes
0
answers
7
views
what is the correct replacement for grc blocks.message_sync
I am trying to read a decoded bluetooth packets in a python script using https://github.com/drtyhlpr/ble_dump as a model. But the grc blocks.message_sink is not there any more. What is the correct ...
0
votes
0
answers
12
views
how to make data exponential using gnu plot
so, I need to make y axis be exponential and also my observation should be exponential too. Here is code
set yrange[2.8:4.2]
# forecasts with 95 pc conf. interval
plot \
'-' using 1:2 title "...
-1
votes
1
answer
93
views
Virtual method but no virtual destructor
I see warnings like this
destructor called on non-final 'some_class_type' that has virtual functions but non-virtual destructor
on gnu compilers, but on our internal continuous integration tests that ...
1
vote
0
answers
26
views
Is it possible to define a symbol dynamically such that it will be found by dlsym?
I want to simulate loading symbols from a shared library for testing purposes.
Is there a way to define a symbol at runtime programmatically such that dlsym will find it?
For example:
...
-2
votes
1
answer
83
views
OneAPI 2022's GNU Compiler Collection support are missing
I have tried to install the latest OneAPI base toolkit for MacOS. I need to compile a program that uses OpenMP threading library (mkl_gf_lp64) for the GNU Fortran compiler and LP64 interface library (...
0
votes
1
answer
135
views
Explanation of difference between GNU sed and BSD sed
I wrote the following command
echo -en 'uno\ndue\n' | sed -E 's/^.*(uno|$)/\1/'
expecting the following output
uno
This is indeed the case with my GNU Sed 4.8.
However, I've verified that BSD Sed ...
0
votes
2
answers
27
views
Using config.ini variables in ldscript.ld
In my config.ini file I have defined these variables:
# Where will system be loaded when started (for which address to prepare it)
LOAD_ADDR = 0x100000
RAM_ADDR = 0x300000
ROM_ADDR = 0x200000
...
0
votes
1
answer
63
views
Printing First Variable in Awk but Only If It's Less than X
I have a file with words and I need to print only the lines that are less than or equal to 4 characters but I'm having trouble with my code. There is other text on the end of the lines but I shortened ...
1
vote
1
answer
31
views
How can I sort output from variable?
I want to be able to sort an input csv file that is comma separated by a values created in an extra column. Below is a sample of the input csv file
Timestamp,Email,Name,Year,Make,Model,Car_ID,Judge_ID,...
0
votes
1
answer
32
views
How to increment counter in gnu awk?
I want to be able to essentially print the line number along every printed line in the output after scanning and reworking an input csv file. The input csv file is comma separated, here's a sample
...
0
votes
0
answers
28
views
How to control processes and threads in hybrid OpenMP/MPI job
I'm trying to control the distribution of MPI processes and their threads. In a 4-core system (cores 0, 1, 2 and 3) with GNU compilers and OpenMPI, submitting a 2x2 job (export OMP_NUM_THREADS=2 &&...
0
votes
1
answer
58
views
Bucket Sort/Counting Sort of Large File
I have a very large file I want to sort through (10s of TB) in a coarse manner. Basically, I hash one of the fields in this file, take the last 4 digits of that hash and append it as a column. This ...
0
votes
1
answer
103
views
return readline to its original state when recieving SIGINT
In bash when a user hits ctrl-c (sending SIGINT) it takes back readline to its original state canceling search/vi-mode/... state.
I tried UNSETSTATE macro but it has no effect, actually even SETSTATE ...
1
vote
1
answer
80
views
Is such type conversion of modified `$1` from `strnum` to `string` a bug or a feature in GNU Awk?
$ awk --version
GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.2.0)
Copyright (C) 1989, 1991-2019 Free Software Foundation.
I run following three similar commands which tries to use $1 and $2 as ...
-2
votes
1
answer
65
views
Trying to get value from hash table in C returns some random value instead of value
I am using a hash table library in C, but it seems that whenever I retrieve the value of some key in a different function than where I entered the key-value pair, I get some random value instead of ...
2
votes
1
answer
63
views
Can a file move itself in C? [closed]
I'm trying to make a file install itself into the system (linux).
Every method I use (rename, system(mv), execl, etc) fails. Is there anyway to make a running executable move itself while running? The ...
0
votes
0
answers
196
views
CMake cant find installed Python Interpreter
My system is of Ubuntu 20.04 LTS having a python version 3.8.10. but while installing USRP open source tool chain UHD 3.14.0.0. there arises an error regarding python interpreter for cmake as follows
$...
1
vote
1
answer
62
views
What is the Hypervisor mode in arm?
The macro safe_svcmode_maskall in arch/arm/kernel/head.S is defined in arch/arm/include/assembler.h,which is
.macro safe_svcmode_maskall reg:req
#if __LINUX_ARM_ARCH__ >= 6 && !defined(...
1
vote
1
answer
42
views
How to assemble for MIPS cpu in the gnu assembler
I learning MIPS assembly and I want to assemble a MIPS assembly using as or gas command
Looking at the manual page
I tried to assemble using
as -mips32 myfile.asm
But it said it is an unrecognized ...
-1
votes
4
answers
67
views
Better way to manipulate data using AWK and SED
I am wondering if somebody could help me re-write this in a more sensible and smarter way?
sed -e '1d; $d' <someinputfile> |
awk -F"\t" '{split($2,a,/-/); print $1","a[1]&...
0
votes
1
answer
37
views
Get file mode in octal with stat (BSD vs GNU)
I am trying to get the file bits in octal, to assess whether a path is a regular file or a directory.
This works pretty well in BSD stat which is part of my macOS:
$ stat -f %Op /tmp/test.txt
100644
...
1
vote
1
answer
36
views
Why does make use a back quote and single quote around the target name?
I found in all make warning / error messages, it uses a single back quote but then a single quote to highlight the user input.
For example, the error message of the undefined makefile name is like
...
0
votes
1
answer
37
views
How can I create a make file to run other make files independently?
I want to be able to run a command like make subdir in a make file located in the root of a folder which will in turn run another make file that is located in a sub directory of the current one.
From ...
0
votes
2
answers
98
views
How can I sort csv data alphabetically then numerically by column?
If I have a set of data that has repeating name values but with different variations per repeating value, how can I sort by the top of each of those repeating values? Hopefully that made sense, but I ...
0
votes
1
answer
38
views
GSL: Random number generator should be unique in one program
I am using GNU Scientific Library to generate random number. Random Number Generation — GSL 2.7 documentation
In general, we should get a gsl_rng firstly.
const gsl_rng_type * T;
gsl_rng ...
0
votes
0
answers
8
views
Place constant array into middle of code memory - i.MX RT + MCUXpresso
For testing purposes, I need to split code to two parts to ensure long jumps to flush code cache frequently. Splitting certain object files to sections is not acceptable, as it is deterministic, while ...
0
votes
0
answers
96
views
ASM in VS Code via the GNU Assembler Language Support Package
I am trying to learn Assembly, and my IDE of choice is VS Code. I installed this GNU package in the VS Code marketplace to try and be able to use Assembler within VS Code, and it keeps giving me this ...