Author Topic: How to compile. Also, update your compiling environment.  (Read 15601 times)

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Instructions for how to set up a build environment and compile WeiDU are available here. These instructions are up to date as of March 2017 and cover Windows, GNU/Linux and macOS.

« Last Edit: March 17, 2017, 05:10:06 PM by Wisp »
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline Taimon

  • Planewalker
  • *****
  • Posts: 326
Re: How to compile. Also, update your compiling environment.
« Reply #1 on: March 29, 2008, 02:39:18 PM »
Just wanted to add that in newer WeiDU versions you will also need Elkhound.
I got the (probably outdated) tarball from the berkeley site.
It refused to compile on my debian box, but I was able to build it after fixing some perl script. (Probably has something to do with a newer flex version.)

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: How to compile. Also, update your compiling environment.
« Reply #2 on: March 29, 2008, 09:41:55 PM »
Just wanted to add that in newer WeiDU versions you will also need Elkhound.
I got the (probably outdated) tarball from the berkeley site.
It refused to compile on my debian box, but I was able to build it after fixing some perl script. (Probably has something to do with a newer flex version.)
I use the berkley.edu version as well.

For me, `./configure && make && sudo cp elkhound/elkhound /usr/bin' worked out of the box.

EDIT: also, yeah, I really should mention elkhound somewhere.
« Last Edit: March 29, 2008, 09:47:13 PM by the bigg »
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline Taimon

  • Planewalker
  • *****
  • Posts: 326
Re: How to compile. Also, update your compiling environment.
« Reply #3 on: March 30, 2008, 02:25:58 AM »
I used flex 2.5.34.

smbase/run_flex.pl launches flex and modifies the generated file after that. (putting some #ifndef's in)
Unfortunately it deletes some flex-generated end comment (*/) during this modification that.
I just mention it here, so if anyone ever has the same issue, he knows where to look at.

Offline Taimon

  • Planewalker
  • *****
  • Posts: 326
Re: How to compile. Also, update your compiling environment.
« Reply #4 on: May 28, 2008, 04:46:46 AM »
How did you compile elkhound on windows? Cygwin + gcc?
I ended up using cygwin + mingw32, but had to edit another file (ckheap.h).
Cross-compile from linux did not work for some reason. Linker did not recognize the symbols in libsmbase.a. No idea.

Oh, and ocamlopt.opt.exe (3.10.2) did crash on trealparser.ml. :)
(But ocamlopt.exe works.)

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: How to compile. Also, update your compiling environment.
« Reply #5 on: May 28, 2008, 04:57:43 AM »
How did you compile elkhound on windows? Cygwin + gcc?
Yup.

Quote
Oh, and ocamlopt.opt.exe (3.10.2) did crash on trealparser.ml. :)
(But ocamlopt.exe works.)
Don't get me started on my hate speech against french people, PLZ. Suffice to say, I think that saying "it's a feature, not a bug" should be punishable by death in a modern country.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline Mike1072

  • Planewalker
  • *****
  • Posts: 280
  • Gender: Male
Re: How to compile. Also, update your compiling environment.
« Reply #6 on: January 23, 2009, 12:51:00 AM »
If you've never compiled WeiDU, instructions are available here.
Link is broken.

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: How to compile. Also, update your compiling environment.
« Reply #7 on: January 23, 2009, 05:05:45 AM »
I've lost the file and it isn't on archive.org. Does anyone have a copy?
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline Mike1072

  • Planewalker
  • *****
  • Posts: 280
  • Gender: Male

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: How to compile. Also, update your compiling environment.
« Reply #9 on: January 23, 2009, 06:47:37 AM »
Doesn't show up if I use the 'resurrect this page' Firefox extension. Guess it's because of /~thebigg/ vs. /users/thebigg/.
That file is outdated, though - it doesn't describe installing elkhound  :(
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: How to compile. Also, update your compiling environment.
« Reply #10 on: January 23, 2009, 07:27:21 AM »
Fixed the broken link, updated with references to elkhound (yes, I'm sure a certain bit in those instructions is TheDailyWTF worthy).
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

erik

  • Guest
Re: How to compile. Also, update your compiling environment.
« Reply #11 on: January 23, 2009, 02:50:06 PM »
Yay. Modern ubuntu has ocaml 3.10.2 packages. :)

Offline Mike1072

  • Planewalker
  • *****
  • Posts: 280
  • Gender: Male
Re: How to compile. Also, update your compiling environment.
« Reply #12 on: January 23, 2009, 06:58:09 PM »
Fixed the broken link, updated with references to elkhound (yes, I'm sure a certain bit in those instructions is TheDailyWTF worthy).
Thanks for updating it.  I think I've managed to compile it successfully.  I had to do a couple things differently, though.

In this section:
Quote
- Fix these file errors (in all cases, by closing the comments with a */ like you'd do in .tp2, .d etc.).
      C:\cygwin\home\username\elsa-2005.08.22b\ast\agramlex.yy.cc, line 1229
      C:\cygwin\home\username\elsa-2005.08.22b\ elkhound/gramlex.yy.cc, line 1366
- Once you fixed these files, continue running the following in Cygwin:
    for a in smbase ast elkhound; do cd $a; ./configure; cd ..; done
    for a in smbase ast elkhound; do cd $a; ./make; cd ..; done
    cp elkhound/elkhound.exe /usr/bin

The files with the errors in them didn't exist before make was executed, so I had to do this instead:
Quote
cd smbase
./configure
make
cd ../ast
./configure
make

(error gets reported here - need to fix agramlex.yy.cc, line 1229)

Fixed it:
Quote
/* The contents of this function are C++ specific, so the () macro is not used.
*/
#ifndef NO_YYFLEXLEXER_METHODS
yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
{

Then continued:

Quote
make
cd ../elkhound
./configure
make

(error gets reported here - need to fix gramlex.yy.cc, line 1366, do same as above)
make
cp elkhound.exe /usr/bin


Then I felt pretty good, but I ran into an issue when running make windows_zip in the WeiDU directory.  I got some error basically telling me that flexlink didn't exist.  I made sure I'd installed flex, and when I couldn't find anything more, I Googled it and came up with this page.  Grabbing the binary package there made it work.

Now I just need to make the docs...

Edit: Woot, can make docs, too.
« Last Edit: January 23, 2009, 09:46:18 PM by Mike1072 »

Offline Taimon

  • Planewalker
  • *****
  • Posts: 326
Re: How to compile. Also, update your compiling environment.
« Reply #13 on: January 24, 2009, 06:45:37 AM »
By the way, this was my modification to smbase/run-flex.pl to get around the grammar issue:
Code: [Select]
--- elsa-2005.08.22b/smbase/run-flex.pl
+++ elsa-2005.08.22b/smbase/run-flex.pl
@@ -220,12 +220,9 @@
   }
 
   elsif ($state == 6) {
-    if ($line =~ m/^yyFlexLexer::yyFlexLexer/) {
+    if ($lines[$i+1] =~ m/^yyFlexLexer::yyFlexLexer/) {
       $state++;
-      $i++;       # skip the '{' line, to keep #line numbers in sync
-      chomp($line);
-      print OUT ("#ifndef NO_YYFLEXLEXER_METHODS\n" .
-                 $line . " {\n");
+      print OUT ("#ifndef NO_YYFLEXLEXER_METHODS\n");
       next;
     }
   }

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: How to compile. Also, update your compiling environment.
« Reply #14 on: January 26, 2009, 04:25:32 PM »
(a bit late) uploaded a fixed version of elkhound to the weidu.org host. Taimon, you posted a reversed patch  ;)
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline Taimon

  • Planewalker
  • *****
  • Posts: 326
Re: How to compile. Also, update your compiling environment.
« Reply #15 on: January 27, 2009, 04:48:51 AM »
Oh... I knew it looked a bit odd.  ;D

Offline GammaLeak

  • Planewalker
  • *****
  • Posts: 23
Re: How to compile. Also, update your compiling environment.
« Reply #16 on: March 01, 2012, 02:44:58 PM »
Mac OSX
instructions for compiling are available here.
To update OCaml: run steps 2 to 10 from those instructions.

I'm trying to compile on Mac OS X. I've got all of the dependencies listed in the Weidu documentation (ocaml, sed, etc). However, I get all kinds of errors and eventually it tells me that it can't find src/myarg.o.

The link above is dead. What's the best way to get unstuck on this?

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1030
  • Gender: Male
Re: How to compile. Also, update your compiling environment.
« Reply #17 on: March 01, 2012, 05:07:59 PM »
I don't know much about OCaml, but for C derivatives anyway, typically you rm *.o (delete all object files) before compiling, aka make clean. Compiling then generates those .o files. If OCaml actually needs them to compile, then I don't know wtf. devSin is the one who usually does the Mac compiles, and he's probably AWOL and/or lurking-but-not-posting like the bigg.

Offline GammaLeak

  • Planewalker
  • *****
  • Posts: 23
Re: How to compile. Also, update your compiling environment.
« Reply #18 on: March 01, 2012, 07:39:32 PM »
I don't know much about OCaml, but for C derivatives anyway, typically you rm *.o (delete all object files) before compiling, aka make clean. Compiling then generates those .o files. If OCaml actually needs them to compile, then I don't know wtf. devSin is the one who usually does the Mac compiles, and he's probably AWOL and/or lurking-but-not-posting like the bigg.
Yeah, in this case I'm trying to compile from a freshly unzipped version of the source code, so there are no lingering .o files. My guess is that I'm either missing a non-obvious dependency or that the makefile configuration needs some fiddling that isn't apparent.

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: How to compile. Also, update your compiling environment.
« Reply #19 on: March 01, 2012, 09:32:04 PM »
I don't believe it's been compiled natively for x86 with the latest OCaml builds (I've never tried it, so I can't help you).

I can't remember the build environment here. I think it's PPC 3.11 or something (maybe even 3.10) on Mac OS X 10.4.11. I know there were issues trying to move to newer builds of OCaml on that box, although I have no memory of what exactly they were.

Make sure you also have elkhound. I don't think there's any precompiled binary of that for Mac OS X (and again, it's all done on an old PPC box for the official WeiDU builds).
« Last Edit: March 01, 2012, 09:35:04 PM by devSin »

Offline GammaLeak

  • Planewalker
  • *****
  • Posts: 23
Re: How to compile. Also, update your compiling environment.
« Reply #20 on: March 01, 2012, 09:35:08 PM »
I don't believe it's been compiled natively for x86 with the latest OCaml builds (I've never tried it, so I can't help you).

I can't remember the build environment here. I think it's PPC 3.11 or something (maybe even 3.10) on Mac OS X 10.4.11. I know there were issues trying to move to newer builds of OCaml on that box, although I have no memory of what exactly they were.
Thanks for checking in devSin! I definitely respect your work a ton! So in that case... where do the modern Mac builds come from? There is a Mac executable for 231 after all.

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: How to compile. Also, update your compiling environment.
« Reply #21 on: March 01, 2012, 09:41:39 PM »
I compile them, on that old PPC box running Mac OS X 10.4.11.

There has never been an official universal build (our executables are PPC only, and shouldn't even run on Mac OS X 10.7 or later, that I know of). Because I'm no longer active, I had no interest in the work of setting up the build environment on a newer Intel Mac. So I have no idea what changes would be required to get a successful build with newer releases of Mac OS X and OCaml, sorry. :(

If you're running BG through Wine, you should probably just run WeiDU through Wine too, if you can. Or just pick up a copy of Windows and Boot Camp it.

Offline GammaLeak

  • Planewalker
  • *****
  • Posts: 23
Re: How to compile. Also, update your compiling environment.
« Reply #22 on: March 01, 2012, 09:56:26 PM »
Wow! Interestingly enough, Mac WeiDU runs on Intel machines and mostly does an awesome job. The only problem I know of is the biff_path_separator issue below. You must be compiling it with a universal binary flag?

Running WeiDU in a BootCamp partition obviously works just great... but it's a pain to have to reboot. The PC version of WeiDU sort of works in Wine, but due to some problems in Wine's implementation of command line stuff it doesn't work perfectly.

In any case, thanks again for weighing in. I guess I'll take some time to figure out if I can get this going on my own....

Offline GammaLeak

  • Planewalker
  • *****
  • Posts: 23
Re: How to compile. Also, update your compiling environment.
« Reply #23 on: March 05, 2012, 05:46:40 AM »
I made an interesting discovery this last weekend.

I decided to flush out my Mac and reinstall my OS from scratch. Once I got everything up and running I tried to run devSin's version of WeiDU for Mac... and it wouldn't run. Not right away, anyhow. It required me to install Rosetta.

So THAT's how devSin's build runs on my machine. Rosetta is the interpretation layer for OS X that allows Intel Macs to run (most) PPC-compiled exectuables.

But there's a problem with that. OS X 10.7 ("Lion") no longer supports Rosetta, and neither does the upcoming Mountain Lion. In fact, Apple has left Rosetta behind completely.

So, for current/future Mac users who want to run WeiDU natively on a Wine install of BG2, they will need a version of WeiDU compiled on an Intel Mac.

The good news is that I'm close to getting there. I still need to figure out why some of the support utilities won't compile (weimorph, etc), but once that is out of the way I should have a repeatable process in place to provide Intel Mac executables to the community.

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: How to compile. Also, update your compiling environment.
« Reply #24 on: March 05, 2012, 06:07:35 AM »
That's what I originally said. ;-)

(our executables are PPC only, and shouldn't even run on Mac OS X 10.7 or later, that I know of)

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: