TOP > Programming > Lua > How To Build Lua


#### How To Build Lua ####
In this page I'll show you how to build Lua not to install.

Both binaries and installers are available in the official web site and the source code is too. In short, you can build it in your own environment instead of using neither a pre-built binary nor an installer.

In my case, mainly I have three reasons why I wanted to build it on my own. Those are following:
  1. The only library I successfully found in the official web site was the DLL edition. but I would rather like to use a static library.
  2. I'd like to make sure that I build anything in 'Multithread(/MT)'.
  3. As a matter of fact, building it was actually much easier than I thought.
Just to let you know, the most important reason was the third one.
#### Steps ####
I did the following steps on VC++2010Express.

【Step1 : Download the source code from the official web site】

I downloaded the version 5.1.4.
That was due to a really complicated reason so I won't let you know why.
By the way, did you notice that the file you probably downloaded has 'tar.gz' extention? What on earth is that supposed to mean? Exciting. Throbbing.

【Step2 : Create a project】

Let's create a new project with our beloved VC++2010Express as usual.
Just go straight to 'Console Application'. You love it, don't you?

Go next. Our battle is not over yet!

Then she asked you 'what kind of application would you carelessly like to create? Huhuhu...' grinning enigmatically.
In this case, 'Static library' should be better. Do..don't you think...? I'm just wondering...
And do you happen to know pre-compiled header? Oh just forget it...

【Step3 : Throw the source code into your hopeful project】

Put the source code you just downloaded into the project's folder.

Don't take excessive care of that. Just throw them into there without second thought.

Files that have 'c' extentions rush into the 'Source' folder.

Files that have 'h' extentions rampage into the 'Header' folder.
You can just let them go without any hesitation as if those were files you created on your own. Oh crap! You should do that while showing your appreciation to people who kindly created this amazing library. Otherwise your life would issue an serious error!

【Step4 : Make your project 'Multithread(/MT)'】

Project > Properties >
Configuration Manager > Active Solution Configuration > Release > Close >
C/C++ > Code Generation > Runtime Library > Multithread(/MT)

You don't have to configure as above. But I did.
You ask me why?
If I didn't do that, my lovely application sadly becomes an useless one that couldn't run on other people's machines. I've experienced such tearfull days some times in the past.

By default, that is configured 'Multithread(/DLL)' for some enigmatic reason. That's as if somebody outrageously plans to disturb our sweet applications from running widely. How could! How could!

【Step5 : Now that you can build it】

Do you have any other items that you'd like to modify? Then just do it right now before you start to build.
After all what we'll do is 'build' not 'automatic install'. We can do whatever we like. That's really fun. Don't you think so, pal?

Hit the F7 key at your full power!

Lots of warnings are issued. Looks like she got mad at us. Terribly horrible.

It's done rightly! Rightly! Here me roar!

Oh, in the 'Realease' folder, I happend to find a lib file. Hurraaaaay!
By the way, where is the 'Release folder'?
(There are two. Whitch one do you think is the right answer?) would be better to build it in both 'Debug' and 'Release' modes. If anyone with tearful eyes begs me 'you definitely must choose only one out of two!', I would hopelessly give up and just take 'Release' but fortunately I had nobody who did such a mean thing so I successfully built in both modes.
That's why I have two types of lib files now. You jealous me, don't you? Tee-hee.
#### Download the binary lib files ####
I upload the lib files I built in my own environment......

I cared of doing so but come to think of it this page was originally supposed to tell how to build that on your own environment.
With that in mind I couldn't actually upload them.
You'd say that's just because of my laziness? That's not true. That's a right decision. Okay?

#### Sweetness ####
Now you can buil Lua on your own. That means you can customize it as much as you like.
Sounds nice, huh?
We provide another article that says how to costomize it as an example.