File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -222,7 +222,8 @@ public function patchBeforeSharedMake(): bool
222222 {
223223 $ config = (new SPCConfigUtil ($ this ->builder ))->config ([$ this ->getName ()], array_map (fn ($ l ) => $ l ->getName (), $ this ->builder ->getLibs ()));
224224 [$ staticLibs , $ sharedLibs ] = $ this ->splitLibsIntoStaticAndShared ($ config ['libs ' ]);
225- $ lstdcpp = str_contains ($ sharedLibs , '-lstdc++ ' ) ? '-lstdc++ ' : '' ;
225+ $ lstdcpp = str_contains ($ sharedLibs , '-l:libstdc++.a ' ) ? '-l:libstdc++.a ' : null ;
226+ $ lstdcpp ??= str_contains ($ sharedLibs , '-lstdc++ ' ) ? '-lstdc++ ' : '' ;
226227
227228 $ makefileContent = file_get_contents ($ this ->source_dir . '/Makefile ' );
228229 if (preg_match ('/^(.*_SHARED_LIBADD\s*=\s*)(.*)$/m ' , $ makefileContent , $ matches )) {
Original file line number Diff line number Diff line change @@ -60,7 +60,17 @@ public function patchBeforeMake(): bool
6060 protected function getSharedExtensionEnv (): array
6161 {
6262 $ env = parent ::getSharedExtensionEnv ();
63- $ env ['CPPFLAGS ' ] = $ env ['CXXFLAGS ' ];
63+ $ env ['CPPFLAGS ' ] = $ env ['CXXFLAGS ' ] . ' -Wno-attributes ' ;
6464 return $ env ;
6565 }
66+
67+ protected function splitLibsIntoStaticAndShared (string $ allLibs ): array
68+ {
69+ [$ static , $ shared ] = parent ::splitLibsIntoStaticAndShared ($ allLibs );
70+ if (str_contains (getenv ('PATH ' ), 'rh/devtoolset ' ) || str_contains (getenv ('PATH ' ), 'rh/gcc-toolset ' )) {
71+ $ static .= ' -l:libstdc++.a ' ;
72+ $ shared = str_replace ('-lstdc++ ' , '' , $ shared );
73+ }
74+ return [clean_spaces ($ static ), clean_spaces ($ shared )];
75+ }
6676}
You can’t perform that action at this time.
0 commit comments