05-11-2009
gcc is just the compiler, not the linker. It will, however, run the linker for you (if you don't specify -c on the command line). There are many linker options. Here's the reference:
Link Options - Using the GNU Compiler Collection (GCC)
One way to do it is to specify --nostdlib and then specify all the libraries you do want your program linked to.
If you want more control over gcc's
default behavior, I suggest you read the following section:
Spec Files - Using the GNU Compiler Collection (GCC)
Basically, gcc is just a wrapper program which uses rules in a spec file to determine which programs to run and how, including the linker. By changing the spec file, you can control gcc's default behavior when running the linker.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hai
I have installed Linux 7.0 on my system and i have an doubt the
linker
i ran simple hello.c program with gcc compiler
gcc -c hello.c
i want linker to produce the output
so i put on the command line as
ld first.o -lc
but it is not running ver properly
but there is an... (1 Reply)
Discussion started by: rajashekaran
1 Replies
2. Programming
using SUN C++ I have a problem when I do a push_back on a vector. The linker gives me a undefined symbol error on __cxa_end_catch.
Any ideas, is there a library to include?
Thanks
Chris (1 Reply)
Discussion started by: CDurkin
1 Replies
3. UNIX for Advanced & Expert Users
Hi, I want to define a symbol in my code as:
extern int Address;
and then I'd like to define the symbol value in linker (ld) script file, so each time I change the hardware, I don't need to redefine the value in code, just use different linker script. I've gone through ld reference and didn't... (3 Replies)
Discussion started by: lzwierko
3 Replies
4. Linux
Hi All,
I m new to this group.
I m facing one problem during my linking of CPP code at Linux env.
after compliation i m getting error
"undefined reference to ....."
Please anyone help me to resolve this error.
Regards,
ASR
make: Leaving directory /fwk'
echo g++ -o server ... (1 Reply)
Discussion started by: ASRRAJ
1 Replies
5. HP-UX
Hi,
The necessary symbols in a shared library can be exported to the application using linker option --version-script in Linux. The same can be done in Hp-ux using linker option +e. This can also be done by listing all the global symbols with +e in a file with linker option ld -c filename in... (0 Replies)
Discussion started by: roopa_v
0 Replies
6. Programming
Hi,
I do not use the default linker, and instead us another one and pass this argument -Wl,--dynamic-linker=<path to linker> to gcc when compiling. However, what happens if the linker is not under /lib and /lib64 and I am not able to create a symlink to the linker in /lib or /lib64 due to no... (2 Replies)
Discussion started by: Shompis
2 Replies
7. Red Hat
Hello,
I'm experimenting a problem on my rh server.
Red Hat Enterprise Linux AS release 3 (Taroon Update 8)
2.4.21-47.ELsmp #1 SMP i686 i686 i386 GNU/Linux
It started with a segmentation fault on
#id root
To resolve it, I've installed
coreutils-4.5.3-28.4.i386.rpm
But, I... (6 Replies)
Discussion started by: gogol_bordello
6 Replies
8. Programming
I've tried to figure out what the linker is smoking in AIX to no avail...so I'm trying to find a little information to see why it's being inconsistent.
I have the following code in a shared library, it doesn't do anything useful, it's just there to exercise functions in a few system libraries:
... (11 Replies)
Discussion started by: DreamWarrior
11 Replies
9. Solaris
Hey guys
I have a solaris 10 OS, with a zone configured. In that zone, I am trying to install an Oracle Client. However, when I run the oracle installer, I get the following error:
ld.so.1: java: fatal: libexpat.so.0: open failed: No such file or directory
ld.so.1: java: fatal:... (2 Replies)
Discussion started by: goodvikings
2 Replies
10. UNIX and Linux Applications
I have to debug a function getopt_long in glibc-2.11.3-17.31.1.
For that how can I download and install its corresponding glibc-debug on SLES 11? (8 Replies)
Discussion started by: rupeshkp728
8 Replies
LEARN ABOUT DEBIAN
mklibs
MKLIBS(1) Debian User's Manual MKLIBS(1)
NAME
mklibs - make a minimal set of libraries
SYNOPSIS
mklibs [OPTION]... -d DESTINATION FILE...
DESCRIPTION
Place the minimal set of libraries required by FILE(s) in DESTINATION.
OPTIONS
-d DESTINATION, --dest-dir DESTINATION
Place the libraries in DESTINATION.
-D, --no-default-lib
Omit the default library path.
-L LIBDIR[:LIBDIR]...
Prepend LIBDIR(s) to the library search path.
--ldlib LDLIB
Use LDLIB for the dynamic linker.
--libc-extras-dir EXTRADIR
Use EXTRADIR to find extra libc files.
--target TARGET
Prepend TARGET- to the gcc and binutils calls.
--root ROOT
Search in ROOT- for library rpaths.
--sysroot SYSROOT
Locate libraries and associated files relative to SYSROOT.
--gcc-options OPTIONS
Pass OPTIONS to the compiler when relinking.
--libdir DIR
Use DIR (for example, lib64) in place of lib in default library paths.
-v, --verbose
Explain what is being done.
-h, --help
Display help and exit.
BUGS
mklibs does not support the --dry-run and --version options supported by mklibs.sh.
AUTHOR
This manual page was written by Matt Kraai.
Debian 2002-07-07 MKLIBS(1)