[m-rev.] For review: Fix Darwin shared libs on source distribution
Ian MacLarty
maclarty at cs.mu.OZ.AU
Mon Nov 1 15:03:37 AEDT 2004
On Sun, Oct 31, 2004 at 05:14:48PM +1100, Julien Fischer wrote:
>
> > I agree with you. But I think as far as the build process for the
> > Mercury compiler goes the new options should be disabled and the
> > -install_name should be passed manually to .dylib targets. This is way
> > simpler than having different cases for (i) a c source distribution
> > generated on Darwin, (ii) a c source distribution generated on another
> > platform and (iii) the Mercury source. In my experience simpler is
> > normally better. And we're not breaking anything by doing this as far
> > as I can see.
> >
> Ok - let's go with this then.
>
Right, then here's the new diff and CVS log. This takes the place of the
previous one.
Estimated hours taken: 8
Branches: main
Fix shared libs on Mac OS X for the source distribution. The problem is that
the source distribution is generated on a Linux PC, so the Darwin-specific
-install_name linker option is not passed to the linker in the .dep files.
The fix is to instead pass the -install_name linker option in the Mmakefiles.
However this means that the -install_name linker option will be passed twice if
the .dep files are generated on a Darwin system, so we disable the
--shlib-linker-use-install-name mmc flag so that the -install_name linker
option is not passed in the .dep files.
Also change the default install-name path to the value of
FINAL_INSTALL_MERC_LIB_DIR, instead of just INSTALL_MERC_LIB_DIR in case the
install directory is different from the final install directory.
Makefile
Remove .dylib files when cleaning.
browser/Mmakefile
library/Mmakefile
Pass -install_name linker option when building .dylib targets.
Disable --shlib-linker-use-install-name mmc option.
compiler/options.m
Change default value of --shlib-linker-install-name-path to the value
of FINAL_INSTALL_MERC_LIB_DIR, instead of INSTALL_MERC_LIB_DIR.
Index: Makefile
===================================================================
RCS file: /home/mercury1/repository/mercury/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- Makefile 16 May 2002 06:48:32 -0000 1.11
+++ Makefile 1 Nov 2004 00:50:26 -0000
@@ -43,7 +43,7 @@
.PHONY: clean
clean:
- -rm -f */*.o */*.pic_o */*.a */*.so
+ -rm -f */*.o */*.pic_o */*.a */*.so */*.dylib
-rm -rf */Mercury/os */Mercury/pic_os */Mercury/libs
-rm -f compiler/mercury_compile profiler/mercury_profile
-rm -f util/mdemangle util/mkinit
Index: browser/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/Mmakefile,v
retrieving revision 1.41
diff -u -r1.41 Mmakefile
--- browser/Mmakefile 19 Oct 2004 06:01:36 -0000 1.41
+++ browser/Mmakefile 1 Nov 2004 00:50:26 -0000
@@ -58,6 +58,27 @@
MLLIBS += $(SOCKET_LIBRARY) $(NSL_LIBRARY) $(DL_LIBRARY) \
$(READLINE_LIBRARIES)
+#-----------------------------------------------------------------------------#
+
+# Set the install name for Darwin shared libraries. We disable the
+# --shlib-linker-use-install-name mmc option so that the -install_name linker
+# option is not passed in the .dep files. We do this to avoid a problem when
+# building from the c source distribution: if the c source distribution is
+# generated on a non-Darwin system then the -install_name option is not passed
+# in the .dep files, so it must be passed here, however if a c source
+# distribution is generated on a Darwin system then by default the
+# -install_name option will be passed in the .dep files which will cause it
+# to be passed twice (here and in the .dep files), so we disable the mmc option
+# which causes the -install_name option to be passed in the .dep files.
+
+MCFLAGS += --no-shlib-linker-use-install-name
+LD_LIBFLAGS-libmer_browser.dylib = -install_name \
+ $(FINAL_INSTALL_MERC_LIB_DIR)/libmer_browser.dylib
+LD_LIBFLAGS-libmer_mdbcomp.dylib = -install_name \
+ $(FINAL_INSTALL_MERC_LIB_DIR)/libmer_mdbcomp.dylib
+
+#-----------------------------------------------------------------------------#
+
JAVACFLAGS = -classpath $(LIBRARY_DIR)
MTAGS = $(SCRIPTS_DIR)/mtags
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.434
diff -u -r1.434 options.m
--- compiler/options.m 20 Oct 2004 09:44:58 -0000 1.434
+++ compiler/options.m 1 Nov 2004 00:50:26 -0000
@@ -1281,7 +1281,8 @@
linker_error_undefined_flag - string("-Wl,-no-undefined"),
shlib_linker_use_install_name - bool(no),
shlib_linker_install_name_flag - string("-install_name "),
- shlib_linker_install_name_path - string("$(INSTALL_MERC_LIB_DIR)")
+ shlib_linker_install_name_path - string(
+ "$(FINAL_INSTALL_MERC_LIB_DIR)")
]).
option_defaults_2(build_system_option, [
% Build System Options
Index: library/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/library/Mmakefile,v
retrieving revision 1.135
diff -u -r1.135 Mmakefile
--- library/Mmakefile 31 May 2004 04:13:00 -0000 1.135
+++ library/Mmakefile 1 Nov 2004 00:50:26 -0000
@@ -113,6 +113,22 @@
LN = ln
#-----------------------------------------------------------------------------#
+# Set the install name for Darwin shared libraries. We disable the
+# --shlib-linker-use-install-name mmc option so that the -install_name linker
+# option is not passed in the .dep files. We do this to avoid a problem when
+# building from the c source distribution: if the c source distribution is
+# generated on a non-Darwin system then the -install_name option is not passed
+# in the .dep files, so it must be passed here, however if a c source
+# distribution is generated on a Darwin system then by default the
+# -install_name option will be passed in the .dep files which will cause it
+# to be passed twice (here and in the .dep files), so we disable the mmc option
+# which causes the -install_name option to be passed in the .dep files.
+
+MCFLAGS += --no-shlib-linker-use-install-name
+LD_LIBFLAGS-libmer_std.dylib = -install_name \
+ $(FINAL_INSTALL_MERC_LIB_DIR)/libmer_std.dylib
+
+#-----------------------------------------------------------------------------#
# Stuff for Windows DLLS using gnu-win32
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list