From 0353fc1c717d9bf1c0a6d082dcc8cbd549214d01 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 25 Jun 2018 14:43:27 +0200 Subject: Various Mac OS-related fixes --- odb/buildfile | 17 +++++++++++++++++ odb/odb.cxx | 9 ++++++--- tests/testscript | 6 +++--- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/odb/buildfile b/odb/buildfile index fd7701a..fda17c7 100644 --- a/odb/buildfile +++ b/odb/buildfile @@ -6,6 +6,12 @@ define plugin: libs plugin{*}: bin.lib.prefix = # No lib prefix. plugin{*}: backlink = true # Backlink in forwarded configs (next to exe). +# For now we use the .so extension everywhere except Windows (see +# plugin_path() in odb.cxx for details). +# +if ($cxx.target.class != 'windows') + plugin{*}: extension = so + # By default install the plugin next to the driver. # # On Windows this is the only sane option where we want the plugin (odb.dll) @@ -32,6 +38,10 @@ gxx_name = $regex.replace($gxx_name, '\\', '\\\\') # Escape back slashes. import libs = libcutl%lib{cutl} import libs += libstudxml%lib{studxml} +# @@ We need to somehow make exe depend on plugin but not link it so that +# when, for example, exe is imported, plugin is updated as well. Feels +# related to those ad hoc inputs. + ./: exe{odb} plugin{odb} exe{odb}: cxx{odb} @@ -39,8 +49,15 @@ exe{odb}: libus{odb}: bin.whole = false plugin{odb}: libus{odb} +# On Windows we have to link the import stub. +# if ($cxx.target.system == 'mingw32') plugin{odb}: cxx.libs += $plugin_dir/cc1plus.exe.a +# +# On Mac OS we have to allow undefined symbols. +# +elif ($cxx.target.system == 'darwin') + plugin{odb}: cxx.loptions += -undefined dynamic_lookup libus{odb}: {hxx ixx txx cxx}{** -odb -options} {hxx ixx cxx}{options} $libs diff --git a/odb/odb.cxx b/odb/odb.cxx index 28c4558..5160985 100644 --- a/odb/odb.cxx +++ b/odb/odb.cxx @@ -1517,9 +1517,12 @@ plugin_path (path const& drv, { #ifdef _WIN32 char const plugin_ext[] = ".dll"; -//@@ BUILD2: not clear how it works currently with build/autotools. Also -// note that GCC currently uses the .so extension on Mac OS. -//#elif defined(__APPLE__) + +// While GCC 8 switched to using .dylib as the plugin extension, there is a +// bug in the extension stripping code. So for now we use the .so extension +// everywhere (see also buildfile if changing this). +// +//#elif defined(__APPLE__) && defined(ODB_BUILD2) // char const plugin_ext[] = ".dylib"; #else char const plugin_ext[] = ".so"; diff --git a/tests/testscript b/tests/testscript index 516aa5b..4641300 100644 --- a/tests/testscript +++ b/tests/testscript @@ -15,8 +15,8 @@ EOO : plugin loading and invocation using the --trace option that suppresses the : standard prologue/epilogue (which includes the libodb headers). : -touch empty.hxx; -$* -d sqlite --trace empty.hxx 2>>~/EOE/ != 0 +cat <'// dummy' >=dummy.hxx; +$* -d sqlite --trace dummy.hxx 2>>~/EOE/ != 0 /.*/* -empty.hxx: error: unable to resolve odb namespace +dummy.hxx: error: unable to resolve odb namespace EOE -- cgit v1.1