LLVM/Clang SVN: 2 Questions

Windows7, Cmake 2.8.8, MinGW 4.6.1. compiler:

I got two questions seeking for help:

1.) I am trying to compile LLVM/Clang from trunk using the instructions from
the LLVM homepage which works fine except that the llvm-config tool is not
being built. When I do a "make" in the "tools\llvm-config" folder it fails,
too with:
../../Makefile.common:60: ../../Makefile.config: No such file or directory
../../Makefile.common:68: /Makefile.rules: No such file or directory
mingw32-make.exe: *** No rule to make target `/Makefile.rules'. Stop.
Those files are there, so I am a bit lost. Is there a configuration switch I
am missing to build this tool? I searched through the Cmake options, but I
could not find any.

2.) Can I actually compile Windows resource files (*.rc) with Clang? What
would I need to if my project requires a Windows resource file and I want to
compile it using Clang? Linking against a MinGW/windres compiled resource?

Any help is greatly appreciated.

1.) I am trying to compile LLVM/Clang from trunk using the instructions from
the LLVM homepage which works fine except that the llvm-config tool is not
being built. When I do a "make" in the "tools\llvm-config" folder it fails,
too with:
../../Makefile.common:60: ../../Makefile.config: No such file or directory
../../Makefile.common:68: /Makefile.rules: No such file or directory
mingw32-make.exe: *** No rule to make target `/Makefile.rules'. Stop.
Those files are there, so I am a bit lost. Is there a configuration switch I
am missing to build this tool? I searched through the Cmake options, but I
could not find any.

How have you configured llvm?

2.) Can I actually compile Windows resource files (*.rc) with Clang? What
would I need to if my project requires a Windows resource file and I want to
compile it using Clang? Linking against a MinGW/windres compiled resource?

Yes. windres is your friend

Windows7, Cmake 2.8.8, MinGW 4.6.1. compiler:

I got two questions seeking for help:

1.) I am trying to compile LLVM/Clang from trunk using the instructions from
the LLVM homepage which works fine except that the llvm-config tool is not
being built. When I do a “make” in the “tools\llvm-config” folder it fails,
too with:
…/…/Makefile.common:60: …/…/Makefile.config: No such file or directory
…/…/Makefile.common:68: /Makefile.rules: No such file or directory
mingw32-make.exe: *** No rule to make target `/Makefile.rules’. Stop.
Those files are there, so I am a bit lost. Is there a configuration switch I
am missing to build this tool? I searched through the Cmake options, but I
could not find any.

The llvm-config tool is not built on Windows, since it requires sed which is not available by default on Windows. I actually have a patch for this somewhere (build llvm-config on Windows if sed is found), I’ll try to find it and post it.

2.) Can I actually compile Windows resource files (*.rc) with Clang? What
would I need to if my project requires a Windows resource file and I want to
compile it using Clang? Linking against a MinGW/windres compiled resource?

As far as I know, MinGW’s windres or the Windows SDK’s rc.exe is required. But this is not my area of expertise…

This “No Makefile.rules” problem is different, and recent, from what I see.

With mingw, msys, and gnuwin32, on win7, then configure and make
will normally succeed, including building llvm-config.exe.

I’ve run into this “No Makefile.rules” problem, and as best I know
so far, it’s tied to the change in the llvm.org Getting Started procedure:
now it’s called for to checkout LLVM, checkout clang, AND
checkout Compiler-RT. I followed that path a week ago and hit
the same breakage described above.

I’m now going thru procedures one at a time;
svn checkout LLVM and configure and make, succeeds;
repeat, adding “–enable-shared” to configure; succeeds;
svn checkout clang and repeat: both static and shared succeed;

…and that’s how far I’ve got. Am waiting for compiler-rt
right now, to find out if it re-introduces the breakage, or
if something has been changed in trunk in the last few
days to cause different behavior.

I agree with Mikael that we do need an up-to-date, tested,
preferably buildbotted, Windows build procedure. I think
it doesn’t matter too much what tool choices are made,
most project setups start with “download this set of tools”
anyway. But there needs to be at least one path that can
be followed to success, and that path needs to be tested,
and known to be up-to-date.

cheers,
Kevin

clues come slow through bone…

My previous post describes building in a fresh VM, with newly
installed and current tools. My last weeks’ failures (as OP) may
indeed have been sed-related – my base system turns out
to have a copy of sed.exe with a filedate of 2002, in the GoW
(GnuOnWindows) dist, which I liked because it’s very small.

Using current tools in a not-hacked-up system, automake
build works just fine.

Kevin

Kevin Kelley <kevin@kelleysoft.com> writes:

    Windows7, Cmake 2.8.8, MinGW 4.6.1. compiler:

    I got two questions seeking for help:

    1.) I am trying to compile LLVM/Clang from trunk using the
    instructions from
    the LLVM homepage which works fine except that the llvm-config
    tool is not
    being built. When I do a "make" in the "tools\llvm-config" folder
    it fails,
    too with:
    ../../Makefile.common:60: ../../Makefile.config: No such file or
    directory
    ../../Makefile.common:68: /Makefile.rules: No such file or directory
    mingw32-make.exe: *** No rule to make target `/Makefile.rules'. Stop.
    Those files are there, so I am a bit lost. Is there a
    configuration switch I
    am missing to build this tool? I searched through the Cmake
    options, but I
    could not find any.

The llvm-config tool is not built on Windows, since it requires sed
which is not available by default on Windows. I actually have a
patch for this somewhere (build llvm-config on Windows if sed is
found), I'll try to find it and post it.

This "No Makefile.rules" problem is different, and recent, from what I see.

With mingw, msys, and gnuwin32, on win7, then configure and make
will normally succeed, including building llvm-config.exe.

The "No Makefile.rules" message is because the OP executed `make' on the
source directory, where a hand-made autoconf-dependant Makefile
exists. But he was actually building with cmake, which generates its own
makefiles. Either he invoked cmake on a separate build directory
(correct) and then switched to the source directory for executing `make'
(wrong) or he directly executed cmake on the source directory thus
overwriting the hand-made makefiles distributed with LLVM (wrong wrong
wrong). In that case, the hand-made Makefile on tools/llvm-config was
still there because he was not using MSYS. With gnuwin32 or a bare mingw
install the llvm-config directory is ignored.

[snip]

thanks a lot for all the answers, I didn't expect so much effort, that's
great!

Óscar Fuentes wrote:

But he was actually building with cmake, which generates its own
makefiles.

True.

Óscar Fuentes wrote:

Either he invoked cmake on a separate build directory
(correct) and then switched to the source directory for executing `make'
(wrong)

That is true. I tried to run make in that folder only, after the "global
make" in the "build" subdirectory did not build the llvm-config tool using
Cmake. To be honest: I don't know Cmake much, I thought as it creates
Makefile's in each directory, one can start a make from there, too.

Óscar Fuentes wrote:

or he directly executed cmake on the source directory thus
overwriting the hand-made makefiles distributed with LLVM (wrong wrong
wrong).

No, it wasn't that worse. :wink:

Óscar Fuentes wrote:

In that case, the hand-made Makefile on tools/llvm-config was
still there because he was not using MSYS. With gnuwin32 or a bare mingw
install the llvm-config directory is ignored.

Ok - this is understood. I have Gnuwin32 tools (including SED) in the path
at least, too. So should I simply hand-craft my own build? How do you guys
create llvm-config on Windows? Is it actually needed? I found this in may
tutorials to easily set-up the command line options for Clang based builds.

MortenMacFly <mac-fly@gmx.net> writes:

[snip]

In that case, the hand-made Makefile on tools/llvm-config was
still there because he was not using MSYS. With gnuwin32 or a bare mingw
install the llvm-config directory is ignored.

Ok - this is understood. I have Gnuwin32 tools (including SED) in the path
at least, too. So should I simply hand-craft my own build?

If you want to try, edit llvm/tools/CMakeLists.txt :

if( NOT WIN32 OR MSYS OR CYGWIN )
  # We currently require 'sed' to build llvm-config, so don't try to build it
  # on pure Win32.
  add_subdirectory(llvm-config)
endif()

remove the `NOT' there. Then switch to the build directory and re-run
the build. `cmake' will be automatically invoked.

How do you guys create llvm-config on Windows?

Currently, because the logic shown on the code excerpt above,
llvm-config is only built if you are using MSYS or Cygwin. That
restrictrion comes from the past, maybe today `sed' is the only external
tool required for generating llvm-config. And that requirement can be
removed too.

Is it actually needed?

llvm-config is a convenience tool for the user, i.e. you don't need it
for building LLVM/Clang or for your own projects.

I found this in may tutorials to easily set-up the command line
options for Clang based builds.

Yes, it is convenient precisely for that. If you are using cmake for
your own projects, LLVM comes with .cmake modules that do most of the
job of llvm-config.