@@ -823,7 +823,12 @@ async function buildPhp(config: BuildConfig): Promise<string> {
823
823
`${ launchpadRoot } /libzip.org/v1.11.4/lib/pkgconfig`
824
824
]
825
825
826
- buildEnv . PKG_CONFIG_PATH = pkgConfigPaths . join ( ':' )
826
+ // Filter out libstdcxx paths from PKG_CONFIG_PATH on Linux
827
+ const filteredPkgConfigPaths = config . platform === 'linux'
828
+ ? pkgConfigPaths . filter ( path => ! path . includes ( 'libstdcxx' ) )
829
+ : pkgConfigPaths
830
+
831
+ buildEnv . PKG_CONFIG_PATH = filteredPkgConfigPaths . join ( ':' )
827
832
828
833
// Set up targeted library and include paths
829
834
const libPaths = [
@@ -865,18 +870,16 @@ async function buildPhp(config: BuildConfig): Promise<string> {
865
870
libPaths . push ( `${ launchpadRoot } /gnu.org/libiconv/v1.18.0/lib` )
866
871
includePaths . push ( `${ launchpadRoot } /gnu.org/libiconv/v1.18.0/include` )
867
872
pkgConfigPaths . push ( `${ launchpadRoot } /gnu.org/libiconv/v1.18.0/lib/pkgconfig` )
873
+ // Re-apply filtering with iconv added (no libstdcxx on macOS)
868
874
buildEnv . PKG_CONFIG_PATH = pkgConfigPaths . join ( ':' )
869
875
}
870
876
871
- // Filter out libstdcxx and gcc paths on Linux to avoid linking issues
877
+ // Filter out libstdcxx paths on Linux to avoid linking issues
872
878
const filteredLibPaths = config . platform === 'linux'
873
- ? libPaths . filter ( path => ! path . includes ( 'libstdcxx' ) && ! path . includes ( 'gcc' ) )
879
+ ? libPaths . filter ( path => ! path . includes ( 'libstdcxx' ) )
874
880
: libPaths
875
881
876
- const ldflags = filteredLibPaths . map ( path => `-L${ path } ` ) . join ( ' ' )
877
- buildEnv . LDFLAGS = config . platform === 'linux'
878
- ? `${ ldflags } -lstdc++`
879
- : ldflags
882
+ buildEnv . LDFLAGS = filteredLibPaths . map ( path => `-L${ path } ` ) . join ( ' ' )
880
883
buildEnv . CPPFLAGS = includePaths . map ( path => `-I${ path } ` ) . join ( ' ' )
881
884
882
885
// Add macOS-specific linker flags for DNS resolver functions
@@ -904,12 +907,9 @@ async function buildPhp(config: BuildConfig): Promise<string> {
904
907
buildEnv . CXX = 'g++'
905
908
buildEnv . CFLAGS = ( buildEnv . CFLAGS || '' ) + ' -O2 -fPIC'
906
909
buildEnv . CXXFLAGS = ( buildEnv . CXXFLAGS || '' ) + ' -O2 -fPIC'
907
- // Force use of system libstdc++ and prevent Launchpad gcc paths
908
- buildEnv . LDFLAGS = ( buildEnv . LDFLAGS || '' ) + ' -lstdc++'
910
+ // Use system libstdc++ instead of Launchpad's to avoid linking issues
909
911
// Set preprocessor to avoid traditional-cpp issues
910
912
buildEnv . CPP = 'gcc -E'
911
- // Clear any existing PKG_CONFIG_PATH that might include gcc paths
912
- buildEnv . PKG_CONFIG_PATH = pkgConfigPaths . filter ( path => ! path . includes ( 'gcc' ) ) . join ( ':' )
913
913
// Disable iconv completely on Linux due to glibc errno check failure
914
914
}
915
915
0 commit comments