Opened 11 years ago

Last modified 11 years ago

#41070 closed defect

cmake: Wrong CMAKE_SYSTEM_HOST_PROCESSOR setting — at Version 1

Reported by: hjj@… Owned by: css@…
Priority: Normal Milestone:
Component: ports Version: 2.2.0
Keywords: Cc: ryandesign@…
Port: cmake

Description (last modified by ryandesign (Ryan Carsten Schmidt))

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.

Change History (1)

comment:1 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added
Description: modified (diff)
Keywords: cmake removed
Owner: changed from macports-tickets@… to css@…
Port: cmake added
Summary: Wrong CMAKE_SYSTEM_HOST_PROCESSOR setting in cmakecmake: Wrong CMAKE_SYSTEM_HOST_PROCESSOR setting

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.

Note: See TracTickets for help on using tickets.