Skip to content

Commit

Permalink
Fix runtime search path for shared-lib and add '-static' to the name …
Browse files Browse the repository at this point in the history
…of static-lib. (#5616)

* Fix runtime search path for shared-lib and add '-static' to static-lib.

* Revert the change on `META.in`.
  • Loading branch information
arbipher authored Oct 21, 2021
1 parent f05ac8a commit cd8d8bb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/mk_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2013,17 +2013,24 @@ def mk_makefile(self, out):
LIBZ3 = z3linkdep

LIBZ3 = LIBZ3 + ' ' + ' '.join(map(lambda x: '-cclib ' + x, LDFLAGS.split()))
if not STATIC_LIB:
dllpath = '-dllpath $$(%s printconf path)/stublibs' % OCAMLFIND
LIBZ3 = LIBZ3 + ' ' + dllpath

if DEBUG_MODE and not(is_cygwin()):
# Some ocamlmklib's don't like -g; observed on cygwin, but may be others as well.
OCAMLMKLIB += ' -g'

z3mls = os.path.join(self.sub_dir, 'z3ml')

LIBZ3ML = ''
if STATIC_LIB:
LIBZ3ML = '-oc ' + os.path.join(self.sub_dir, 'z3ml-static')

out.write('%s.cma: %s %s %s\n' % (z3mls, cmos, stubso, z3linkdep))
out.write('\t%s -o %s -I %s -L. %s %s %s\n' % (OCAMLMKLIB, z3mls, self.sub_dir, stubso, cmos, LIBZ3))
out.write('\t%s -o %s %s -I %s -L. %s %s %s\n' % (OCAMLMKLIB, z3mls, LIBZ3ML, self.sub_dir, stubso, cmos, LIBZ3))
out.write('%s.cmxa: %s %s %s %s.cma\n' % (z3mls, cmxs, stubso, z3linkdep, z3mls))
out.write('\t%s -o %s -I %s -L. %s %s %s\n' % (OCAMLMKLIB, z3mls, self.sub_dir, stubso, cmxs, LIBZ3))
out.write('\t%s -o %s %s -I %s -L. %s %s %s\n' % (OCAMLMKLIB, z3mls, LIBZ3ML, self.sub_dir, stubso, cmxs, LIBZ3))
out.write('%s.cmxs: %s.cmxa\n' % (z3mls, z3mls))
out.write('\t%s -linkall -shared -o %s.cmxs -I . -I %s %s.cmxa\n' % (OCAMLOPTF, z3mls, self.sub_dir, z3mls))

Expand All @@ -2041,6 +2048,7 @@ def mk_makefile(self, out):
self.mk_uninstall(out)
out.write('\n')

# The following three functions may be out of date.
def mk_install_deps(self, out):
if is_ml_enabled() and self._install_bindings():
out.write(get_component(Z3_DLL_COMPONENT).dll_name + '$(SO_EXT) ')
Expand Down

0 comments on commit cd8d8bb

Please sign in to comment.