[Mageia-dev] %ldflags, a shared library (xchat-plugin)
Kamil Rytarowski
n54 at gmx.com
Mon Nov 28 05:42:31 CET 2011
Hello!
I am working with drakcowsay and I want to fix the warning:
*** WARNING: No build ID note found in
(...)/drakcowsay/BUILDROOT/drakcowsay-0.7-7.mga1.x86_64/usr/lib64/xchat/plugins/xchat-drakcowsay.so
This page http://xchat.org/docs/plugin20.html#intro says:
Most UNIX systems:
gcc -Wl,--export-dynamic -Wall -O1 -shared -fPIC myplugin.c -o
myplugin.so
In our .spec we have:
gcc -Wl,--export-dynamic -Wall -O1 -shared -fPIC -I.
xchat-%{name}.c -o xchat-%{name}.so
When I try to add %ldflags to it, it gives an error:
/tmp/cc5a8dDh.o: In function `drakcowsay_timeout_cb':
xchat-drakcowsay.c:(.text+0x60): undefined reference to `xchat_commandf'
xchat-drakcowsay.c:(.text+0xcd): undefined reference to `xchat_commandf'
/tmp/cc5a8dDh.o: In function `xchat_plugin_init':
xchat-drakcowsay.c:(.text+0x1ed): undefined reference to `xchat_hook_timer'
xchat-drakcowsay.c:(.text+0x200): undefined reference to `xchat_print'
/tmp/cc5a8dDh.o: In function `xchat_plugin_deinit':
xchat-drakcowsay.c:(.text+0x24c): undefined reference to `xchat_print'
collect2: ld returned 1 exit status
So I've extracted the parameters for gcc from %ldflags and removed
-Wl,--no-undefined.
The current line is:
gcc -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-O1
-Wl,--build-id -Wl,--enable-new-dtags -Wl,--export-dynamic -Wall -O1
-shared -fPIC -I. xchat-drakcowsay.c -o xchat-drakcowsay.so
Is it right (for a shared library/ plugin)?
More information about the Mageia-dev
mailing list