11.9 C
Canberra
Tuesday, August 19, 2025

linker – iOS archiving for launch strips away international symbols


I’ve a cocoapods library.

  • This library has some C capabilities that I’ve uncovered globally:
#outline EXPORT __attribute__((visibility("default"), used, retain)) extern "C"

EXPORT void ios_prepare_request(const char *url) {
  // some obj-c code
}
  • Then internally a dylib is loaded. This dylib tries to name these capabilities.
  • When run through Xcode, the whole lot is working.
  • Nevertheless, once I bundle the app to TestFlight/Debugging deployment. There’s a stripping step that removes my international symbols. Due to this fact when I attempt to name any of the capabilities from the dylib in some unspecified time in the future it will get a null pointer reference and the app crashes.
  • I have been making an attempt to get round this with the assistance of one of many apple engineers, his suggestion is to make use of a linker flag -export_symbols_list, however it doesn’t matter what I attempted it would not work.
  • I’ve managed to get it working by disabled international stripping within the consumer goal xcconfig, however this clearly just isn’t best because it messes with the consumer goal.
  s.user_target_xcconfig = {
    'STRIP_STYLE' => 'non-global'
  }
  • By default cocoapods creates a static lib, so export_symbol_list will not work as it’s meant for dylibs, I attempted to unravel this by turning the lib right into a dynamic framework
s.static_framework = false
s.preserve_paths="exports.exp"
  s.pod_target_xcconfig= {
        # 'OTHER_LDFLAGS' => '$(inherited) -Wl,-exported_symbols_list,$(PODS_TARGET_SRCROOT)/exports.exp',
  }
  • With the default config an a static lib, claude suggests utilizing a -u flag and passing every image I must preserve alive, however this additionally doesn’t work
  s.user_target_xcconfig = {
    'OTHER_LDFLAGS' => '$(inherited) -Wl,-u,_ios_prepare_request'
  }

At this level I am out of concepts find out how to forestall the worldwide symbols from being stripped. Sooner or later I attempted passing the capabilities in a initialization perform however by some means they had been nonetheless being stripped.

Any recommendations what might work?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

[td_block_social_counter facebook="tagdiv" twitter="tagdivofficial" youtube="tagdiv" style="style8 td-social-boxed td-social-font-icons" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjM4IiwiZGlzcGxheSI6IiJ9LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" custom_title="Stay Connected" block_template_id="td_block_template_8" f_header_font_family="712" f_header_font_transform="uppercase" f_header_font_weight="500" f_header_font_size="17" border_color="#dd3333"]
- Advertisement -spot_img

Latest Articles