64
votes
Accepted
How long does it take to compile gcc 7.3.0?
After about 4.5 hours it finished.
P.S. Not sure why this question deserved a negative rating. Hopefully it will still help some folks, should they find their compile time take excessively long.
45
votes
Is the standard C library loaded by default in main memory in Linux?
The kernel is written in C, but it doesn’t use the C library (as dave_thompson_085 points out, it’s “freestanding”). Even if it did, a C library loaded along with the kernel for the kernel’s use would ...
37
votes
gcc error installing psycopg2 package for python3 on Centos 7.3
For Ubuntu use
sudo apt install libpq-dev
35
votes
Accepted
What is the gold linker?
The gold linker was designed as an ELF-specific linker, with the intention of producing a more maintainable and faster linker than BFD ld (the “traditional” GNU binutils linker). As a side-effect, it ...
28
votes
Accepted
What sets fs:[0x28] (stack canary)?
It's easy to track this initialization, as for (almost) every process strace shows a very suspicious syscall during the very beginning of the process run:
arch_prctl(ARCH_SET_FS, 0x7fc189ed0740) = 0
...
27
votes
Accepted
gcc - unknown switches (absent also from the manpage)
The option is shown as "-l_library_" (no space) or "-l _library_" (with a space) and c is the library argument,
see https://linux.die.net/man/1/gcc
-lc will link libc (-lfoobar would link libfoobar ...
24
votes
Accepted
What packages the man pages for GCC on Debian 10 Buster / Testing?
The manpages are provided in contrib packages, gcc-doc etc. (See the links at the top-right of the linked page for all the releases where the package is available.)
Debian 10’s default compiler is GCC ...
24
votes
Accepted
Can not execute "Hello, World!" C program with user other than 'root'
Is it something related NOEXEC flag?
Yes; presumably /home is mounted noexec, which means you can’t run binaries there. /tmp/user/1000 works because it’s a on different file system, as is /root (root’...
21
votes
Is the standard C library loaded by default in main memory in Linux?
Is the standard C library loaded by default in main memory in Linux?
No.
The first userspace process the kernel ever starts is called init, and its purpose is to start everything else, and to reap ...
18
votes
Accepted
How to link to a shared library with a relative path?
If we (for the moment) ignore the gcc or linking portion of the question and instead modify a binary with patchelf on a linux system
$ ldd hello
linux-vdso.so.1 => (0x00007ffd35584000)
...
18
votes
What is the gold linker?
The gold linker was written to make the link process considerably faster. According to the gold auther Ian Lance Taylor
At the moment gold has only one significant advantage over the
existing ...
13
votes
What is libstdc++.so.6 and GLIBCXX_3.4.20?
What is libstdc++.so.6? Is this just a library that gcc ships with?
It’s GCC’s implementation of the C++ Standard Library.
What are all the different GLIBCXX_*? Are these also libraries?
These are ...
13
votes
Accepted
GCC does not throw warnings and compiles erroneous code
On GCC, format string checks are controlled by -Wformat, which isn’t enabled by default.
Building your code with -Wformat (or -Wall, which includes it) does warn:
$ gcc -Wformat 630368.c -o ...
12
votes
Accepted
Centos 7 gcc 8 installation
Now devtools-8 is available and it's possible to use it by following commands:
yum install centos-release-scl
yum install devtoolset-8-gcc devtoolset-8-gcc-c++
scl enable devtoolset-8 -- bash
It's ...
12
votes
Accepted
How to statically link missing libgcc_s_seh-1.dll and libstdc++-6.dll DLLs for 9.3-win32 MinGW executable
Build your program (and mathlib.dll, if necessary) with the -static-libgcc and -static-libstdc++ options:
x86_64-w64-mingw32-g++ -static-libgcc -static-libstdc++ -L. -l:mathlib.dll -o fib main.cpp ...
11
votes
Accepted
How to install a specific version of GCC in Kali Linux?
How to install a specific version of GCC in Kali Linux?
GCC 6 is available on kali linux it can be installed as follow :
apt install g++-6 gcc-6
To switch between gcc6 and gcc7
update-alternatives --...
11
votes
Accepted
gcc /usr/bin/ld: cannot find -lglut32, -lopengl32, -lglu32, -lfreegut, but these are installed
The meaning of -lglut32 (as an example) is, load the library glut32.
The result of the ls you execute showed that you have the header file for glut32
In order to solve the problem of cannot find -l-...
11
votes
Accepted
Where do I get "Development Tools" for CentOS 7 when trying to install via yum?
In your console output it says: Maybe run: yum groups mark install (see man yum)—did you do this?
Try running the following commands:
yum groups mark install "Development Tools"
yum groups mark ...
10
votes
Accepted
How to temporarily change default version of gcc in ArchLinux
TLDR: sudo ln -s $(which gcc-5) /usr/local/bin/gcc; hash -r
By default, the gcc binary is located in /usr/bin
Checking our path, we see that /usr/local/bin comes first:
echo $PATH | tr ':' '\n'
/...
10
votes
Accepted
How are stack canary pollutions logged?
Stack smashing is detected by libssp, which is part of gcc. It tries very hard to output the message to a terminal, and only if that fails does it log to the system log — so in practice you’ll see ...
10
votes
Accepted
No gcc executable after pkg_add gcc on OpenBSD
The GNU C compiler executable is called egcc when it's installed from the gcc package. There should also be a gcc executable in /usr/bin (the gcc of the base system, at least on amd64).
$ type egcc ...
9
votes
How to handle error compiling GCC 4.7.0 using GCC 6.2.1
I agree that using a newer gcc is often not a good option. I had to write a new program for an embedded ARM v4 system running Pengutronix stuck at a 2.6 kernel and an old glibc. Therefore I had to ...
9
votes
Accepted
gcc build error : cannot find -lssl
Both errors are related to the OpenSSL development libraries not being installed ( -lssl is a pretty dead giveway).
The -lssl can be divided into -l, meaning "link with", and ssl, which is the ...
9
votes
using ldconfig and ld.so.conf versus LD_LIBRARY_PATH
The solution to this is to add your library directories /usr/local/gcc-7.3.0/lib/ to /etc/ld.so.conf (or a file in /etc/ld.so.conf.d/) and run ldconfig or change users' shell profiles to override the ...
9
votes
Accepted
How can i put the gcc warning messages in a text file?
You can redirect the output, say your program is:
main()
{
}
When you compile, gcc will say something like:
a.c:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
main()
^~~~
That is ...
9
votes
Compiling stand-alone function binaries from the Linux kernel
To add to Stephen Kitt's answer and explain it a bit more deeply...
The entire purpose of the kernel and kernel device drivers is to interface to hardware in ways that it is not safe for user level ...
8
votes
Accepted
Are there any successful forks or refactors of the Linux Kernel?
I am specifically wondering about the kernel and whether there are forks that eliminate gcc/gnu dependencies--
No-one is going to finish the work syncing up clang & Linux and then maintain that as ...
8
votes
gcc - unknown switches (absent also from the manpage)
-lc links with libc, the C library.
See the description of -llibrary in the documentation.
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
gcc × 757compiling × 161
linux × 128
debian × 82
make × 59
c × 55
ubuntu × 52
centos × 47
cross-compilation × 45
software-installation × 41
g++ × 38
c++ × 36
glibc × 35
linux-kernel × 34
libraries × 28
compiler × 25
rhel × 24
kernel × 22
dynamic-linking × 22
linker × 21
package-management × 20
solaris × 20
shared-library × 20
lfs × 20
arm × 19