From 6b81b3e6a8ac208c0941536d4388f19fb85efc72 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 12 Oct 2013 19:55:10 +0100 Subject: Try to fix xmlsec startup on OS X. --- src/lib/cross.cc | 30 +++++++++++++++++++++--------- src/lib/cross.h | 3 +++ src/lib/util.cc | 9 +++++++++ 3 files changed, 33 insertions(+), 9 deletions(-) (limited to 'src/lib') diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 47f07cf9d..30a953bb8 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -35,6 +35,7 @@ #include #include #endif +#include "exceptions.h" using std::pair; using std::list; @@ -114,6 +115,24 @@ cpu_info () return info; } +#ifdef DCPOMATIC_OSX +/** @return Path of the Contents directory in the .app */ +boost::filesystem::path +app_contents () +{ + uint32_t size = 1024; + char buffer[size]; + if (_NSGetExecutablePath (buffer, &size)) { + throw StringError ("_NSGetExecutablePath failed"); + } + + boost::filesystem::path path (buffer); + path.remove_filename (); + path.remove_filename (); + return path; +} +#endif + void run_ffprobe (boost::filesystem::path content, boost::filesystem::path out, shared_ptr log) { @@ -189,15 +208,8 @@ run_ffprobe (boost::filesystem::path content, boost::filesystem::path out, share #endif #ifdef DCPOMATIC_OSX - uint32_t size = 1024; - char buffer[size]; - if (_NSGetExecutablePath (buffer, &size)) { - log->log ("_NSGetExecutablePath failed"); - return; - } - - boost::filesystem::path path (buffer); - path.remove_filename (); + boost::filesystem::path path = app_contents(); + path /= "MacOS"; path /= "ffprobe"; string ffprobe = path.string() + " \"" + content.string() + "\" 2> \"" + out.string() + "\""; diff --git a/src/lib/cross.h b/src/lib/cross.h index c3bb20b47..1fe34edbe 100644 --- a/src/lib/cross.h +++ b/src/lib/cross.h @@ -30,3 +30,6 @@ extern std::string cpu_info (); extern void run_ffprobe (boost::filesystem::path, boost::filesystem::path, boost::shared_ptr); extern std::list > mount_info (); extern boost::filesystem::path openssl_path (); +#ifdef DCPOMATIC_OSX +extern boost::filesystem::path app_contents (); +#endif diff --git a/src/lib/util.cc b/src/lib/util.cc index 4b780e1b7..1d1372049 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -279,6 +279,15 @@ dcpomatic_setup () avfilter_register_all (); +#ifdef DCPOMATIC_OSX + /* Add our lib directory to the libltdl search path so that + xmlsec can find xmlsec1-openssl. + */ + boost::filesystem::path lib = app_contents (); + lib /= "lib"; + lt_dladdsearchdir (lib.c_str ()); +#endif + libdcp::init (); Ratio::setup_ratios (); -- cgit v1.2.3 From 47fdbbdb51fd7fd3e0e8818422f11f9df4d4fa73 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 12 Oct 2013 20:05:47 +0100 Subject: Add missing include. --- src/lib/util.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/lib') diff --git a/src/lib/util.cc b/src/lib/util.cc index 1d1372049..c332790a6 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -69,6 +69,9 @@ extern "C" { #ifdef DCPOMATIC_WINDOWS #include "stack.hpp" #endif +#ifdef DCPOMATIC_OSX +#include +#endif #include "i18n.h" -- cgit v1.2.3 From 0213cd319d1d09fdb8ca7e96428e514f41ea8de7 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 12 Oct 2013 20:31:44 +0100 Subject: Debugging OS X xmlsec. --- src/lib/util.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'src/lib') diff --git a/src/lib/util.cc b/src/lib/util.cc index c332790a6..554631464 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -288,6 +288,7 @@ dcpomatic_setup () */ boost::filesystem::path lib = app_contents (); lib /= "lib"; + cout << "adding search dir " << lib.c_str() << "\n"; lt_dladdsearchdir (lib.c_str ()); #endif -- cgit v1.2.3 From 56139fd8f98ad306c32567c4b8070fe7ff18ab1e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 12 Oct 2013 20:42:16 +0100 Subject: More OS X debug. --- src/lib/util.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/util.cc b/src/lib/util.cc index 554631464..b90753103 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -288,7 +288,7 @@ dcpomatic_setup () */ boost::filesystem::path lib = app_contents (); lib /= "lib"; - cout << "adding search dir " << lib.c_str() << "\n"; + std::cout << "adding search dir " << lib.c_str() << "\n"; lt_dladdsearchdir (lib.c_str ()); #endif -- cgit v1.2.3 From 1e51605c2e235aed0debe80216755b51b2fec17c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 13 Oct 2013 02:29:33 +0100 Subject: OS X debugging. --- src/lib/cross.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/lib') diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 30a953bb8..30fe887f8 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -127,8 +127,11 @@ app_contents () } boost::filesystem::path path (buffer); + std::cout << "start " << path << "\n"; path.remove_filename (); + std::cout << "then " << path << "\n"; path.remove_filename (); + std::cout << "and then " << path << "\n"; return path; } #endif -- cgit v1.2.3 From 5f5ddd2a6c3b25619469b63652718c88d5a3f371 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 13 Oct 2013 03:02:30 +0100 Subject: More OS X debugging. --- src/lib/cross.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 30fe887f8..ac94e8015 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -127,10 +127,11 @@ app_contents () } boost::filesystem::path path (buffer); + path = boost::filesystem::canonical (path); std::cout << "start " << path << "\n"; - path.remove_filename (); + path = path.parent_path (); std::cout << "then " << path << "\n"; - path.remove_filename (); + path = path.parent_path (); std::cout << "and then " << path << "\n"; return path; } -- cgit v1.2.3 From e271f7ab5ff943f90e1443f72f914aa9332cd034 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 13 Oct 2013 03:33:16 +0100 Subject: More OS X debugging. --- src/lib/util.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/util.cc b/src/lib/util.cc index b90753103..eebcf89af 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -289,7 +289,8 @@ dcpomatic_setup () boost::filesystem::path lib = app_contents (); lib /= "lib"; std::cout << "adding search dir " << lib.c_str() << "\n"; - lt_dladdsearchdir (lib.c_str ()); +// lt_dladdsearchdir (lib.c_str ()); + setenv ("LTDL_LIBRARY_PATH", lib.c_str (), 1); #endif libdcp::init (); -- cgit v1.2.3 From ec9fef77094f5969d6c7452f1d03bcae745b30d1 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 13 Oct 2013 12:31:48 +0100 Subject: Hopefully final solution to the OS X startup problem. --- src/lib/util.cc | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/util.cc b/src/lib/util.cc index eebcf89af..b13d905bf 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -69,9 +69,6 @@ extern "C" { #ifdef DCPOMATIC_WINDOWS #include "stack.hpp" #endif -#ifdef DCPOMATIC_OSX -#include -#endif #include "i18n.h" @@ -288,8 +285,6 @@ dcpomatic_setup () */ boost::filesystem::path lib = app_contents (); lib /= "lib"; - std::cout << "adding search dir " << lib.c_str() << "\n"; -// lt_dladdsearchdir (lib.c_str ()); setenv ("LTDL_LIBRARY_PATH", lib.c_str (), 1); #endif -- cgit v1.2.3