Build problems and workarounds with CMake and XCode

Hello everyone,

I finally gave up on trying to build under Eclipse on my Mac because I had a
non-functioning installation on there that kept intercepting the command line
entries on the path. Uninstalling the old MacPorts install of LLVM 2.6 helped
but not completely.

I tried making a separate build of LLVM SVN in XCode using build files created
with CMake. Surprisingly, it worked better than Eclipse! The Build_All target
completed its build. The install target was another story though. First of
all, the commands to install with the terminal command-line needed to be
prefaced with sudo to work. Secondly, those commands, when executed from XCode,
have no open console to prompt for a password.

My workaround for that was to write a small utility in Qt to prompt for a
password and return it in stdout. I then set the path of that utility to the
SUDO_ASKPASS environment variable so I could set the scripts to run sudo -A
command instead of sudo command. This unearthed a second problem. In my debug
build, the script looked in the release directory for LLVMSupport.a and failed
as a result of it.

At this point I'm building a release build so I can install the debug build.
If Óscar or somebody more familiar than I at CMake would look into the issue of
the release install in the debug build, I'd appreciate it. Secondly, if anyone
would be interested in my password prompter software, I'd be interested in
releasing it as open-source.

Thanks for your time and efforts,

--Samuel Crow

Samuel Crow <samuraileumas@yahoo.com> writes:

[snip]

I tried making a separate build of LLVM SVN in XCode using build files created
with CMake. Surprisingly, it worked better than Eclipse! The Build_All target
completed its build. The install target was another story though. First of
all, the commands to install with the terminal command-line needed to be
prefaced with sudo to work.

Have you permissions for those directories?

Secondly, those commands, when executed from XCode,
have no open console to prompt for a password.

That lies outside cmake and/or XCode capabilities, I guess.

My workaround for that was to write a small utility in Qt to prompt for a
password and return it in stdout. I then set the path of that utility to the
SUDO_ASKPASS environment variable so I could set the scripts to run sudo -A
command instead of sudo command. This unearthed a second problem. In my debug
build, the script looked in the release directory for LLVMSupport.a and failed
as a result of it.

At this point I'm building a release build so I can install the debug build.
If Óscar or somebody more familiar than I at CMake would look into the issue of
the release install in the debug build, I'd appreciate it.

I'm not sure what the problem is. Never used XCode nor I have access to
it. What are those scripts? The install scripts generated by CMake for
XCode?

From: Óscar Fuentes <ofv@wanadoo.es>
To: Samuel Crow <samuraileumas@yahoo.com>
Cc: LLVM Developers Mailing List <llvmdev@cs.uiuc.edu>
Sent: Wed, January 5, 2011 5:00:00 PM
Subject: Re: Build problems and workarounds with CMake and XCode

Samuel Crow <samuraileumas@yahoo.com> writes:

[snip]

> I tried making a separate build of LLVM SVN in XCode using build files
created

> with CMake. Surprisingly, it worked better than Eclipse! The Build_All
target

> completed its build. The install target was another story though. First of

> all, the commands to install with the terminal command-line needed to be
> prefaced with sudo to work.

Have you permissions for those directories?

I'm running in user mode with root equivalence added temporarily to my account.
Macs always require you to sudo to access the system directories even when
you're logged in as an administrator.

It's possible that this may be a CMake bug/oversight.

> Secondly, those commands, when executed from XCode,
> have no open console to prompt for a password.

That lies outside cmake and/or XCode capabilities, I guess.

It's an Macintosh-ism. Most files run from icons do not open a text console.
My past experience with some Linux GUI toolkits are similar.

> My workaround for that was to write a small utility in Qt to prompt for a
> password and return it in stdout. I then set the path of that utility to
the

> SUDO_ASKPASS environment variable so I could set the scripts to run sudo -A

> command instead of sudo command. This unearthed a second problem. In my
debug

> build, the script looked in the release directory for LLVMSupport.a and
failed

> as a result of it.
>
> At this point I'm building a release build so I can install the debug build.

> If Óscar or somebody more familiar than I at CMake would look into the
issue of

> the release install in the debug build, I'd appreciate it.

I'm not sure what the problem is. Never used XCode nor I have access to
it. What are those scripts? The install scripts generated by CMake for
XCode?

The CMake script generated the XCode project file so I'm assuming it's a problem
either with CMake or the CMake scripts. XCode targets are similar to make
targets except that parallel processing is generally implied without any added
flags (like make -j). If this turns out to be a deficiency in CMake itself then
most of this discussion can probably be moved to the CMake mailing list.

My main concern with the CMake scripts is that they required a release-build
file while making a debug-build install. This ought not to be.

The rest of my workarounds can be easily fixed by CMake or XCode including a
graphical password requester for the sudo -A flag to use. If it's CMake that
needs it, I can provide source to mine since I used the same GUI toolkit as
CMake uses. Really it's just a class wrapper for a ready-made requester that
comes built in to Qt anyway.

I hope this clears up what I was trying to say,

--Sam

Samuel Crow <samuraileumas@yahoo.com> writes:

[snip]

I'm not sure what the problem is. Never used XCode nor I have access to
it. What are those scripts? The install scripts generated by CMake for
XCode?

The CMake script generated the XCode project file so I'm assuming it's a problem
either with CMake or the CMake scripts. XCode targets are similar to make
targets except that parallel processing is generally implied without any added
flags (like make -j). If this turns out to be a deficiency in CMake itself then
most of this discussion can probably be moved to the CMake mailing list.

My main concern with the CMake scripts is that they required a release-build
file while making a debug-build install. This ought not to be.

Agreed. Maybe a bug on the cmake XCode generator. On Linux/mingw/VS you
can install a debug build right away.

So yes, IMO the discussion should move to the cmake ml.

[snip]