Hi all
In Ian's CMake infrastructure, the instructions require the user to run the configure command before invoking cmake.
For the CMakeVMMaker(Squeak) we currently have config.h embedded in the class.
For my first configuration after this massive refactoring I have done, I first ran the 'mvm' on the GNU side and then cut-n-paste that generated config.h into my class.
That's ok for an intermediate step, but I would like to take it a step further and...
1. invoke configure from squeak (I have the configure flags like '--without-npsqueak --without-gl...etc" embedded in the class, so they are avaiable to invoke configure with) 2. detect the success or failure of the configure command 3. if successful, load the generated config.h into my class (actually, this is redundant, but it may come in handy) 4. continue as normal.
Does this sound reasonable to everybody?
thx,
tty
On 27-06-2014, at 1:46 PM, gettimothy gettimothy@zoho.com wrote:
Hi all
In Ian's CMake infrastructure, the instructions require the user to run the configure command before invoking cmake.
For the CMakeVMMaker(Squeak) we currently have config.h embedded in the class.
I thought we had established that the config.h was a generated artefact, created at compile time to suit the machine it was being compiled on? For example, if I compile on a machine with the X dev libs but not the pango/cairo dev libs then I expect to see that reflected in the config.h and thus the resulting vm.
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Multitasking: Screwing up several things at once...
On Fri, Jun 27, 2014 at 1:46 PM, gettimothy gettimothy@zoho.com wrote:
Hi all
In Ian's CMake infrastructure, the instructions require the user to run the configure command before invoking cmake.
For the CMakeVMMaker(Squeak) we currently have config.h embedded in the class.
For my first configuration after this massive refactoring I have done, I first ran the 'mvm' on the GNU side and then cut-n-paste that generated config.h into my class.
Tta;s an absurd thing to do. It means that we need a different class for every single different release of a Unix OS, because the generated config.h could potentially change with every different release of a Unix OS. config.h has *no* place in the image. It must be generated at compile time.
That's ok for an intermediate step, but I would like to take it a step further and...
- invoke configure from squeak (I have the configure flags like
'--without-npsqueak --without-gl...etc" embedded in the class, so they are avaiable to invoke configure with) 2. detect the success or failure of the configure command 3. if successful, load the generated config.h into my class (actually, this is redundant, but it may come in handy) 4. continue as normal.
Does this sound reasonable to everybody?
thx,
tty
HI Eliot and Tim.
Makes sense to me. What I am trying to figure out is the best way to generate it at compile time and ditch the hard-coded configH method per the requirements.
One option is to just invoke configure per the build.linuxXYZ/build/mvm file as the source tree is identical.
Would that be a problem?
Another possibility is in Ian's CMake system for the Standard Interpreter, it is generated by hand.
svn co http://squeakvm.org/squeak/trunk squeak cd squeak mkdir bld cd bld ../platforms/unix/cmake/configure make
Looking at that /platforms/unix/cmake/configure file, it is just a shell script with some hard-coded definitions/flags.
What I could do is dynamically create that ../platforms/unix/cmake/configure script from the class. Then in the build script build.sh invoke that script first before invoking cmake.
I do think the first option is easier.
Thoughts?
thx.
tty
On Fri, Jun 27, 2014 at 2:19 PM, gettimothy gettimothy@zoho.com wrote:
HI Eliot and Tim.
Makes sense to me. What I am trying to figure out is the best way to generate it at compile time and ditch the hard-coded configH method per the requirements.
One option is to just invoke configure per the build.linuxXYZ/build/mvm file as the source tree is identical.
Would that be a problem?
Well, if you're doing CMake then you'll want to use whatever CMake uses to generate config.h. platforms/unix/conf/configure runs automake.
Another possibility is in Ian's CMake system for the Standard Interpreter,
it is generated by hand.
Even if configure was generated by automake its input files (configure.in et al) were not ;-)
One could see that inputs to CMake are hand-written as an advantage of CMake, it getting one further in each step. autoconf's generating configure is problematic, configure itself needing to be generated on the right system (generating it on Mac OS X for example produces a completely broken configure)..
svn co http://squeakvm.org/squeak/trunk squeak cd squeak mkdir bld cd bld *../platforms/unix/cmake/configure* make
Looking at that /platforms/unix/cmake/configure file, it is just a shell script with some hard-coded definitions/flags.
What I could do is dynamically create that ../platforms/unix/cmake/configure script from the class. Then in the build script build.sh invoke that script first before invoking cmake.
I do think the first option is easier.
Thoughts?
thx.
tty
On Fri, Jun 27, 2014 at 04:58:12PM -0700, Eliot Miranda wrote:
On Fri, Jun 27, 2014 at 2:19 PM, gettimothy gettimothy@zoho.com wrote:
HI Eliot and Tim.
Makes sense to me. What I am trying to figure out is the best way to generate it at compile time and ditch the hard-coded configH method per the requirements.
One option is to just invoke configure per the build.linuxXYZ/build/mvm file as the source tree is identical.
Would that be a problem?
Well, if you're doing CMake then you'll want to use whatever CMake uses to generate config.h. platforms/unix/conf/configure runs automake.
Another possibility is in Ian's CMake system for the Standard Interpreter,
it is generated by hand.
Even if configure was generated by automake its input files (configure.in et al) were not ;-)
One could see that inputs to CMake are hand-written as an advantage of CMake, it getting one further in each step. autoconf's generating configure is problematic, configure itself needing to be generated on the right system (generating it on Mac OS X for example produces a completely broken configure)..
Indeed, there were a number of problems with autotools, and IIRC the related problems with libtool handling of mixed 32-bit and 64-bit libraries created such a mess that it finally drove Ian to create the CMake build, which has been relatively problem free ever since.
Regarding autotools, see note #4 below. Note #5 is also worthy of some thoughtful consideration.
Dave
$ ./platforms/unix/cmake/configure --help Usage: ./configure [options...] Options include: --help print this message and then exit --src=<directory> look for generated interpreter sources in <directory> --prefix=<directory> install into <prefix>/{bin,lib,man} --CFLAGS=<flags> override default compiler flags --without-<plugin> do not build the named plugin --without-gl disable everything that depends on OpenGL --without-SUGAR disable support for SUGAR environment --image64 build a VM for running 64-bit images --enableFastBlt use optimised BitBlt (not supported on most platforms) Notes: 1. By default the CFLAGS will be set to create optimised binaries. If you are debugging the VM you probably want to use '--CFLAGS=-g' when invoking this script. 2. --CFLAGS and -without-* settings will be preserved in subsequent invocations of CMake, including those driven implicitly by changed dependencies. If you need to turn off a seting (to re-enable a plugin or restore the default CFLAGS) just give the relevant options with empty arguments, like this: ./configure --CFLAGS= --without-UUIDPlugin= 3. Wizards can set any CMake variable from the command line with the option: --<CMakeVariableName>=<value> 4. In case it isn't already obvious, this is NOT the autotools 'configure' script. It is named so that 'configure; make' works in the expected way. 5. Bug reports, bug fixes and suggestions for improvement should be sent to the author (Ian Piumarta) at: <firstName> (at) <lastName> (dot) com
Hi David,
See my last reply to Eliot.
I have been neck deep in new coding that I have relied on the existing CMakeVMaker approach to drive my development.
While replying to Eliot and Tim R, I have glanced at Ian's configure script and I think this will all come together nicely.
The end of Ian's script invokes cmake like so:
if test -n "${cflags}"; then cmake "${unix}" -DVM_HOST="${host}" -DVM_VERSION="${VM_VERSION}" -DPLATFORM_SOURCE_VERSION="${PLATFORM_SOURCE_VERSION}" -DSRC="${src}" -DOPT--CMAKE_C_FLAGS="${cflags}" ${args} else cmake "${unix}" -DVM_HOST="${host}" -DVM_VERSION="${VM_VERSION}" -DPLATFORM_SOURCE_VERSION="${PLATFORM_SOURCE_VERSION}" -DSRC="${src}" ${args} fi
Which, somehow creates a config.h (and a good looking one too. It links to /lib/64 which is correct on my system)
This is definitely solvable in principle using exclusivelly cmake.
I have a lot of brain-cycles to spend getting the framework in place before I turn my attention to this particular problem, but in discussing it with you guys, the solution has presented itself.
cheers.
tty
Looking at it some more, the cmake invocation depends on a CMakeLists.txt that has some constructs not in the CMakeVMmaker(Squeak) file of the same name:
LIST (REMOVE_DUPLICATES config_vars) FILE (WRITE ${bld}/config.h.in "") FOREACH (var ${config_vars}) FILE (APPEND ${bld}/config.h.in "#cmakedefine ${var} @${var}@\n") ENDFOREACH (var)
So, generating config.h from CMakeLists.txt is definitely doable. I will devote brain-cycles to implementing that when I have the build.linux32x86/ stack built for all buildTypes using the autoconf interim step.
Thanks for your patience, this exchange was very helpful to me.
cheers tty.
Hi Eliot
Thanks for the reply.
>>Well, if you're doing CMake then you'll want to use whatever CMake uses to generate config.h. platforms/unix/conf/configure runs automake.
Yeah, its on my list. I don't know what (or if) cmake uses to generate config.h. Ian's configure script looks like a hand-coded bash script that does in bash what we are doing in Squeak, the penultimate line in that script reads like this:
cmake "${unix}" -DVM_HOST="${host}" -DVM_VERSION="${VM_VERSION}" -DPLATFORM_SOURCE_VERSION="${PLATFORM_SOURCE_VERSION}" -DSRC="${src}" -DOPT--CMAKE_C_FLAGS="${cflags}" ${args}
I will get to that, but I have bigger fish to fry beforehand. I do believe the problem is solvable in a clean way.
An interim solution hit me on my way to friends house for dinner a while ago.
The VMMakerCMake(Squeak) system generates a 'build.sh' script that reads..
#!/usr/bin/env bash
if [ ! -e vmVersionInfo.h ]; then ../scripts/extract-commit-info.sh fi cmake . make
What I can do in the interim is utilize the configure line from the mvm files and do ....
#!/usr/bin/env bash
if [ ! -e vmVersionInfo.h ]; then ../scripts/extract-commit-info.sh fi ../../platforms/unix/config/configure --with the flags I store in the configuration class for this configuration/buildType cmake . make
That is the autoconfig stuff for now.
I will give that a go in the a.m. Then/if the cmake system has the config.h generation capabilities, I will roll that into the system.
Then, when I have the system in place, I can study what Ian is doing and modify the script to something like
#!/usr/bin/env bash
if [ ! -e vmVersionInfo.h ]; then ../scripts/extract-commit-info.sh fi cmake "${unix}" -DVM_HOST="${host}" -DVM_VERSION="${VM_VERSION}" -DPLATFORM_SOURCE_VERSION="${PLATFORM_SOURCE_VERSION}" -DSRC="${src}" -DOPT--CMAKE_C_FLAGS="${cflags}" ${args} make
cheers.
tty.
P.S. That
cmake "${unix}" -DVM_HOST="${host}" -DVM_VERSION="${VM_VERSION}" -DPLATFORM_SOURCE_VERSION="${PLATFORM_SOURCE_VERSION}" -DSRC="${src}" -DOPT--CMAKE_C_FLAGS="${cflags}" ${args}
command does in fact generate a config.h, so the problem is solvable in principle. I just have a lot of boilerplate heavy lifting to do prior to turning my attention to that line and learning how it interacts with the existing CMakeLists.text.
Thanks for your patience. Sometimes it helps to just talk out loud about a problem.
cheers again.
tty
Hi Ben,
Following a post by Igor in a different thread [1], I also wondered whether running configure and storing the results in image would be useful. I haven't done much system programming, so excuse my naivety, but doesn't `configure` only make sense for the system you are compiling on? What if you want to cross-compile form one Linux distribution-release to an older release, or another distribution, which might be at a client site. At first glance it seems having cached "configure" result wold be useful, otherwise you'd need to install the client's distribution-release to do it? (and maybe that would be a good idea anyway, but should it be a constraint?).
I wonder if there is some middle ground, where `configure` results could be stored as different methods on one particular class - similar to how Metacello does its versioning. These could be added by different groups working with the VM as extension methods from their own packages. The default would be generate config.h at compile time, but you'd be able to substitute with a call to one of these cached `configure` methods.
I half-expect this won't be well received :), but its my current thinking, so I'll be learning something in any case. cheers -ben
I discovered yesterday during the email exchange on this subject that Ian's configure script and CMakeLists.txt work together to create a config.h without using the auto-tools; this is the approach I will be taking. I will be turning my attention to it in a couple of days.
cheers.
tty.
vm-dev@lists.squeakfoundation.org