Bug 6791 - Wrong linking order in cifs.upcall, libwbclient, and missing -lz in libwbclient, libnetapi
Summary: Wrong linking order in cifs.upcall, libwbclient, and missing -lz in libwbclie...
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.4
Classification: Unclassified
Component: Build environment (show other bugs)
Version: 3.4.2
Hardware: Other Linux
: P3 normal
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL: http://svn.mandriva.com/cgi-bin/viewv...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-08 09:30 UTC by Buchan Milne
Modified: 2009-10-09 02:01 UTC (History)
0 users

See Also:


Attachments
Patch fixing link order for cifs.upcall (767 bytes, patch)
2009-10-08 09:32 UTC, Buchan Milne
no flags Details
Patch fixing link order for libwbclient, and underlinking in libnetapi (1.27 KB, patch)
2009-10-08 09:37 UTC, Buchan Milne
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Buchan Milne 2009-10-08 09:30:09 UTC
When linking with -Wl,--no-undefined -Wl,--as-needed, cifs.upcall will not be linked successfully, reporting undefined references.

Linking bin/cifs.upcall
../librpc/ndr/ndr_compression.o: In function `ndr_push_compression_end':
ndr_compression.c:(.text+0x30f): undefined reference to `deflateInit2_'
ndr_compression.c:(.text+0x31c): undefined reference to `zError'
ndr_compression.c:(.text+0x34f): undefined reference to `deflate'
ndr_compression.c:(.text+0x361): undefined reference to `zError'
ndr_compression.c:(.text+0x3bf): undefined reference to `deflateReset'
ndr_compression.c:(.text+0x3cc): undefined reference to `zError'
ndr_compression.c:(.text+0x400): undefined reference to `deflateSetDictionary'
ndr_compression.c:(.text+0x40d): undefined reference to `zError'

This seems to be due to incorrect linking order (see http://wiki.mandriva.com/en/Overlinking#Wrong_linking_order)

The same error message is reported for libnetapi, but due to -lz being missing (underlinked breaking --as-needed), See http://wiki.mandriva.com/en/Underlinking.

Linking shared library bin/libnetapi.so.0                                            
../librpc/ndr/ndr_compression.o: In function `ndr_push_compression_end':             
ndr_compression.c:(.text+0x30f): undefined reference to `deflateInit2_'              
ndr_compression.c:(.text+0x31c): undefined reference to `zError'                     
ndr_compression.c:(.text+0x34f): undefined reference to `deflate'                    
ndr_compression.c:(.text+0x361): undefined reference to `zError'                     
ndr_compression.c:(.text+0x3bf): undefined reference to `deflateReset'               
ndr_compression.c:(.text+0x3cc): undefined reference to `zError'                     
ndr_compression.c:(.text+0x400): undefined reference to `deflateSetDictionary'       
ndr_compression.c:(.text+0x40d): undefined reference to `zError'                     
../librpc/ndr/ndr_compression.o: In function `ndr_pull_compression_start':           
ndr_compression.c:(.text+0x8f1): undefined reference to `inflateInit2_'              
ndr_compression.c:(.text+0x8fe): undefined reference to `zError'                     
ndr_compression.c:(.text+0x936): undefined reference to `inflate'                    
ndr_compression.c:(.text+0x948): undefined reference to `zError'                     
ndr_compression.c:(.text+0x9f2): undefined reference to `inflateReset'               
ndr_compression.c:(.text+0xa00): undefined reference to `zError'                     
ndr_compression.c:(.text+0xa32): undefined reference to `inflateSetDictionary'       
ndr_compression.c:(.text+0xa40): undefined reference to `zError'

libwbclient also has the wrong linking order (objects should precede libraries):

Linking shared library bin/libwbclient.so.0                                          
utils/smbfilter.c: In function ‘filter_request’:                                     
utils/smbfilter.c:115: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result                                                             
../nsswitch/libwbclient/wbclient.o: In function `wbcLibraryDetails':                 
wbclient.c:(.text+0xf7): undefined reference to `talloc_named_const'                 
wbclient.c:(.text+0x119): undefined reference to `talloc_strdup'                     
wbclient.c:(.text+0x13f): undefined reference to `talloc_free'                       
../nsswitch/libwbclient/wbclient.o: In function `wbcFreeMemory':                     
wbclient.c:(.text+0x17b): undefined reference to `talloc_free'


Patches to follow.
Comment 2 Buchan Milne 2009-10-08 09:37:24 UTC
Created attachment 4817 [details]
Patch fixing link order for libwbclient, and underlinking in libnetapi

Patch from http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/samba/current/SOURCES/samba-3.4-link-order.patch
Comment 3 Björn Jacke 2009-10-08 18:11:23 UTC
patch from #1 looks good, but for the first hunk which looks superfluous.

The second hunk from patch in #1 was already fixed in master, and should go into 3.4, indeed.

Full ack from me for patch from #2 for 3.4. I just checked in the required fix for master (first hunk only).

Karolin, do you want to take over? :-)
Comment 4 Karolin Seeger 2009-10-09 02:01:07 UTC
Pushed to v3-4-test. Will be included in the next bug fix release.
Closing out bug report.

Thanks!