@@ -805,8 +805,8 @@ async function buildPhp(config: BuildConfig): Promise<string> {
805
805
806
806
buildEnv . PATH = `${ launchpadBinPaths . join ( ':' ) } :${ buildEnv . PATH } `
807
807
808
- // Set up targeted PKG_CONFIG_PATH for essential libraries
809
- const pkgConfigPaths = [
808
+ // Set up targeted PKG_CONFIG_PATH for essential libraries (exclude libstdcxx on Linux)
809
+ let pkgConfigPaths = [
810
810
`${ launchpadRoot } /sourceware.org/bzip2/v1.0.8/lib/pkgconfig` ,
811
811
`${ launchpadRoot } /zlib.net/v1.3.1/lib/pkgconfig` ,
812
812
`${ launchpadRoot } /curl.se/v8.15.0/lib/pkgconfig` ,
@@ -822,16 +822,20 @@ async function buildPhp(config: BuildConfig): Promise<string> {
822
822
`${ launchpadRoot } /sqlite.org/v3.47.2/lib/pkgconfig` ,
823
823
`${ launchpadRoot } /libzip.org/v1.11.4/lib/pkgconfig`
824
824
]
825
-
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
825
831
- buildEnv . PKG_CONFIG_PATH = filteredPkgConfigPaths . join ( ':' )
826
+ // Completely exclude libstdcxx and gcc paths on Linux
827
+ if ( config . platform === 'linux' ) {
828
+ pkgConfigPaths = pkgConfigPaths . filter ( path =>
829
+ ! path . includes ( 'libstdcxx' ) &&
830
+ ! path . includes ( 'gcc' ) &&
831
+ ! path . includes ( 'gnu.org/gcc' )
832
+ )
833
+ }
834
+
835
+ buildEnv . PKG_CONFIG_PATH = pkgConfigPaths . join ( ':' )
832
836
833
- // Set up targeted library and include paths
834
- const libPaths = [
837
+ // Set up targeted library and include paths (exclude libstdcxx on Linux)
838
+ let libPaths = [
835
839
`${ launchpadRoot } /sourceware.org/bzip2/v1.0.8/lib` ,
836
840
`${ launchpadRoot } /zlib.net/v1.3.1/lib` ,
837
841
`${ launchpadRoot } /curl.se/v8.15.0/lib` ,
@@ -847,6 +851,15 @@ async function buildPhp(config: BuildConfig): Promise<string> {
847
851
`${ launchpadRoot } /sqlite.org/v3.47.2/lib` ,
848
852
`${ launchpadRoot } /libzip.org/v1.11.4/lib`
849
853
]
854
+
855
+ // Completely exclude libstdcxx and gcc paths on Linux
856
+ if ( config . platform === 'linux' ) {
857
+ libPaths = libPaths . filter ( path =>
858
+ ! path . includes ( 'libstdcxx' ) &&
859
+ ! path . includes ( 'gcc' ) &&
860
+ ! path . includes ( 'gnu.org/gcc' )
861
+ )
862
+ }
850
863
851
864
const includePaths = [
852
865
`${ launchpadRoot } /sourceware.org/bzip2/v1.0.8/include` ,
@@ -874,12 +887,7 @@ async function buildPhp(config: BuildConfig): Promise<string> {
874
887
buildEnv . PKG_CONFIG_PATH = pkgConfigPaths . join ( ':' )
875
888
}
876
889
877
- // Filter out libstdcxx paths on Linux to avoid linking issues
878
- const filteredLibPaths = config . platform === 'linux'
879
- ? libPaths . filter ( path => ! path . includes ( 'libstdcxx' ) )
880
- : libPaths
881
-
882
- buildEnv . LDFLAGS = filteredLibPaths . map ( path => `-L${ path } ` ) . join ( ' ' )
890
+ buildEnv . LDFLAGS = libPaths . map ( path => `-L${ path } ` ) . join ( ' ' )
883
891
buildEnv . CPPFLAGS = includePaths . map ( path => `-I${ path } ` ) . join ( ' ' )
884
892
885
893
// Add macOS-specific linker flags for DNS resolver functions
0 commit comments