-
-
Notifications
You must be signed in to change notification settings - Fork 37
Description
What were you trying to do?
Build an iOS app using php artisan native:run ios on both physical and simulator
What happened?
Build fails with linker errors. libphp.a (GD extension) references png_* symbols but libpng
is not linked in the generated Xcode project.
Affects both simulator (Debug-iphonesimulator) and device (Debug-iphoneos) targets.
How to reproduce the bug
- php artisan native:install ios --force
- php artisan native:run ios
- Build fails at linker stage
Debug Output
"_png_create_read_struct", referenced from:
_php_gd_gdImageCreateFromPngCtx in libphp.a(gd_png.o)
"_png_write_info", referenced from:
_php_gd_gdImagePngCtxEx in libphp.a(gd_png.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1
Missing symbols include: png_create_read_struct, png_create_write_struct,
png_destroy_read_struct, png_destroy_write_struct, png_get_IHDR, png_get_PLTE,
png_read_image, png_write_image, png_write_info, png_write_end, and ~15 more.
The static libraries exist but aren't linked:
$ ls nativephp/ios/Libraries/iphonesimulator/libpng*
libpng.a
libpng16.a
$ ls nativephp/ios/Libraries/iphoneos/libpng*
libpng.a
libpng16.a
$ ls nativephp/ios/Include/libpng16/
png.h pngconf.h pnglibconf.h
But project.pbxproj only links -lresolv:
OTHER_LDFLAGS = (
"$(inherited)",
"-lresolv",
);
Which operating systems have you seen this occur on?
macOS
Which platforms were you trying to build for?
iOS (Simulator)
Notes
- nativephp/mobile: v3.1.x-dev (mobile-air repo)
- macOS: Darwin 24.6.0
- Xcode: Latest (ran xcodebuild -runFirstLaunch before build)
- CocoaPods: Installed successfully, issue is in the Xcode project template
- Suggested fix: Add -lpng16 to OTHER_LDFLAGS in the generated project.pbxproj