On 05/07/2012 10:46 AM, Eric Smith wrote:
I've finally found time to work on preparing a mingw-llvm-3.0
package,
so that I can cross-compile a program that uses the LLVM libraries.
Hi Eric,
That's awesome, it'll be a very welcome addition to the mingw library
collection in Fedora.
I've run into a few problems that I could use some help with.
1) The %mingw_configure macro defines a bunch of environment variables
such as AR, CXX, GCC, LD, etc., which interfere with building LLVM,
because the LLVM build system already knows how to deal with
cross-builds, but the env vars screw up some things that have to
compiled and run on the build system. Is there any way to convince
%mingw_configure not to set those variables? Or maybe an alternate
macro that doesn't?
For now, I use a patch to the LLVM configure script that unsets all
those variables at the start, and then it builds fine for mingw32.
Yes, compiler packages can be special and if these env variables
interfere with the build, you could use ./configure directly. Just make
sure that %{mingw32_cflags} / %{mingw64_cflags} get used.
See for example how mingw-gcc is built by invoking ./configure directly:
http://pkgs.fedoraproject.org/gitweb/?p=mingw-gcc.git;a=blob;f=mingw-gcc....
I have a vague recollection that llvm supports both autotools and cmake
builds systems. Perhaps another idea would be to use cmake, if it's
easier to cross compile llvm with it?
An example package that uses cmake:
http://pkgs.fedoraproject.org/gitweb/?p=mingw-win-iconv.git;a=blob;f=ming...
[...]
3) Building for mingw64 fails with all sorts of undefined mangled
C++
symbols. I think I'll need help from upstream with that. Is it OK to
submit a package in the mean time that builds for mingw32 only?
Sure, it's certainly better to have a 32 bit-only llvm than no package
at all.
For now I've used "%global mingw_build_win64 0". That
mostly works,
until rpmbuild tries to generate debuginfo and provides, and apparently
is still looking for an x86_64-w64-mingw32 directory, when all I have is
i686-w64-mingw32. Is there something else I must do to convince it not
to look for 64-bit stuff?
Does it work if you replace the following:
%global __strip %{mingw_strip}
%global __objdump %{mingw_objdump}
%global _use_internal_dependency_generator 0
%global __find_requires %{mingw_findrequires}
%global __find_provides %{mingw_debug_install_post}
with:
%{?mingw_package_header}
Also see
https://fedoraproject.org/wiki/PackagingDrafts/MinGWCrossCompiler#Example...
--
Hope this helps,
Kalev