faithfracture / Apple-Boost-BuildScript

Script for building Boost for Apple platforms (iOS, iOS Simulator, tvOS, tvOS Simulator, OS X)
279 stars 111 forks source link

Dynamic framework #8

Closed v0n0 closed 6 years ago

v0n0 commented 8 years ago

Is there a way of building a dynamic cocoa touch framework of Boost with your script?

faithfracture commented 8 years ago

What do you mean by dynamic? As in a run-time linked framework? No, that is not possible. Not just from the scope of this script, but with iOS. You can only use static libraries. (At least for anything you want to submit to the AppStore. I'm not sure about enterprise apps).

On Sep 16, 2016, at 00:02, v0n0 notifications@github.com wrote:

Is there a way of building a dynamic cocoa touch framework of Boost with your script?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

v0n0 commented 8 years ago

Since iOS 8 Apple introduced Cocoa Touch Frameworks, which have dynamic linking. Apps can be submitted as long as they frameworks they use don't have a simulator slice in it and as long as they support iOS >= 8. Is that what you were asking?

faithfracture commented 8 years ago

I guess I’m not quite sure what it is you’re asking. This script already outputs a framework by default. They end up in the “./build/boost/{BOOST_VERSION}/{TARGET_PLATFORM}/framework” directories in the build directory. Frameworks are not dynamically linked (at least not in the same way that shared libraries are). They are compiled into the bundle at build time. I'm pretty sure (although admittedly I have not tried) you can't just swap them out for a different Framework at runtime. Unpacking any of my apps and looking in the package, there is never a framework file sitting in there (although there is a Frameworks directory, for some reason).

v0n0 commented 8 years ago

My issue is that I'm trying to compile a Cocoa Touch Framework project with Boost in it, compiled as a static framework. Apparently that doesn't work, I get linker errors like:

Undefined symbols for architecture arm64:
  "boost::date_time::gregorian_calendar_base<boost::date_time::year_month_day_base<boost::gregorian::greg_year, boost::gregorian::greg_month, boost::gregorian::greg_day>, unsigned int>::day_number(boost::date_time::year_month_day_base<boost::gregorian::greg_year, boost::gregorian::greg_month, boost::gregorian::greg_day> const&)"

but I can see that part of Boost was included in the framework:

$ otool -L boost.framework/boost 
Archive : boost.framework/boost
boost.framework/boost(atomic_lockpool.o):
boost.framework/boost(chrono_chrono.o):
boost.framework/boost(chrono_process_cpu_clocks.o):
boost.framework/boost(chrono_thread_clock.o):
boost.framework/boost(date_time_date_generators.o):
boost.framework/boost(date_time_greg_month.o):
boost.framework/boost(date_time_greg_weekday.o):
boost.framework/boost(exception_clone_current_exception_non_intrusive.o):
boost.framework/boost(filesystem_codecvt_error_category.o):
boost.framework/boost(filesystem_operations.o):
boost.framework/boost(filesystem_path.o):
boost.framework/boost(filesystem_path_traits.o):
boost.framework/boost(filesystem_portability.o):
boost.framework/boost(filesystem_unique_path.o):
boost.framework/boost(filesystem_utf8_codecvt_facet.o):
boost.framework/boost(filesystem_windows_file_codecvt.o):
boost.framework/boost(program_options_cmdline.o):
boost.framework/boost(program_options_config_file.o):
boost.framework/boost(program_options_convert.o):
boost.framework/boost(program_options_options_description.o):
boost.framework/boost(program_options_parsers.o):
boost.framework/boost(program_options_positional_options.o):
boost.framework/boost(program_options_split.o):
boost.framework/boost(program_options_utf8_codecvt_facet.o):
boost.framework/boost(program_options_value_semantic.o):
boost.framework/boost(program_options_variables_map.o):
boost.framework/boost(program_options_winmain.o):
boost.framework/boost(random_random_device.o):
boost.framework/boost(signals_connection.o):
boost.framework/boost(signals_named_slot_map.o):
boost.framework/boost(signals_signal_base.o):
boost.framework/boost(signals_slot.o):
boost.framework/boost(signals_trackable.o):
boost.framework/boost(system_error_code.o):
boost.framework/boost(thread_future.o):
boost.framework/boost(thread_once.o):
boost.framework/boost(thread_thread.o):
boost.framework/boost(unit_test_framework_compiler_log_formatter.o):
boost.framework/boost(unit_test_framework_debug.o):
boost.framework/boost(unit_test_framework_decorator.o):
boost.framework/boost(unit_test_framework_execution_monitor.o):
boost.framework/boost(unit_test_framework_framework.o):
boost.framework/boost(unit_test_framework_plain_report_formatter.o):
boost.framework/boost(unit_test_framework_progress_monitor.o):
boost.framework/boost(unit_test_framework_results_collector.o):
boost.framework/boost(unit_test_framework_results_reporter.o):
boost.framework/boost(unit_test_framework_test_tools.o):
boost.framework/boost(unit_test_framework_test_tree.o):
boost.framework/boost(unit_test_framework_unit_test_log.o):
boost.framework/boost(unit_test_framework_unit_test_main.o):
boost.framework/boost(unit_test_framework_unit_test_monitor.o):
boost.framework/boost(unit_test_framework_unit_test_parameters.o):
boost.framework/boost(unit_test_framework_xml_log_formatter.o):
boost.framework/boost(unit_test_framework_xml_report_formatter.o):

So I was trying to compile boost as a dynamic framework too.

The dependency structure is like this:

For reference framework 2 (another Cocoa Touch framework I compiled with Xcode) works and contains:

xxx.framework/xxx: Mach-O universal binary with 2 architectures
xxx.framework/xxx (for architecture armv7): Mach-O dynamically linked shared library arm
xxx.framework/xxx (for architecture arm64): Mach-O 64-bit dynamically linked shared library

as opposed to Boost from your script:

boost.framework/boost: Mach-O universal binary with 4 architectures
boost.framework/boost (for architecture armv7): current ar archive random library
boost.framework/boost (for architecture i386):  current ar archive random library
boost.framework/boost (for architecture x86_64):    current ar archive random library
boost.framework/boost (for architecture arm64): current ar archive random library
faithfracture commented 8 years ago

That's interesting. It's complaining about missing symbols for arc arm64, but as you can see they are clearly included in the Boost binary. I'm not really sure why it's having a problem. I'll try and see if I can figure out what the problem is when I get some time, but I can't say for sure when that will be. If you happen to figure it out before I do, please let me know what it was.

faithfracture commented 6 years ago

Were you ever able to figure out what was going on? If it's something that needed to be changed to the script, I'd like to know so I can add / fix it.

faithfracture commented 6 years ago

Closing due to inactivity.