https://bugzilla.novell.com/show_bug.cgi?id=674696
https://bugzilla.novell.com/show_bug.cgi?id=674696#c2
Philipp Thomas changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |pth@novell.com
Resolution| |INVALID
AssignedTo|pth@novell.com |rguenther@novell.com
--- Comment #2 from Philipp Thomas 2011-02-24 18:13:11 CET ---
The bug is in your example as gcc/ld behave as documented.
gcc -shared lib-search-bug.c -o liblib-search-bug.so
creates a shared library.
gcc -L. lib-search-bug.c -llib-search-bug
first compiles lib-search-bug.c (which does indeed have no 'main') to
lib-search-bug.o and then tries to link to the shared library. In doing so it
discovers that there is no main defined which has to be present to create an
executable so ld exits without trying to link in the library.
If I modify your example to
# cat lib-search-bug-main.c
extern int openSuSE_gcc_bug_lib_search;
int main(int argc, char *argv[])
{
openSuSE_gcc_bug_lib_search = 1;
return 0;
}
And then do
gcc -L. -o lib-search-bug lib-search-bug-main.c -llib-search-bug
I do indeed get
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld:
cannot find -llib-search-bug
collect2: ld returned 1 exit status
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.