Bug 221321 - math/z3: Add SONAME to the linked library
Summary: math/z3: Add SONAME to the linked library
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Joseph Mingrone
URL:
Keywords: easy, needs-qa
Depends on:
Blocks: 219150
  Show dependency treegraph
 
Reported: 2017-08-07 20:52 UTC by Gleb Popov
Modified: 2018-01-23 11:20 UTC (History)
5 users (show)

See Also:
koobs: maintainer-feedback? (arrowd)
koobs: merge-quarterly?


Attachments
Patch (587 bytes, patch)
2017-08-07 20:52 UTC, Gleb Popov
arrowd: maintainer-approval+
Details | Diff
Patch (582 bytes, patch)
2017-08-17 19:45 UTC, Gleb Popov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gleb Popov freebsd_committer freebsd_triage 2017-08-07 20:52:58 UTC
Created attachment 185137 [details]
Patch
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2017-08-08 02:26:48 UTC
Please confirm this passes QA (poudriere) and in particular that an existing consumer/dependent port does not regress at link/runtime
Comment 2 Gleb Popov freebsd_committer freebsd_triage 2017-08-08 12:09:35 UTC
I'm not aware of any z3 users in ports tree, except security/klee ( https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219150 ). I confirm that this patch solves qa problem from that PR.

QA for z3 with this patch also passes.
Comment 3 Gleb Popov freebsd_committer freebsd_triage 2017-08-12 10:20:54 UTC
Bump.
Comment 4 Steve Wills freebsd_committer freebsd_triage 2017-08-17 17:17:01 UTC
Patch is malformed, please re-generate.
Comment 5 Gleb Popov freebsd_committer freebsd_triage 2017-08-17 19:45:10 UTC
Created attachment 185536 [details]
Patch

Right, it got reversed somehow.
Comment 6 Steve Wills freebsd_committer freebsd_triage 2017-08-18 03:17:30 UTC
(In reply to arrowd from comment #5)
Hmm, still doesn't apply for me.
Comment 7 Gleb Popov freebsd_committer freebsd_triage 2017-08-18 17:02:51 UTC
(In reply to Steve Wills from comment #6)

Strange, this is what `svn diff` gives me. Can you please show how you apply the patch and what it says?
Comment 8 Steve Wills freebsd_committer freebsd_triage 2017-08-22 02:29:49 UTC
(In reply to arrowd from comment #7)
$ patch -p2 < attachment.cgi\?id=185536                        
Hmm...  Looks like a unified diff to me...                                                                                                                                                        
The text leading up to this was:                
--------------------------                      
|Index: math/z3/files/patch-scripts_mk__util.py 
|===================================================================                             
|--- math/z3/files/patch-scripts_mk__util.py     (revision 447066)                               
|+++ math/z3/files/patch-scripts_mk__util.py     (working copy)                                  
--------------------------                      
Patching file files/patch-scripts_mk__util.py using Plan A...                                    
Hunk #1 failed at 14.                           
1 out of 1 hunks failed--saving rejects to files/patch-scripts_mk__util.py.rej                   
done
Comment 9 Gleb Popov freebsd_committer freebsd_triage 2017-08-27 15:42:23 UTC
Strange, it does apply to me. Ok, here are the contents of files/patch-scripts_mk__util.py

--- scripts/mk_util.py.orig     2016-11-07 22:02:30 UTC
+++ scripts/mk_util.py
@@ -49,7 +49,7 @@ C_COMPILERS=['gcc', 'clang']
 CSC_COMPILERS=['csc', 'mcs']
 JAVAC=None
 JAR=None
-PYTHON_PACKAGE_DIR=distutils.sysconfig.get_python_lib()
+PYTHON_PACKAGE_DIR=distutils.sysconfig.get_python_lib(prefix=getenv("PREFIX", None))
 BUILD_DIR='build'
 REV_BUILD_DIR='..'
 SRC_DIR='src'
@@ -2391,7 +2391,7 @@ def mk_config():
         check_ar()
         CXX = find_cxx_compiler()
         CC  = find_c_compiler()
-        SLIBEXTRAFLAGS = ''
+        SLIBEXTRAFLAGS = '%s -Wl,-soname,libz3.so.0' % LDFLAGS
         if GPROF:
             CXXFLAGS = '%s -pg' % CXXFLAGS
             LDFLAGS  = '%s -pg' % LDFLAGS

Just copy it over existing file.
Comment 10 Gleb Popov freebsd_committer freebsd_triage 2017-09-01 13:48:10 UTC
Bump-bump.
Comment 11 Mathieu Arnold freebsd_committer freebsd_triage 2017-09-05 11:05:45 UTC
The soname should probably be related to the version of the software, like the major version number, 4 in this case.
Comment 12 Gleb Popov freebsd_committer freebsd_triage 2017-09-05 11:07:47 UTC
(In reply to Mathieu Arnold from comment #11)
This looks much like bikeshedding. I chose 0 because this is sort of "default" value when upstream doesn't even care about soname versioning. What if they decide to add it and start versioning with 0? Then our 4 would be "newer" that their "0".
Comment 13 Joseph Mingrone freebsd_committer freebsd_triage 2017-09-05 11:32:19 UTC
It looks like this is _eventually_ going to make it upstream.

https://github.com/Z3Prover/z3/pull/739
Comment 14 Ed Maste freebsd_committer freebsd_triage 2017-09-05 13:06:40 UTC
For reference, from the linked pull request it looks upstream is using .so.<major>.<minor>

As a practical matter I don't think it much matters if we choose .so.0 and upstream's next update uses (e.g.) .so.4.4 or if we choose .so.4 and the future update uses .so.4.4.
Comment 15 commit-hook freebsd_committer freebsd_triage 2017-09-05 15:27:20 UTC
A commit references this bug:

Author: jrm
Date: Tue Sep  5 15:26:55 UTC 2017
New revision: 449291
URL: https://svnweb.freebsd.org/changeset/ports/449291

Log:
  math/z3: Patch to add SONAME to shared library

  Also ensure that python is available at build time when the PYTHON option
  (for python bindings) is off.

  PR:		221321
  Submitted by:	6yearold@gmail.com (maintainer)

Changes:
  head/math/z3/Makefile
  head/math/z3/files/patch-scripts_mk__util.py
Comment 16 Alex Dupre freebsd_committer freebsd_triage 2018-01-23 10:37:24 UTC
Shouldn't we add a symlink from libz3.so.0 to libz3.so ?
Comment 17 Gleb Popov freebsd_committer freebsd_triage 2018-01-23 11:20:18 UTC
(In reply to Alex Dupre from comment #16)

Yep, I've addressed this there:   https://reviews.freebsd.org/D13637