Skip to main content
63 votes
Accepted

How do I compile something for Linux if I don't have enough space for installing GCC?

Usually, for an embedded device, one doesn't compile software directly on it. It's more comfortable to do what is called cross-compilation which is, in short, compiling using your regular PC to ...
binarym's user avatar
  • 2,677
58 votes
Accepted

Are compiled shell scripts better for performance?

To answer the question in your title, compiled shell scripts could be better for performance — if the result of the compilation represented the result of the interpretation, without having to re-...
Stephen Kitt's user avatar
41 votes
Accepted

Do C compilers discard unused functions when statically linking to .a file?

By default, linkers handle object files as a whole. In your example, the executable will end up containing the code from main.c (main.o), and any object files from libmine.a (which is an archive of ...
Stephen Kitt's user avatar
15 votes

Do C compilers discard unused functions when statically linking to .a file?

Yes. But it is on a module level, not on a function. For example, you have two source files: foo_goo.c and bar.c // foo_goo.c int foo() { .. }; int goo() { .. }; // bar.c int bar() { .. }; Compile ...
White Owl's user avatar
  • 5,297
12 votes
Accepted

How do I compile the Linux kernel with Clang?

The kernel build allows you to specify the tools you want to use; for example, to specify the C compiler, set the CC and HOSTCC variables: make CC=clang HOSTCC=clang The build is only expected to ...
Stephen Kitt's user avatar
8 votes
Accepted

How can I get a binary from a .py file

In my opinion your problem in Google stems for calling a compiler capable of producing binaries from python a "disassembler". I have not found a true compiler, however I have found in Google a python ...
Rui F Ribeiro's user avatar
5 votes

How can I get a binary from a .py file

Try Nuitka. It takes a .py and then creates a .bin. It works on Gnu+Linux and is in most popular distribution's software repositories. Nuitka is a Python compiler written in Python. It's fully ...
9716278's user avatar
  • 161
5 votes

How do I compile the Linux kernel with Clang?

Thanks to Stephen Kitt's answer. It's possible to compile the Linux kernel with Clang. But you need Clang v9.0. Setting Up If you are using Arch Linux, there's a nice way to clang v9.0 without ...
15 Volts's user avatar
  • 2,169
5 votes

Are compiled shell scripts better for performance?

In general, there is no way to compile a shell script, because new source text can be introduced by several method at run time, which has therefore bypassed the compiler phase. That new source would ...
Paul_Pedant's user avatar
  • 9,434
4 votes
Accepted

Current status of PCC (Portable C Compiler)?

That's only a couple of months, which is not an unusual gap in pcc's commit history. Perhaps you have unrealistic expectations for development activity on pcc.
rici's user avatar
  • 9,960
4 votes
Accepted

How can I reliably modify build configs and add compiler flags in C/C++ RPM files?

The most universal way that would apply to most packages is customizing optflags macro. You can create $HOME/.rpmrc and put your customized value for it. To get the current value for our OS, you can ...
Danila Vershinin's user avatar
4 votes
Accepted

How can I name the output of a compiled source file in a certain way?

Given that $ g++ file.C -o file will create an executable called file, one would hopefully have been able to extrapolate that $ g++ file.C -o helloworld.out will create an executable falled ...
DopeGhoti's user avatar
  • 79.3k
3 votes

How do I compile something for Linux if I don't have enough space for installing GCC?

I agree with binarym's answer regarding cross-compiling. However, if one still wanted to compile directly on a machine with such conservative hardware, I would recommend taking a look at smaller ...
Christian Gibbons's user avatar
3 votes
Accepted

Where is the documentation for my compiler located?

The documentation would usually be in manpages and /usr/share/doc. Usually, a symlink called cc points to the specific default compiler installed, so you should be able to determine which compiler is ...
muru's user avatar
  • 78.4k
3 votes

Current status of PCC (Portable C Compiler)?

For some months now the site http://pcc.ludd.ltu.se is unreachable.
vonbrand's user avatar
  • 18.6k
3 votes

Why is LDBL_MAX 1.18973E+4932 and how is this possible?

You are probably used to thinking of numbers as some number times some power of 10. Floating point numbers are represented as some number times some power of 2. You can represent 102410 (...
Fox's user avatar
  • 8,383
3 votes
Accepted

Where to find the resulting .so file of a compilation?

The last part of the build, as run by make, tells you explicitly where the library is installed: ---------------------------------------------------------------------- Libraries have been installed ...
Stephen Kitt's user avatar
3 votes

Red Hat 6.9 Desktop yum groupinstall Developer Tools not found?

It appears that the group has a name of "Development Tools" and an id of "development", so you should use one of those two names with yum. yum groupinstall 'Development Tools' or yum groupinstall ...
Jeff Schaller's user avatar
  • 68.8k
3 votes
Accepted

Portable name of C++ compiler (and linker)

The POSIX C compiler front-end is now c99; cc is widely available but not guaranteed. POSIX doesn’t specify anything C++-related, so you won’t find a standardised command to invoke a C++ compiler and ...
Stephen Kitt's user avatar
2 votes

How to install xlc++ on AIX?

Installation instructions for XLC++ compilers on IBM AIX are well docummented on IBM Support website.
Tomáš Pánik's user avatar
2 votes

gcc - error: no acceptable C compiler found in $PATH

I had this exact issue while working with a Ubuntu subsystem within Windows 10 and solved it by doing: sudo apt-get update sudo apt install build-essential Alternatively, the second command could be ...
Schroeder's user avatar
  • 131
2 votes

Are stack canaries shared via threads?

When a new thread is spawned, a memory area is allocated for the thread's stack. Space for thread local variables is allocated from this area. The TLS variables are not strictly part of the stack, i.e....
Johan Myréen's user avatar
2 votes

How to cross compile older version of GCC under Debian?

Your GCC doesn’t appear to be using the right as, and probably wouldn’t use the right ld either; you need to add --with-as=/usr/bin/arm-none-eabi-as --with-ld=/usr/bin/arm-none-eabi-ld to your ./...
Stephen Kitt's user avatar
2 votes

Difficulty installing gcc 7.3.1

Looking at the packages published in the PPA, you need to install gcc-7: sudo apt install gcc-7 But since you have multiple versions of gcc-7 available, including newer ones than 7.3, you also need ...
Stephen Kitt's user avatar
2 votes
Accepted

Specify which libstdc++ to use

The LIBRARY_PATH environment variable is pretty standard. It is known to majority of compilers. You should also use C_INCLUDE_PATH and/or CPLUS_INCLUDE_PATH. These two a more gcc specific (other ...
White Owl's user avatar
  • 5,297
2 votes

Unable to use GTK on Debian, due to having libraries always be missing

You need to sudo apt install libgtk-3-dev then compile it with options obtained from pkg-config: gcc $(pkg-config --cflags gtk+-3.0) $(pkg-config --libs gtk+-3.0) -o prog program.c
Rongbo Wu's user avatar
2 votes

Compiling GCC failed on Openbsd 7.4 (configure: error: .... libgomp)

I remember trying this about two years ago and gave up. These are the rough steps we need to take: I tried downloading the official GCC sources and building it. It doesn't build on OpenBSD for ...
Samuel Chase's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible