Last Comment Bug 767403 - Fix dependent libs generation on *BSD after bug 763893
: Fix dependent libs generation on *BSD after bug 763893
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Build Config (show other bugs)
: Trunk
: x86 OpenBSD
: -- normal (vote)
: mozilla16
Assigned To: Landry Breuil (:gaston)
:
Mentors:
Depends on: 763893
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-22 08:41 PDT by Landry Breuil (:gaston)
Modified: 2012-06-27 03:35 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
also match libname on lib.*.so.* (1.03 KB, patch)
2012-06-22 13:19 PDT, Landry Breuil (:gaston)
no flags Details | Diff | Review
also match libname on lib.*.so.* (972 bytes, patch)
2012-06-24 06:10 PDT, Landry Breuil (:gaston)
mh+mozilla: review-
Details | Diff | Review
use fnmatch to match lib*.so.* (1.40 KB, patch)
2012-06-26 12:01 PDT, Landry Breuil (:gaston)
mh+mozilla: review+
Details | Diff | Review

Description Landry Breuil (:gaston) 2012-06-22 08:41:30 PDT
dependentlibs.py has the following snippet :

if ext == '.dll':
    func = dependentlibs_dumpbin
elif ext == '.so':
    func = dependentlibs_readelf
elif ext == '.dylib':
    func = dependentlibs_otool

This doesnt take into account all bsd platforms where configure.in sets DLL_SUFFIX to .so.1.0 (or to our controlled-versionning lib variable .so.${SO_VERSION} on OpenBSD), so this breaks with cryptic messages :

Traceback (most recent call last):
  File "/home/buildslave/mozilla-central-i386/build/xpcom/stub/dependentlibs.py", line 102, in <module>
    main()
  File "/home/buildslave/mozilla-central-i386/build/xpcom/stub/dependentlibs.py", line 99, in main
    print '\n'.join(dependentlibs(lib, options.libpaths, func))
UnboundLocalError: local variable 'func' referenced before assignment

I'd suggest matching elf platforms with elif ext[0:3] == '.so':, which i'm testing right now and will post a patch for if it works.
Comment 1 Landry Breuil (:gaston) 2012-06-22 11:27:54 PDT
Actually it's a bit more complicated since splitext returns .0 as ext...
Comment 2 Landry Breuil (:gaston) 2012-06-22 13:19:09 PDT
Created attachment 635884 [details] [diff] [review]
also match libname on lib.*.so.*

re.match on lib.*\.so\..* fixes the issue for me and probably netbsd/freebsd
Comment 3 Landry Breuil (:gaston) 2012-06-24 06:10:20 PDT
Created attachment 636154 [details] [diff] [review]
also match libname on lib.*.so.*

New patch rebased after #767024
Comment 4 Mike Hommey [:glandium] 2012-06-26 09:19:41 PDT
Comment on attachment 636154 [details] [diff] [review]
also match libname on lib.*.so.*

Review of attachment 636154 [details] [diff] [review]:
-----------------------------------------------------------------

::: xpcom/stub/dependentlibs.py
@@ +94,5 @@
>      lib = args[0]
>      ext = os.path.splitext(lib)[1]
>      if ext == '.dll':
>          func = dependentlibs_dumpbin
> +    elif ext == '.so' or re.match('lib.*\.so\..*',lib):

Please use fnmatch.fnmatch instead.
Comment 5 Landry Breuil (:gaston) 2012-06-26 12:01:01 PDT
Created attachment 636817 [details] [diff] [review]
use fnmatch to match lib*.so.*

Sure, that also works and is nicer (my python fu is weak)
Comment 6 Mike Hommey [:glandium] 2012-06-26 13:18:28 PDT
Comment on attachment 636817 [details] [diff] [review]
use fnmatch to match lib*.so.*

Review of attachment 636817 [details] [diff] [review]:
-----------------------------------------------------------------

::: xpcom/stub/dependentlibs.py
@@ +95,5 @@
>      lib = args[0]
>      ext = os.path.splitext(lib)[1]
>      if ext == '.dll':
>          func = dependentlibs_dumpbin
> +    elif ext == '.so' or fnmatch.fnmatch(lib,'lib*.so.*'):

Please add a whitespace after the comma.

I think you can lift the lib prefix and just use *.so.*
Comment 7 Landry Breuil (:gaston) 2012-06-26 13:50:31 PDT
Right, pushed it that way.

https://hg.mozilla.org/integration/mozilla-inbound/rev/c7b0713958d6
Comment 8 Ed Morley [:emorley] 2012-06-27 03:35:27 PDT
https://hg.mozilla.org/mozilla-central/rev/c7b0713958d6

Note You need to log in before you can comment on or make changes to this bug.