-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect 32-bit/64-bit correctly based on CFLAGS #2045
Conversation
The user might invoke cmake with CFLAGS containing "-m32" or (on OS X) "-arch i386" while on a 64-bit machine to indicate that it should build for 32-bit instead.
Thanks Ryan. I assume this is to fix #2044? FYI, GCC seems to believe this is undesirable via https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52096 so I'm not sure if this will benefit other platforms (using GCC). I'll leave this open for comments for a few days prior to merging. |
This does not address #2044. I see; I only checked with clang, not gcc, but I see now that gcc indeed does not honor this. In that case, using Ideally, you would not attempt to detect bitness at all in cmake, and would rely instead on preprocessor defines in your source code (for example, using |
Perhaps you can shed some light on this topic, because I reached out to MacPorts in regards to building for older platforms without much help via: #1270 (comment) Furthermore, we use Travis-CI to create our Win32 binaries and we'd love to use a similar technique for the DMGs, but we lack the expertise to do so. :) -Tres |
In Apple terminology, a universal binary is one built for multiple architectures. This facility was introduced in 2005 when Apple first started using Intel processors in Macs instead of PowerPC processors, and the point was to allow a developer to distribute a single program that would work on any Mac regardless of its processor. At that time, "universal" typically meant a binary built for both 32-bit PowerPC and 32-bit Intel, though it is possible to include even more architectures than that, such as 64-bit PowerPC and 64-bit Intel. Since Mac OS X 10.6 and later run only on Intel Macs, these days a universal binary typically contains only 32-bit Intel and 64-bit Intel parts. When it comes to software compiled from the command line, ideally a universal binary is produced by setting the environment variables If lmms does not support building for 32-bit Intel on OS X (and I assume it does not support PowerPC), then it's a moot point. The comment you referred me to in the other ticket seemed to be talking about building the program on a newer version of OS X while still letting it run on an older version of OS X. That's an unrelated concept. It is supposed to be possible to do that, by specifying the correct OS X SDK and the correct I'm aware of the existence of Travis-CI but am not familiar with it. The MacPorts project uses buildbot to automatically build its packages, but we build on the same OS X version the user will run on. (We have 5 buildbot instances, one each on Mac OS X 10.6, 10.7, 10.8, 10.9 and 10.10.) I'm not familiar with how we set that up, though I'm told it wasn't that difficult and I may be able to find more information about our setup for you if you want. Requiring that the version of OS X the user runs matches the version of OS X we built the binaries on is a strategy that works for MacPorts but is not what users of standalone Mac software would expect. They would expect that they can download a single program which works on any supported version of OS X, so I'm glad you're wanting to do that. Simply running the build on the earliest supported OS X version, like you're currently doing by building on Lion, is one reasonable way to accomplish that, though I understand how it might be more convenient to be able to do it from a newer version of OS X. |
Thanks, I suppose we'll continue doing it this way then. So back on topic, since we're already using |
Detect 32-bit/64-bit correctly based on CFLAGS
The user might invoke cmake with CFLAGS containing "-m32" or (on OS X) "-arch i386" while on a 64-bit machine to indicate that it should build for 32-bit instead.