Category
Recent Posts
- Smooth Zooming Depends on Flash Version
- Covert Actions
- Transform SWF 3.0.1 now available
- Considering A Move To Memphis
- Well, It Took A While
Archives
Search Box
Meta
Posts Tagged ‘C++’
Compiling Ming For Windows
Posted by smackay | Filed under ming
After spending some time wrestling with Ming, I got it to build on Windows Vista using the MinGW GCC tool chain, though with some caveats, see the issues section below. Here are the steps I went through:
- Install MinGW 5.1.6. Make sure you select the following options:
- MinGW base tools
- g++ compiler
- MinGW Make
Also make sure the name of the directory where you install MinGW does not contain any spaces. C:\MinGW works just fine.
- Install MSYS 1.0.11. Again the name of the directory where you install MSYS should not contains any spaces. C:\msys works just fine.
- Install msysDTK-1.0.1.
- Download and unpack msys bison. Copy the files from the bin, lib and share directories into the same directories in your msys installation.
- Download and unpack msys flex. Copy the files from the bin, lib, include and share directories into the same directories in your msys installation.
- Download and unpack msys regex. Copy the dll from the bin directory into the bin directory in your msys installation.
- Download and unpack ming 0.4.3.
- Add c:\MSYS\bin, c:\MinGW\bin, in that order, to the PATH environment variable.
- Open a windows shell, change directory to where you unzipped the ming files and run the following command:
bash
then at the prompt, run:./configure --disable-freetype
this will configure to build the libraries with c++ bindings. - Now edit the file, libtool, in the ming root directory. On line 686 in the function func_extract_an_archive () change:
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
to:if ($AR t "$f_ex_an_ar_oldlib" | sort | sort >/dev/null 2>&1); then
Yes, this is subverting the build process and the step will be brittle but all the script is doing is comparing the names of the object files with those stored in the archive. The -uc option is for strict order checking of the file names and there is no obvious reason (at least in the limited time I spent looking) why it does not work. - Now compile and install the libraries:
make install
The libraries and header files will be installed in C:\msys\1.0\local
Issues:
In step 9, support for FreeType was disabled. This means that you will not be able to generate any font definitions from OpenType files. This is a nuisance since that limits the fonts you can use to ones already in Ming’s FDB format. However has FDB files for the Open Source Bitstream Vera fonts so you can get starting albeit with limited typography. I have not tries these fonts so there may be issues if the format changed – it is filed under Really Old Stuff.
The second major issue is another nuisance. The ming library is built without zlib. When the configure script runs it fails to find the compress2 function used by Ming even though the library was available in msys (downloaded and compiled specifically). That means that Ming cannot generate compressed Flash files. This is not too important, but obviously lacking in any code destined for serious use.
Next Steps:
- Get zlib to be recognised by the configure script.
- Add FreeType so OpenType fonts can be loaded.
- Get the build working with the other language wrappers: python, php and perl.
I will post updates as soon as they are available. I also plan on posting the libraries and ported versions of the Cookbook examples over the next few weeks.
Going, going….
Posted by smackay | Filed under transform
Getting the latest Java version of Transform SWF out of the door has been an enormous amount of work. Most of theĀ problems were a direct result of reading Joshua Bloch’s “Effective Java” more than a few times – a remarkably good book, discovering PMD andĀ Software Craftsmanship – yes I know this is 2010 and not 2001. Also starting a family and having a day-job did not help either.
So with new versions of Transform and Translate scheduled for release on Sept 15th I started thinking about the C++ versions of the libraries which, although quite useful, have been languishing untouched for quite some time now. Initially I was quite looking forward to getting them freshened up and getting the code to the point where I could say that it was rather nice, or at least it didn’t suck as much. But then, well, I started thinking about what that would take. Getting the code updated to support Flash 10 was not really the hard part – after all at the lowest level, C++ and Java syntax are not that different, especially when reading and writing bytes with streams, so the new Java code could easily be moved over to the C++ version. The harder part was cross-platform support. There are simply too many platform variations to be able to support it effectively. CMake does a good job of reducing the effort by making cross-platform builds easy, but the real issue is answering the “I can’t get it to work” requests. Limiting the set to compiler X on platform Y is too restrictive and does not solve the problem since there are still X * Y * Z versions to deal with.
So the C++ code is going to be retired – permanently this time. Instead if you need a library for generating Flash files with C and C++ bindings then take a look at Ming. After a dormant period, activity on the project is picking up again. They have support for Flash 8. Platform support is good, though building on Windows is kind of hairy (more on that later). I tried porting some examples from the Cookbook to Ming and the API is quite effective. The basic concepts and actions to generate a Flash file are the same and re-writing the simpler examples such as, BasicShapes, did not take long – the hardest (time-consuming) part was changing ints to doubles.
So over the next few weeks I am going to port the rest of the Cookbook to see, overall, how easy it is to use Ming. I’ll also post the code and ming libraries since there seems to be some demand for windows binaries and not a lot of success at creating them.