I posted this to vm-dev. I repeat it here as it is easier for me to find it when I need to review (:

Hi All.

I am tackling the “cmake must generate config.h” problem now. In doing so, I had to study Ian’s code to see how he did it and this is what I learned.*

In Ian’s CMake code (svn co http://squeakvm.org/svn/squeak/trunk), the overview I see is as follows.

platforms/unix/cmake/configure script collects some shell variables and invokes cmake with some arguments collected from the shell script.
This runs cmake which uses the platforms/unix/CMakeLists.txt file as its commands.
The structure of this file is (broadly)
1 outer global structure/variables.
2. INCLUDE (in place substitution) of platforms/unix/vm/build.cmake Which is basically what is done in the current CMakeVMMaker
3. INCLUDE (in place substitution) of platforms/unix/vm/config.cmake. This handles testing the system and generating the config.h files on *nix.
4. other stuff (packaging and stuff I glossed over)
There are ancilliary files used for testing and Macros, but that is the overall structure.

Now, the encouraging part is that I am porting 3 above into the CMakeVMMaker(Squeak) stuff and it is going through the config routine and giving me output (:

— Check size of void *
— Check size of void * – done
CMake Error: The source directory “CMAKE_BINARY_DIR/CMakeFiles/CMakeTmp” does not exist.
Specify –help for usage, or press the help button on the CMake GUI.
CMake Error: Internal CMake error, TryCompile configure of cmake failed
CMake Error: The source directory “CMAKE_BINARY_DIR/CMakeFiles/CMakeTmp” does not exist.
Specify –help for usage, or press the help button on the CMake GUI.
CMake Error: Internal CMake error, TryCompile configure of cmake failed
— Looking for alloca.h
— Looking for alloca.h – found
— Looking for sys/time.h
— Looking for sys/time.h – found
— Looking for sys/filio.h
— Looking for sys/filio.h – not found
— Looking for nanosleep
— Looking for nanosleep – found
— Looking for iconv.h
— Looking for iconv.h – found
— Looking for langinfo.h
— Looking for langinfo.h – found
CMake Error at config.cmake:147 (TRY_COMPILE):
try_compile unknown error.
Call Stack (most recent call first):
CMakeLists.txt:88 (include)

– Looking for libiconv_open in iconv
— Looking for libiconv_open in iconv – not found
— Looking for dlfcn.h
— Looking for dlfcn.h – found
— Looking for dlopen in dl
— Looking for dlopen in dl – found
— Looking for _dyld_present
— Looking for _dyld_present – not found
— Looking for snprintf
— Looking for snprintf – found
— Looking for __snprintf
— Looking for __snprintf – not found
— Looking for tzset
— Looking for tzset – found
— Looking for timezone
— Looking for timezone – found
— Performing Test HAVE_TM_GMTOFF
— Performing Test HAVE_TM_GMTOFF – Success
— Looking for mmap
— Looking for mmap – found
— Configuring incomplete, errors occurred!

Which is good. I will be getting this cleaned and ported, but the gist is it is looking good for the requirements.

Then comes modifying the plugin generation such that each plugin contributes its own config.h (this is what Ian’s code does. you do a find for cmake.config in the trunk directory and you will see the individual config inputs for the plugins)

Its getting close. If this goes well, I should have something releasable/repeatable and documented for people to poke around in next week.

From Karl at vm-dev….

You can doIt HelpBrowser openOn: SystemReference

That will open a HelpBrowser on all class comments.

TTY’s wish list

The pharo team is going through a “wish list” phase. I have my own, so I figured I would post it.
It is not a rigorous “think through” this is just brainstorms:

* Squeak Stuff I Want To Do
+ [ ] multi-processor squeak ala roarvm
+ [ ] Kernel space squeak
+ [ ] Squeak As Dia with zoom/pan capability
+ [ ] Seaside Desktop with RenderOn: idiom
+ [ ] REPL
+ [ ] REPL with Emacs
+ [ ] FFI's or Plugins to GL
+ [ ] Tweak/Croquet stuff
+ [ ] Squeak as X server/client, like WindowMaker or E or twm. i.e. an X desktop and not just an application
+ [ ] Squeak Image File System for linux. i.e mkfs.squeak

Bert brings up an important point that I will endeavor to follow in the future.

It would be more accurate to classify VMs by the image types they support, and architecture they run on (leaving out the issue of OS). E.g. it is inaccurate to say “Cog supports 32 bit images on a 32 bit machine” because it does not support pre-closure interpreter images even though they are 32 bits, and it only works on the x86 architecture, soon ARM 32 bits, but not e.g. PowerPC or MIPS 32 bits, which are supported by the interpreter VMs.

- Bert -

Bert’s point effects previous posts where I write like the entire world runs Linux on AMD.

Building SqueakSSL compiles just fine, but fails at the libtool stage when compiled as an internal plugin.

My hunch is that when compiled as an external plugin, the linking is deferred until the module is loaded by the VM. If that is the case, then it explains the primitive fail.

My approach was to compile it as an internal plugin as (by just giving it a try) I found what I thought was an #include error. It took me a while (too long really–I have a bad habit of not closely reading things) find the problem, but it happens after a successful compilation when a thing called “libtool” is run.

Here is the output of the error at that stage:

[......]/debugCogSqueakSSL/unixbuild/bld/libtool --mode=link gcc -m32 -g -Og -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -DITIMER_HEARTBEAT=1 -DCOGMTVM=0 -DDEBUGVM=0 -DLSB_FIRST=1 -Wl,-z,now -export-dynamic -o squeak vm/vm.a AsynchFilePlugin/AsynchFilePlugin.a B2DPlugin/B2DPlugin.a BitBltPlugin/BitBltPlugin.a FilePlugin/FilePlugin.a SocketPlugin/SocketPlugin.a SqueakSSL/SqueakSSL.a MiscPrimitivePlugin/MiscPrimitivePlugin.a disabledPlugins.o version.o -lutil -ldl -lpthread -lm -lnsl -lpthread vm/vm.a

gcc -m32 -g -Og -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -DITIMER_HEARTBEAT=1 -DCOGMTVM=0 -DDEBUGVM=0 -DLSB_FIRST=1 -Wl,-z -Wl,now -o squeak disabledPlugins.o version.o -Wl,--export-dynamic vm/vm.a AsynchFilePlugin/AsynchFilePlugin.a B2DPlugin/B2DPlugin.a BitBltPlugin/BitBltPlugin.a FilePlugin/FilePlugin.a SocketPlugin/SocketPlugin.a SqueakSSL/SqueakSSL.a MiscPrimitivePlugin/MiscPrimitivePlugin.a -lutil -ldl -lpthread -lm -lnsl -lpthread vm/vm.a

SqueakSSL/SqueakSSL.a(sqUnixOpenSSL.o): In function `sqCopyBioSSL':
[......]/debugCogSqueakSSL/platforms/unix/plugins/SqueakSSL/sqUnixOpenSSL.c:37: undefined reference to `BIO_ctrl_pending'

(more errors omitted for brevity. all of them are unresolved references to stuff in /usr/include/openssl/ssl.h . these errors do not happen at compile time, only linking stage )

Since discovering this, I have tried two things

1. compile on my pure 64 bit partition…this failed –we don’t have 64 bit Cog yet (: but hey…a guy can hope!

2. I installed openssl compat32 libs alongside the 64 bit versions…as shown below.
2.a I made some changes that I kinda-sorta-hoped would work in some strings in the script that had the substring “/lib64 ” but that did not work.

bash-4.2$ ls lib/*ssl*
lib/libssl.so.0 lib/libssl.so.0.9.8 lib/libssl.so.1 lib/libssl.so.1.0.0
bash-4.2$ ls lib64/*ssl*
lib64/libssl.so.0 lib64/libssl.so.0.9.8 lib64/libssl.so.1 lib64/libssl.so.1.0.0

I posted the above to the vm-dev mailing list and will see if anybody picks up on it. I will hit this again tomorrow!

Well, look what we have here from platforms/unix/vm/sqPlatformSpecific.h for the CogVM source tree.

#if defined(__GNUC__)
# if !defined(VM_LABEL)
# define VM_LABEL(foo) asm("\n.globl L" #foo "\nL" #foo ":")
# endif
# include
# else
# ifdef _AIX
# pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca();
# endif
# endif
# endif

indented #defines and #includes…I will have to research this a bit more, but if it is true, then putting these puppies and debugging them just got a whole lot easier.

I am stuck in the old code/build/debug loop of C while I try to learn how to debug the SqueakSSL plugin on Squeak.

The Plugin builds (but fails) when compiled as an external plugin in plugins.ext, but does not compile when moved to plugins.int as an internal plugin.

The reason it fails is that the include for #include “openssl/ssl.h” fails and many functions in the plugin are not referenceable (howdya like those c terms!)

I tried changing the #include statment through various contortions and those failed, so it looks like the quick fix method is not to be.

To simplify debugging, I like to remove clutter. Ergo, I created a debugCogClean directory and added to it the minimal directories and files needed for a functioning image (with monticello) to run.

The plugins needed are:

AsynchFilePlugin \
B2DPlugin \
BitBltPlugin \
FilePlugin \
SocketPlugin \

the directory tree is:

|-- platforms
| |-- Cross
| | |-- BitBltPlugin
| | |-- plugins
| | | |-- AsynchFilePlugin
| | | |-- B3DAcceleratorPlugin
| | | |-- FilePlugin
| | | `-- SocketPlugin
| | `-- vm
| `-- unix
| |-- config
| |-- doc
| | `-- HowToBuildFromSource.html
| |-- plugins
| | |-- AsynchFilePlugin
| | |-- B3DAcceleratorPlugin
| | | `-- zzz
| | |-- FilePlugin
| | `-- SocketPlugin
| |-- vm
| |-- vm-display-Quartz
| | |-- Resources
| | | `-- SqueakHelp
| | | `-- images
| | `-- zzz
| |-- vm-display-X11
| |-- vm-display-custom
| |-- vm-display-fbdev
| |-- vm-display-null
| |-- vm-sound-ALSA
| |-- vm-sound-MacOSX
| |-- vm-sound-NAS
| |-- vm-sound-OSS
| |-- vm-sound-Sun
| |-- vm-sound-custom
| `-- vm-sound-null
|-- src
| |-- plugins
| | |-- AsynchFilePlugin
| | |-- B2DPlugin
| | |-- B3DAcceleratorPlugin
| | |-- BitBltPlugin
| | |-- FilePlugin
| | |-- MiscPrimitivePlugin
| | `-- SocketPlugin
| `-- vm
`-- unixbuild
`-- bld
|-- AsynchFilePlugin
|-- B2DPlugin
|-- BitBltPlugin
|-- FilePlugin
|-- MiscPrimitivePlugin
|-- SocketPlugin
|-- vm
|-- vm-display-X11
|-- vm-display-null
|-- vm-sound-ALSA
|-- vm-sound-OSS
`-- vm-sound-null

This will be my base point for debugging plugins. Now, for the SqueakSSL plugin, I will create a directory debugCogSqueakSSL and copy in that clean tree. then jus t add the relevant SqueakSSL files.

Hopefully I can get this done soon.


Get every new post delivered to your Inbox.