removing ldflags for openbsd

Matthieu Patou mat at
Mon Dec 13 07:40:12 MST 2010

Hi Tridge,

>   >  -    conf.ADD_LDFLAGS('-Wl,-no-undefined', testflags=True)
>   >  +    if sys.platform != "openbsd4":
>   >  +        conf.ADD_LDFLAGS('-Wl,-no-undefined', testflags=True)
> It would be better to fix the configure tests to test if the flags
> work correctly. If you can work out what actually fails on openbsd
> then we could add a test that ensures it works on all platforms.
Well the flag is accepted by openbsd but then it leads to strange 
behavior like the following:

you link a python shared library with -lm -lz -Wl,-as-needed 
-Wl,-no-undefined and you get the "strange" (strange for me because I'm 
not an expert at all in all the magic behind the linking phase) result 
that ldd as a dependency on but not on and 
then when starting samba you receive errors while loading the python 
libs that symbols atan, cos, ... are not defined.

One way to do the test is it is to do ldd on the resulting file to see 
if you have the dependency but I'm not sure that's the kind of test that 
we are ready to do.

Here is the result of what you get if you compile with -Wl,-no-undefined

[1/2] Compiling liblctest/liblc1.c
../liblctest/liblc1.c: In function 'lib_func':
../liblctest/liblc1.c:2: warning: unused variable 'f'
../liblctest/liblc1.c:2: warning: control reaches end of non-void function
['ccache', 'gcc', '-Wall', '-g', '-fPIC', '-DPIC', '-I/usr/local/include', '-D_SAMBA_BUILD_=4', '-DHAVE_CONFIG_H=1', '-D_GNU_SOURCE=1', '-D_XOPEN_SOURCE_EXTENDED=1', '../liblctest/liblc1.c', '-c', '-o', 'default/liblctest/liblc1_1.o']
[2/2] Linking default/
default/liblctest/liblc1_1.o(.text+0x17): In function `lib_func':
../liblctest/liblc1.c:2: undefined reference to `fopen'
collect2: ld returned 1 exit status

['ccache', 'gcc', 'default/liblctest/liblc1_1.o', '-o', '/home/build/build_farm/samba_4_0_test/source4/bin/.conf_check_0/testbuild2/default/', '-L/usr/local/lib', '-Wl,-no-undefined', '-shared']



More information about the samba-technical mailing list