xmake-io / xmake

šŸ”„ A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
9.87k stars 776 forks source link

Build failure when output of `uname -m` contains a space (e.g. on PowerPC Macs) #5469

Closed ryandesign closed 1 month ago

ryandesign commented 1 month ago

Xmake Version

2.9.4

Operating System Version and Architecture

Mac OS X 10.6 PowerPC

Describe Bug

The configure script (both the one in the root of the repository and the one in core/src/tbox/tbox) stores the output of uname -m converted to lowercase in the variable os_arch:

https://github.com/xmake-io/xmake/blob/0eca52f9590f9fc4015cb9e4ea9b34d89522c85e/configure#L642

On a PowerPC Mac, uname -m returns Power Macintosh so os_arch is power macintosh. This value seems to end up being used in a directory name based on this configure output:

build/macosx/power macintosh/release/xmake.config.h is generated!

but the variable is not quoted everywhere it is being used when passed to the shell which results in problems due to the space, for example this build failure that occurs:

powerpc-apple-darwin10-gcc-4.2.1: macintosh/release/core/src/lua/lua/lcode.c.o: No such file or directory

Here's the MacPorts bug report about this: https://trac.macports.org/ticket/70544

It might be prudent to translate any spaces to underscores.

You already translate several known values from the uname -m output into other values:

https://github.com/xmake-io/xmake/blob/0eca52f9590f9fc4015cb9e4ea9b34d89522c85e/configure#L643-L651

You may also want to detect power macintosh and translate it to ppc or powerpc; I'm not sure how you use this value other than as a directory name.

Expected Behavior

Successful build

Project Configuration

?

Additional Information and Error Logs

?

waruqi commented 1 month ago

you can open a pr to improve it. use ppc and ppc64

waruqi commented 1 month ago

try it again. dev branch.