Remove the deprecated -ld_classic and -fembed-bitcode flags from the NativeScript target

未关闭
#414 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
3-5 天
新手友好度
66/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
ios, javascript

调研方向

打开 v8ios.xcodeproj/project.pbxproj,检查引用行中 NativeScript target 的 Debug 和 Release OTHER_LDFLAGS 与 OTHER_CFLAGS 条目。移除已弃用的 flags,然后构建并链接列出的每个 iOS、模拟器、Mac Catalyst 和 visionOS slice;完成的标准是所有 slice 均成功,或任何仅限 visionOS 的例外都被严格限定并记录在案。

由索引模型根据 Issue 内容生成。

描述

The NativeScript target carries two linker/compiler flags that Apple has already retired. One of them is on a deprecation clock and will become a hard build failure.

-ld_classic

OTHER_LDFLAGS on the NativeScript target, both Debug and Release (v8ios.xcodeproj/project.pbxproj:2899 and :2992). Every link emits:

ld: warning: -ld_classic is deprecated and will be removed in a future release

It forces the old linker. Apple has said it is going away; when it does, this stops being a warning and starts failing the build.

It was added in bb364f95 ("feat(visionos): support for xros platform", #235), so it was most likely a workaround for a new-linker bug on xros at that time rather than something iOS ever needed. Whatever that bug was, it is worth re-testing against a current Xcode.

-fembed-bitcode

OTHER_CFLAGS on the same two configurations (:2896, :2989). Bitcode was deprecated in Xcode 14 and App Store submission has not accepted it for years. The flag is dead weight.

What needs doing

Remove both, then confirm the framework still links on every slicearm64-iphoneos, arm64-iphonesimulator, x86_64-iphonesimulator, arm64-maccatalyst, x86_64-maccatalyst, arm64-xros, arm64-xrsimulator. visionOS is the one that matters: it is the platform -ld_classic was introduced for, so if anything regresses it will be there, and a build that only checks iOS proves nothing.

If visionOS does still need the classic linker, the flag should at minimum be narrowed to the visionOS configurations only and carry a comment saying what breaks without it, so the next person is not left guessing.

Not to be confused with

The same links also emit ~174 copies of:

ld: warning: direct access in function '...' from file 'libv8_base_without_compiler.a(...)'
to global weak symbol 'std::__1::piecewise_construct' from file '...ModuleInternalCallbacks.o'
means the weak symbol cannot be overridden at runtime.

Those are benign and out of scope here. V8 is built with chromium's default -fvisibility=hidden while the framework's own translation units use Xcode's default visibility, so both sides emit the same libc++ weak symbol and V8's objects bind to ours directly. The symbol is an empty tag struct used only for compile-time dispatch:

struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { explicit piecewise_construct_t() = default; };
inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();

It has no state and its address is never compared, so duplicate definitions are indistinguishable. The warning matters for typeinfo/vtable symbols (breaks dynamic_cast and cross-boundary catch) or operator new/delete (breaks allocator replacement) — a classification of a full Release-iphoneos link found all 174 to be the one tag constant and none of those. Matching visibility would silence them, but the framework has no EXPORTED_SYMBOLS_FILE, so -fvisibility=hidden would also hide the ObjC class symbols the public API needs.

主要语言
JavaScript
星标
150
派生
43
平均合并
3 天 10 小时
30 天内合并 PR
22

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NativeScript/ios 的其他 Issue

查看 NativeScript/ios 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。