Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between -lgcc_s and gcc

what is the difference between linking against gcc_s and gcc by means of LDFLAGS?

Is gcc_s a static library and gcc shared library?

Because I was looking for a solution where it is mentioned to link against gcc whereas only gcc_s works in my case. I wish to know the real difference.

<<hidden symbol `__name_here' in /some/library/path.a(_filename.o) is referenced by DSO

In this case, the problem is usually solved by adding either "-l gcc" or "gcc -print-libgcc-file-name" to the linking flags (LDFLAGS). However, unlike my other regular platforms (i386, amd64, sparc64) here it wasn't enough. After a lot of head-banging (to be fair, it also comes from the music) I realized that this flag is necessary both when linking the libc and the final executable file. link: http://people.defora.org/~khorben/200903.html

like image 233
kumar Avatar asked Dec 28 '10 16:12

kumar


People also ask

What is difference between G ++ and GCC?

DIFFERENCE BETWEEN g++ & gccg++ is used to compile C++ program. gcc is used to compile C program.

What is difference between CC and GCC?

CC is the name given to the UNIX Compiler Command. It is used as the default compiler command for your operating system and also is executable with the same command. GCC, on the other hand, is the GNU Compiler operating system.

Should I use GCC or G ++ for C++?

For c++ you should use g++. It's the same compiler (e.g. the GNU compiler collection). GCC or G++ just choose a different front-end with different default options.

What is GCC used for?

GCC is a key component of so-called "GNU Toolchain", for developing applications and writing operating systems. The GNU Toolchain includes: GNU Compiler Collection (GCC): a compiler suite that supports many languages, such as C/C++ and Objective-C/C++.


1 Answers

libgcc_s.so is a shared library, libgcc.a is a static library. They are not equivalent; it may be necessary to link both. libgcc_s contains global variables which must not have multiple copies in a process; the code in libgcc is safe to link multiple times.

like image 163
Martin v. Löwis Avatar answered Sep 18 '22 15:09

Martin v. Löwis