|
From: Eli Z. <el...@gn...> - 2013-11-21 16:55:10
|
> From: "Peter J. Farley III" <pjf...@ea...> > Date: Thu, 21 Nov 2013 00:26:51 -0500 > > I'm not entirely a newbie to using a GNU configure/make process under > linux, and I *thought* I understood how to go about it using > MinGW/msys, but I am failing completely and I do not completely > understand why. Please help cure my obviously considerable ignorance. > > I have read a lot of the startup pages on the wiki and the HOWTO > pages, but I found nothing there which speaks to using GNU configure > successfully or what facilities are actually available in MinGW and > which are not. In a nutshell, you just run the configure script from the MSYS Bash window. That's all, there's no other major magic involved, except installing MSYS and MinGW and having the required packages. > My goal is to be able to take a GNU project -- e.g. gawk 4.1 -- and Don't start with Gawk -- it doesn't support the MinGW/MSYS build out of the box. (The official way of building Gawk with MinGW is described in README_d/README.pc file in the Gawk distribution.) You will have a bumpy ride. Instead, take some other package. > figure out how to run the configure step to create the Makefile(s) and > then use mingw32-make to build a MinGW executable, not an msys > executable. I'd advise against running mingw32-make after completing the configure step. Instead, use the MSYS Make to run MinGW compiler and linker. The reason is that the MSYS Make supports Makefiles with heavy shell scripting much better than the MinGW port of Make. > After downloading and unpacking a GNU tarball or doing a git clone of > the stable branch of a project, I fired up msys bash to run the > configure step (from an original CMD.EXE prompt), but configure does > not find things I think I see as supported in MinGW/msys, like > "dlfcn.h" for the dynamic linking facility. Gawk has its private dlfcn.h and its functions suitable for MinGW in the pc directory. > Well, at least I think "dlfcn.h" is supported. I saw that the > MinGW/msys version of "dlfcn.h" exists only in the msys include > directory, not in the MinGW include directory. Does that mean that > "dlopen" functions are only supported for msys-based executables? Yes, functions you find in the MSYS headers are for building MSYS programs. > I guess I am just not quite getting what GNU facilities are available > for pure MinGW compiles. Is it only what is contained in the MinGW > include directory? Yes. > So, for instance, "stdarg.h" is not available for MinGW compiles, > only for msys compiles, since "stdarg.h" lives only in msys include? No, stdarg.h exists in MinGW as well, it comes with GCC, and you should be able to find it in lib/gcc/mingw32/X.Y.X/include (where X.Y.Z is the version of GCC you have installed). > I see in zip files pulled from ezwinports that the entire GNU > configure process is bypassed and Eli's hand-crafted Makefile's are > substituted instead (e.g., for gawk 4.x). Gawk is the odd one out. Most of the other projects on that site were built by running the configure script. > Is this the only way to build MinGW versions of GNU projects? > Bypass configure entirely and hand-craft a Makefile? Definitely not. > Shouldn't the configure process be able to be modified to (1) > determine that it is a MinGW environment and (2) arrange to do all > the things that Eli did to manually create the Makefiles he > supplies? Yes. But it doesn't come for free; Someone(TM) should make sure this works, especially when the package uses some features that need to be reimplemented for Windows, and submit the patches upstream. With Gawk, this was never done, since the hand-made Makefile's work well (and support several non-Posix platforms, not just MinGW). > For instance, since libltdl is provided in MinGW and "ltdl.h" is > provided in MinGW include, couldn't a "dlfcn.h" substitute be > provided that translated "dlopen" calls to the appropriate > "lt_dlopen" call, along with the needed initialization and setup > calls? This requires that the upstream maintainer agrees to use libltdl and call lt_dlopen instead of dlopen. As long as she doesn't, and no one submits patches to change that, the build will fail. > Should I be able to run a GNU configure under msys bash and then use > mingw32-make to build a GNU project as a MinGW executable? Yes (but don't use mingw32-make), provided that the package supports a MinGW/MSYS build out of the box. Many do, but not all of them. > I do understand that at least some (perhaps many?) POSIX facilities > are intentionally not available in MinGW and never will be, which > would prevent at least some GNU projects from being build or executed > without some (perhaps a lot of) coding work to replace those > facilities with Windows equivalents or other changes to the project. > I am more than willing to try to do such work, but I need to > understand how the process should work *if* all needed facilities are > in fact supported by MinGW. If they all are supported, the configure/make/make check/make install dance should "just work". E.g., try building the latest libpng library, and you will see that in action. |