[MacPorts] #41070: Wrong CMAKE_SYSTEM_HOST_PROCESSOR setting in cmake
#41070: Wrong CMAKE_SYSTEM_HOST_PROCESSOR setting in cmake --------------------+-------------------------------- Reporter: hjj@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.0 Keywords: cmake | Port: --------------------+-------------------------------- A test directory with a CMakeLists.txt with this one line: message("-- Processor type : ${CMAKE_HOST_SYSTEM_PROCESSOR}") returns (among all the other info) when doing "cmake .": -- Processor type : i386 However "uname -m" returns the correct x86_64 (on my MacBook Pro with i7 cpu). This is a big problem in our computational chemistry software development, where we use cmake to identify correct libraries, compilers, compiler flags etc. (project: http://daltonprogram.org) A colleague in USA suggests that we switch to homebrew to solve the problem of getting cmake to do the correct thing on both linux and darwin systems without dirty tricks, as testing for darwin and ports and then change explicitly to x86_64. I hope that I instead can persuade you to fix the problem. -- Ticket URL: <https://trac.macports.org/ticket/41070> MacPorts <http://www.macports.org/> Ports system for OS X
#41070: cmake: Wrong CMAKE_SYSTEM_HOST_PROCESSOR setting ---------------------+------------------- Reporter: hjj@… | Owner: css@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.0 Resolution: | Keywords: Port: cmake | ---------------------+------------------- Changes (by ryandesign@…): * cc: ryandesign@… (added) * owner: macports-tickets@… => css@… * keywords: cmake => * port: => cmake Old description:
A test directory with a CMakeLists.txt with this one line: message("-- Processor type : ${CMAKE_HOST_SYSTEM_PROCESSOR}") returns (among all the other info) when doing "cmake .": -- Processor type : i386
However "uname -m" returns the correct x86_64 (on my MacBook Pro with i7 cpu). This is a big problem in our computational chemistry software development, where we use cmake to identify correct libraries, compilers, compiler flags etc. (project: http://daltonprogram.org) A colleague in USA suggests that we switch to homebrew to solve the problem of getting cmake to do the correct thing on both linux and darwin systems without dirty tricks, as testing for darwin and ports and then change explicitly to x86_64. I hope that I instead can persuade you to fix the problem.
New description: A test directory with a CMakeLists.txt with this one line: {{{ message("-- Processor type : ${CMAKE_HOST_SYSTEM_PROCESSOR}") }}} returns (among all the other info) when doing "cmake .": {{{ -- Processor type : i386 }}} However "uname -m" returns the correct x86_64 (on my MacBook Pro with i7 cpu). This is a big problem in our computational chemistry software development, where we use cmake to identify correct libraries, compilers, compiler flags etc. (project: http://daltonprogram.org) A colleague in USA suggests that we switch to homebrew to solve the problem of getting cmake to do the correct thing on both linux and darwin systems without dirty tricks, as testing for darwin and ports and then change explicitly to x86_64. I hope that I instead can persuade you to fix the problem. -- Comment: Are you saying that Homebrew's cmake correctly identifies the processor? Or that a cmake compiled from the official sources does so? I would rather expect this to be an upstream issue, if it is an issue at all (I don't know what the developers intend for CMAKE_SYSTEM_HOST_PROCESSOR to represent). Note that "uname" does not necessarily tell you the best architecture to compile for, nor necessarily a valid architecture at all. On the PowerBook G4 I'm using today, "uname -m" says "Power Macintosh" whereas "uname -p" says "powerpc"; neither of those are valid PowerPC architectures (which would be something like "ppc" or "ppc7450"). On some early Intel Macs, "uname" might say "i386" because the computer uses a 32-bit kernel, while nevertheless being completely capable of running 64-bit usermode programs. Why do you need to know the architecture? If you don't specify one, the compiler will use a reasonable default architecture. -- Ticket URL: <https://trac.macports.org/ticket/41070#comment:1> MacPorts <http://www.macports.org/> Ports system for OS X
#41070: cmake: Wrong CMAKE_SYSTEM_HOST_PROCESSOR setting ----------------------+-------------------- Reporter: hjj@… | Owner: css@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.2.0 Resolution: invalid | Keywords: Port: cmake | ----------------------+-------------------- Changes (by larryv@…): * status: new => closed * resolution: => invalid Comment: Replying to [ticket:41070 hjj@…]:
A colleague in USA suggests that we switch to homebrew to solve the problem of getting cmake to do the correct thing on both linux and darwin systems without dirty tricks, as testing for darwin and ports and then change explicitly to x86_64. I hope that I instead can persuade you to fix the problem.
No. The problem is that you are using `CMAKE_HOST_SYSTEM_PROCESSOR` incorrectly. If you are not cross-compiling, `CMAKE_HOST_SYSTEM_PROCESSOR` [http://www.cmake.org/cmake/help/v2.8.12/cmake.html#variable:CMAKE_HOST_SYSTE... is equivalent] to `CMAKE_SYSTEM_PROCESSOR`, which is [http://www.cmake.org/cmake/help/v2.8.12/cmake.html#variable:CMAKE_SYSTEM_PRO... defined to be] the output of `uname -p` on *nix systems, not `uname -m`. On my 10.8.5 machine: {{{ % /usr/bin/uname -p i386 }}} If `CMAKE_HOST_SYSTEM_PROCESSOR` does not provide the information you require, then you need to find another way of obtaining that information. -- Ticket URL: <https://trac.macports.org/ticket/41070#comment:2> MacPorts <http://www.macports.org/> Ports system for OS X
#41070: cmake: Wrong CMAKE_SYSTEM_HOST_PROCESSOR setting ---------------------+---------------------- Reporter: hjj@… | Owner: css@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: 2.2.0 Resolution: | Keywords: Port: cmake | ---------------------+---------------------- Changes (by larryv@…): * status: closed => reopened * resolution: invalid => -- Ticket URL: <https://trac.macports.org/ticket/41070#comment:3> MacPorts <http://www.macports.org/> Ports system for OS X
#41070: cmake: Wrong CMAKE_SYSTEM_HOST_PROCESSOR setting ----------------------+-------------------- Reporter: hjj@… | Owner: css@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.2.0 Resolution: wontfix | Keywords: Port: cmake | ----------------------+-------------------- Changes (by larryv@…): * status: reopened => closed * resolution: => wontfix -- Ticket URL: <https://trac.macports.org/ticket/41070#comment:4> MacPorts <http://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts