@@ -235,8 +235,10 @@ protected function sanityCheck(int $build_target): void
235235 $ lens .= ' -static ' ;
236236 }
237237 $ dynamic_exports = '' ;
238+ $ embedType = 'static ' ;
238239 // if someone changed to EMBED_TYPE=shared, we need to add LD_LIBRARY_PATH
239240 if (getenv ('SPC_CMD_VAR_PHP_EMBED_TYPE ' ) === 'shared ' ) {
241+ $ embedType = 'shared ' ;
240242 if (PHP_OS_FAMILY === 'Darwin ' ) {
241243 $ ext_path = 'DYLD_LIBRARY_PATH= ' . BUILD_LIB_PATH . ':$DYLD_LIBRARY_PATH ' ;
242244 } else {
@@ -255,18 +257,19 @@ protected function sanityCheck(int $build_target): void
255257 }
256258 }
257259 $ cc = getenv ('CC ' );
260+
258261 [$ ret , $ out ] = shell ()->cd ($ sample_file_path )->execWithResult ("{$ cc } -o embed embed.c {$ lens } {$ dynamic_exports }" );
259262 if ($ ret !== 0 ) {
260263 throw new ValidationException (
261- 'embed failed sanity check: build failed . Error message: ' . implode ("\n" , $ out ),
262- validation_module: ' static libphp.a sanity check '
264+ 'embed failed to build. Error message: ' . implode ("\n" , $ out ),
265+ validation_module: $ embedType . ' libphp embed build sanity check '
263266 );
264267 }
265268 [$ ret , $ output ] = shell ()->cd ($ sample_file_path )->execWithResult ($ ext_path . './embed ' );
266269 if ($ ret !== 0 || trim (implode ('' , $ output )) !== 'hello ' ) {
267270 throw new ValidationException (
268- 'embed failed sanity check: run failed . Error message: ' . implode ("\n" , $ output ),
269- validation_module: ' static libphp.a sanity check '
271+ 'embed failed to run. Error message: ' . implode ("\n" , $ output ),
272+ validation_module: $ embedType . ' libphp embed run sanity check '
270273 );
271274 }
272275 }
0 commit comments