Ascii Chart

•November 11, 2011 • Leave a Comment

I look for this a lot:

Alternatively if you have a tool such as 010 Editor, there is an ascii chart there too I believe.

Boost C++11 GCC and MinGW

•November 11, 2011 • Leave a Comment

If you want to use the new C++11 features when compiling boost, you’ll need to add this:

cxxflags=-std=gnu++0x

to your build command line. If you add

cxxflags=-std=std++0x

You will get build errors about something to do with ‘environ’. It took me quite some time to figure this one out.

Defcon 19

•August 10, 2011 • 1 Comment

MikeD and I delivered this presentation to a reasonably full room (for sunday @ 5pm) at the Rio for Defcon 19. Hacking MMORPGs for Fun and Mostly Profit

Precompiled GCC Nightlies and Official Releases MinGW distro.

•February 2, 2011 • Leave a Comment

http://www.equation.com/servlet/equation.cmd?call=fortran

These look like they are based off of the MinGW64 project as there are both 32 bit and 64 bit builds and the headers included in the 32 bit build appear to be the same as the ones included in the mingw64-32 project.

This currently has gcc 4.6.2 builds as well as the sexy new gcc 4.7.0 builds.

Compiling GCC 4.6 Nightlies on Windows with MinGW and MSYS

•October 22, 2010 • 1 Comment

Step 1:

Download these packages

http://nuwen.net/files/mingw/sources-6.6.7z
http://nuwen.net/files/mingw/msys-6.3.7z

You can find more up-to-date versions here:
http://nuwen.net/mingw.html

The above packages will get you some of the dependencies of compiling gcc on windows plus a whole bunch of other things that aren’t needed, but I found it easier to use the stuff there.

Also, you should download the latest gcc-core and gcc-g++ packages from the LATEST-4.6 folder on one of the GCC mirrors, I use http://mirrorpool.in/Gcc/snapshots/LATEST-4.6/, Extract them so that the tars are in the sources folder with the rest of the packages.

2. Create a directory
c:/temp/gcc

3. Extract sources and msys to anywhere.

4. Download the latest flex and extract it to where you extracted msys so that flex.exe is in msys/bin.
http://sourceforge.net/projects/mingw/files_beta/MSYS/flex/

5. Do the same for Bison
http://sourceforge.net/projects/mingw/files_beta/MSYS/bison/

6. Copy this script and save it in the sources folder from earlier as gcc-build.sh

#!/bin/sh

# Ensure that mingw-runtime and w32api exist.
test -d /c/temp/gcc/mingw-runtime || { echo /c/temp/gcc/mingw-runtime does not exist. ; exit; }
test -d /c/temp/gcc/w32api || { echo /c/temp/gcc/w32api does not exist. ; exit; }

# Extract vanilla sources.

tar -C /c/temp/gcc -xf $2

tar -C /c/temp/gcc -xf $3
tar -C /c/temp/gcc -xf gmp-5.0.1.tar
tar -C /c/temp/gcc -xf mpfr-3.0.0.tar
patch -Z -d /c/temp/gcc/mpfr-3.0.0 -p1 < mpfr-3.0.0.patch
tar -C /c/temp/gcc -xf mpc-0.8.2.tar

# Arrange vanilla sources.
cd /c/temp/gcc
mv $1 src
mv gmp-5.0.1 src/gmp
mv mpfr-3.0.0 src/mpfr
mv mpc-0.8.2 src/mpc

# Copy mingw-runtime and w32api.
mkdir -p /include
rm -rf /mingw
mkdir /mingw
cp -r mingw-runtime/* /mingw
cp -r w32api/* /mingw

# Configure.
mkdir build dest
cd build
../src/configure –prefix=/c/temp/gcc/dest –enable-languages=c,c++ –with-arch=i686 –with-tune=generic –disable-libstdcxx-pch –disable-nls –disable-shared –disable-sjlj-exceptions –disable-win32-registry –enable-checking=release

# –disable-libstdcxx-pch : I don’t use this, and it takes up a ton of space.
# –disable-nls : I don’t want Native Language Support.
# –disable-shared : I don’t want DLLs.
# –disable-sjlj-exceptions : I don’t want SJLJ, I want DW2.
# –disable-win32-registry : I don’t want this abomination.
# –enable-checking=release : I don’t want expensive checking if this came from SVN or a snapshot.
# –enable-lto : LTO is not enabled by default for MinGW, but can be explicitly requested.

# Build and install.
make bootstrap install “CFLAGS=-g0 -Os -fomit-frame-pointer” “CXXFLAGS=-g0 -O3 -fomit-frame-pointer -mthreads” “CFLAGS_FOR_TARGET=-g0 -Os -fomit-frame-pointer” “CXXFLAGS_FOR_TARGET=-g0 -O3 -fomit-frame-pointer -mthreads” “BOOT_CFLAGS=-g0 -Os -fomit-frame-pointer” “BOOT_CXXFLAGS=-g0 -O3 -fomit-frame-pointer -mthreads” || { echo EPIC FAIL ; exit; }

The above script is a modified version of what came from nuwen.net.

7. Launch your msys shell from the msys directory you created earlier and navigate to your sources-6.6 directory and execute the following scripts:

w32api-3.14.sh
and
mingw-runtime-3.18.sh

8. Now run the gcc-build.sh script like this (assuming you have the same nightly as I do)

./gcc-build.sh gcc-4.6-20101016 gcc-core-4.6-20101016.tar "gcc-g++-4.6-20101016.tar"

The 1st parameter is the nightly build version, the 2nd parameter is the name of the gcc core archive. the 3rd is the name of the g++ archive.

9. This should fail with a message like this:

make[3]: Circular s-tm-texi tmp-tm.texi
/bin/sh ../../src/gcc/../move-if-change tmp-tm.texi tm.texi

Verify that you have permission to grant a GFDL license for all
new text in tm.texi, then copy it to ../../src/gcc/doc/tm.texi.
make[3]: *** [s-tm-texi] Error 1
make[3]: Leaving directory `/c/temp/gcc/build/gcc'

10. Now you need to navigate to
C:\temp\gcc\build\gcc\
and copy
tm.texi
to
C:\temp\gcc\src\gcc\doc\

11. Now you need to navigate to
C:\temp\gcc\src\lto-plugin\

And modify the following file:
lto-plugin.c
Modify line 44 to wrap it in a #ifndef like this:


#ifndef WIN32
#include
#endif

Then navigate to what will now be line 461 and do the same thing:


#ifndef WIN32
check (WIFEXITED (status) && WEXITSTATUS (status) == 0, LDPL_FATAL,
"lto-wrapper failed");
#endif

Now save the file and move on to the next step.

12. Now run the 2nd script (I saved it in the sources-6.6 folder as gcc-build2.sh)
#!/bin/sh

# Arrange vanilla sources.
cd /c/temp/gcc

cd build
# Build and install.
make bootstrap install "CFLAGS=-g0 -Os -fomit-frame-pointer" "CXXFLAGS=-g0 -O3 -fomit-frame-pointer -mthreads" "CFLAGS_FOR_TARGET=-g0 -Os -fomit-frame-pointer" "CXXFLAGS_FOR_TARGET=-g0 -O3 -fomit-frame-pointer -mthreads" "BOOT_CFLAGS=-g0 -Os -fomit-frame-pointer" "BOOT_CXXFLAGS=-g0 -O3 -fomit-frame-pointer -mthreads" || { echo EPIC FAIL ; exit; }

# Cleanup.
rm -rf /mingw
cd /c/temp/gcc/dest
rm -rf share
cd bin
rm c++.exe gccbug i686-pc-mingw32-*
cp gcc.exe cc.exe
cd ..
find -name "*.exe" -type f -print -exec strip -s {} ";"

13. Now everything should work!

Semi large website development in C++ using Wt (Witty)

•October 18, 2010 • 4 Comments

So, I’ve decided to take up a decent sized web development project. It will include the following components.

  • User forum
  • User blogs
  • User profiles and friends lists.
  • News feed
  • Groups (similar to meetup.com)
  • Classifieds (like craigslist but not ghetto and targeted for my audience)
  • Social networking integration
  • Stackoverflow integration for my target audience
  • e-commerce functionality for a small number of products

 

I plan to use the following technologies:

It’s a hard project, but I’m giving myself 3 months to make decent progress and if I make good progress, I think that some friends and I can complete it within a 12 to 18 months. If the first 3 months proves futile, I will just go with communityengine and rails.

 

Locale problems with VPS hosted Ubuntu server

•October 17, 2010 • Leave a Comment

I’ve had my hosting company setup a couple VPS servers for me, running Ubuntu 8.04 Server and 10.0.4 and each time I noticed these errors whenever I ran apt-get upgrade:

Code:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

Some people had suggested that running:

dpkg-reconfigure locales

would fix the problem, however, for me it did not and I sitll got the same error:

xxxxx@scm:~# dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
 LANGUAGE = (unset),
 LC_ALL = (unset),
 LANG = "en_US.UTF-8"
 are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

…and here is the output from the locale command:
Code:
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

The problem is apparently caused by:
Quote:
Debootstrap does not create locales. When you run the virtual machine, if you get errors like the following, run the command below.

To fix this, run this, replace en_US.UTF-8 with your own locale.
Code:
sudo locale-gen en_US.UTF-8

That one command did the trick for me. My output from the locale command is then:

Code:
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Afterwards, if you run

dpkg-configure locales

You should see the correct output:

xxxxx@scm:~# dpkg-reconfigure locales
Generating locales…
en_US.UTF-8… up-to-date
Generation complete.