Pocket Plane Group

Friends and Neighbors => Weimer Republic (WeiDU.org) => WeiDU => Topic started by: the bigg on June 14, 2007, 03:56:36 PM

Title: How to compile. Also, update your compiling environment.
Post by: the bigg on June 14, 2007, 03:56:36 PM
Instructions for how to set up a build environment and compile WeiDU are available here (http://www.weidu.org/~thebigg/new_compile.html). These instructions are up to date as of March 2017 and cover Windows, GNU/Linux and macOS.

Title: Re: How to compile. Also, update your compiling environment.
Post by: Taimon 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.)
Title: Re: How to compile. Also, update your compiling environment.
Post by: the bigg 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.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Taimon 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.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Taimon 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.)
Title: Re: How to compile. Also, update your compiling environment.
Post by: the bigg 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 (http://caml.inria.fr/mantis/view.php?id=4405)" should be punishable by death in a modern country.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Mike1072 on January 23, 2009, 12:51:00 AM
If you've never compiled WeiDU, instructions are available here (http://www.weidu.org/~thebigg/compile.html).
Link is broken.
Title: Re: How to compile. Also, update your compiling environment.
Post by: the bigg 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?
Title: Re: How to compile. Also, update your compiling environment.
Post by: Mike1072 on January 23, 2009, 05:43:41 AM
Oh, snap.

http://web.archive.org/web/20070701033342/http://www.weidu.org/users/thebigg/compile.html

Will give it a go tomorrow, I think.
Title: Re: How to compile. Also, update your compiling environment.
Post by: the bigg 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  :(
Title: Re: How to compile. Also, update your compiling environment.
Post by: the bigg 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).
Title: Re: How to compile. Also, update your compiling environment.
Post by: erik on January 23, 2009, 02:50:06 PM
Yay. Modern ubuntu has ocaml 3.10.2 packages. :)
Title: Re: How to compile. Also, update your compiling environment.
Post by: Mike1072 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 (http://alain.frisch.fr/flexdll.html).  Grabbing the binary package there made it work.

Now I just need to make the docs...

Edit: Woot, can make docs, too.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Taimon 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;
     }
   }
Title: Re: How to compile. Also, update your compiling environment.
Post by: the bigg 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  ;)
Title: Re: How to compile. Also, update your compiling environment.
Post by: Taimon on January 27, 2009, 04:48:51 AM
Oh... I knew it looked a bit odd.  ;D
Title: Re: How to compile. Also, update your compiling environment.
Post by: GammaLeak on March 01, 2012, 02:44:58 PM
Mac OSX
instructions for compiling are available here (http://loriel.quixjote.com/forums/index.php?topic=6.0).
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?
Title: Re: How to compile. Also, update your compiling environment.
Post by: Miloch 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 (http://www.cs.utah.edu/dept/old/texinfo/make/make.html). 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.
Title: Re: How to compile. Also, update your compiling environment.
Post by: GammaLeak 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 (http://www.cs.utah.edu/dept/old/texinfo/make/make.html). 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.
Title: Re: How to compile. Also, update your compiling environment.
Post by: devSin 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).
Title: Re: How to compile. Also, update your compiling environment.
Post by: GammaLeak 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.
Title: Re: How to compile. Also, update your compiling environment.
Post by: devSin 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.
Title: Re: How to compile. Also, update your compiling environment.
Post by: GammaLeak 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....
Title: Re: How to compile. Also, update your compiling environment.
Post by: GammaLeak 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.
Title: Re: How to compile. Also, update your compiling environment.
Post by: devSin 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)
Title: Re: How to compile. Also, update your compiling environment.
Post by: GammaLeak on March 05, 2012, 06:28:48 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)

Right you are! Sorry about that!  :)
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on December 14, 2012, 09:09:21 AM
Updated list of packages for building WeiDU on Debian:
Code: [Select]
build-essential hevea ocaml ocaml-native-compilers texlive tcl8.5-dev tk8.5-dev unzip upx-ucl zip

I also tossed together a zip with roy's modified Elkhound source, Bigg's win32 exe and a 32-bit Linux executable, available here (http://ubuntuone.com/6loVQyiGfuegid9p8r1C1v).
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on June 05, 2013, 02:50:19 PM
I've updated the instructions for how to compile (in the first post). Interested parties are encouraged to comment and ask questions.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Mike1072 on June 05, 2013, 06:51:50 PM
Thanks!  I had wanted to get my build environment working again.

Right now, it's crapping out partway through the make.

Before starting this, I updated my Cygwin and grabbed fresh installations of OCaml and Elkhound.

These are in my Windows path:
Code: [Select]
C:\elkhound\win32\x86-cygwin;
C:\ocaml\bin;

Normally the make gets this far:
Code: [Select]
Generating dependency information for src/case_ins.ml
Generating dependency information for batteries-lite/batteriesInit.ml
Generating dependency information for batteries-lite/batList.ml
/cygdrive/c/elkhound/win32/x86-cygwin/elkhound -ocaml src/trealparserin.gr
process_begin: CreateProcess(NULL, /cygdrive/c/elkhound/win32/x86-cygwin/elkhound -ocaml src/trealparserin.gr, ...) failed.
make (e=2): The system cannot find the file specified.

And then dies with:
Code: [Select]
Compiling interface batteries-lite/batList.mli
Compiling batteries-lite/batList.ml to native code
/usr/bin/sh: C:ocamlbin/ocamlopt.opt: No such file or directory
cp: cannot stat `batteries-lite/batList.o': No such file or directory
mingw32-make: *** [obj/x86_WIN32/batList.cmx] Error 1

If I switch to forward slashes in the Configuration file (e.g. C:/ocaml/bin), it doesn't die until a little later:
Code: [Select]
Compiling src/tpstate.ml to native code
Compiling src/tphelp.ml to native code
mingw32-make: *** No rule to make target `obj/x86_WIN32/trealparserin.ml', needed by `obj/x86_WIN32/trealparser.ml'.  Stop.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Mike1072 on June 05, 2013, 06:55:42 PM
Even earlier on there is a similar error:
Code: [Select]
C:\\ocaml\\bin/ocamlyacc  src/iwgparser.mly
Generating dependency information for obj/x86_WIN32/iwgparser.mli
C:\\ocaml\\bin/ocamlyacc  src/toldparser.mly
17 shift/reduce conflicts.
Generating dependency information for obj/x86_WIN32/toldparser.mli
ocaml str.cma unix.cma -w p scripts/make_gr.ml
/cygdrive/c/elkhound/win32/x86-cygwin/elkhound -ocaml src/trealparserin.gr
C:\\ocaml\\bin/ocamlyacc  src/dparser.mly
process_begin: CreateProcess(NULL, /cygdrive/c/elkhound/win32/x86-cygwin/elkhound -ocaml src/trealparserin.gr, ...) failed.
make (e=2): The system cannot find the file specified.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on June 06, 2013, 09:44:41 AM
]Hmm, are you able to invoke Elkhound on the Cygwin terminal manually (no arguments, just to see if it responds)?

Also, you are using mingw32-make, while I use plain make. I suppose it is possible they differ in some relevant way (wrt. how they handle paths and backslashes therein). You may want to try switching.
Edit: Actually, it probably is the different make ports. If the mingw port does not understand Cygwin paths (which seems reasonable), that would account for Elkhound. And if the mingw port does not escape backslashes (like Cygwin's port does), that would account for the behaviour you see with OCaml.
Edit2: You could also try placing Elkhound inside the Cygwin environment (c:\cygwin\bin would not be inappropriate) and go with forward slashes in Configuration and see if that helps. (Before you try altering your Cygwin package selection, I mean.)
Title: Re: How to compile. Also, update your compiling environment.
Post by: Mike1072 on June 06, 2013, 11:57:51 PM
Also, you are using mingw32-make, while I use plain make.
That was the problem.  I don't remember what possessed me to replace my make.
Title: Re: How to compile. Also, update your compiling environment.
Post by: AL|EN on March 14, 2017, 12:06:55 PM
1. Cannot download OCaml 4.00.1 Cygwin-based native Win32 port, can I use latest version?
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on March 14, 2017, 01:35:08 PM
I haven't tested it, but this (https://protz.github.io/ocaml-installer/) (available from the link "Official OCaml distribution" on ocaml.org) sounds about right. I don't know if it installs mingw itself. If not, you'll have to chase it down within the Cygwin environment. Without porting, WeiDU needs a *nix environment (i.e., Cygwin), Ocaml and Cygwin-hosted mingw-gcc. I'll try to swing an updated description by the weekend.
Title: Re: How to compile. Also, update your compiling environment.
Post by: AL|EN on March 14, 2017, 01:46:37 PM
2. After setup, trying to compiling using Windows, I get this error:
Code: [Select]
obj/.depend/idsparser.d:2: *** missing separator. StopGoogle points to http://stackoverflow.com/questions/23927212/makefile2-missing-separator-stop but I can't fix it because there are more than 80 files inside obj/.depend and when I fix one, it's get recreated with nonworking version when I type make weidu again
3. After setup, trying to compiling using debian 32-bit, I get this error when trying to execute weidu.exe at Windows 10 64-bit:
Code: [Select]
Version setup-weidu.exe is not compatible with the version of Windows running. Check the information on the operating system on your computer, then contact the software publisher.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on March 14, 2017, 03:41:23 PM
2. After setup, trying to compiling using Windows, I get this error:
Code: [Select]
obj/.depend/idsparser.d:2: *** missing separator. StopGoogle points to http://stackoverflow.com/questions/23927212/makefile2-missing-separator-stop but I can't fix it because there are more than 80 files inside obj/.depend and when I fix one, it's get recreated with nonworking version when I type make weidu again
What's it like originally and what do you do to fix it? What make are you using?

Quote
3. After setup, trying to compiling using debian 32-bit, I get this error when trying to execute weidu.exe at Windows 10 64-bit:
Code: [Select]
Version setup-weidu.exe is not compatible with the version of Windows running. Check the information on the operating system on your computer, then contact the software publisher.
If you are trying to run a WeiDU executable built on Debian on Windows, it won't work. Regardless of the EXE extension, it's an ELF binary built for *nix. OCaml does not do cross-compilation at all.
Title: Re: How to compile. Also, update your compiling environment.
Post by: AL|EN on March 14, 2017, 04:10:24 PM
Quote
What's it like originally and what do you do to fix it? What make are you using?
I'm using 'make' from cgwin acording to:
Quote
Install the following Cygwin packages and their dependencies:
Archive: zip
Devel: binutils, git, make
Net: openssh
Utils: upx
The error message is caused by C:\cygwin\home\V3\weidu\obj\.depend\idsparser.d file content:
Code: [Select]
  obj/x86_WIN32/idsparser.cmo :  obj/x86_WIN32/util.cmx  obj/x86_WIN32/parsing.cmx  obj/x86_WIN32/ids.cmx \obj/x86_WIN32/
     obj/x86_WIN32/batteriesInit.cmx   obj/x86_WIN32/idsparser.cmi
  obj/x86_WIN32/idsparser.cmx :  obj/x86_WIN32/util.cmx  obj/x86_WIN32/parsing.cmx  obj/x86_WIN32/ids.cmx \obj/x86_WIN32/
     obj/x86_WIN32/batteriesInit.cmx   obj/x86_WIN32/idsparser.cmi
according to http://stackoverflow.com/questions/23927212/makefile2-missing-separator-stop (http://stackoverflow.com/questions/23927212/makefile2-missing-separator-stop), make expect real tabs, not spaces: EditorPicAllCharactersVisible (http://image.prntscr.com/image/cb852b40127146199c8b1b35c2f88e5a.png)
Code: [Select]

obj/x86_WIN32/idsparser.cmo :  obj/x86_WIN32/util.cmx  obj/x86_WIN32/parsing.cmx  obj/x86_WIN32/ids.cmx \obj/x86_WIN32/
   obj/x86_WIN32/batteriesInit.cmx   obj/x86_WIN32/idsparser.cmi
obj/x86_WIN32/idsparser.cmx :  obj/x86_WIN32/util.cmx  obj/x86_WIN32/parsing.cmx  obj/x86_WIN32/ids.cmx \obj/x86_WIN32/
   obj/x86_WIN32/batteriesInit.cmx   obj/x86_WIN32/idsparser.cmi


after replacing spaces to tabs inside idsparser.d file, I no longer getting error message for this file but I get for next one:
Code: [Select]
obj/.depend/bcsparser.d:2: *** missing separator.  Stop
and even if i fix all of those files, after executing 'make weidu' the first file idsparser.d file gets recreated again with spaces and I get the same error.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on March 14, 2017, 05:14:23 PM
What version of make? I am unable to reproduce this on my machine (but this is with an older version of Cygwin, so not entirely comparable) with the most recent OCaml. Are you using 32-bit or 64-bit OCaml? FWIW, the dependency files are generated with spaces on both my Linux (make 4.1) and Windows (make 4.2.1) systems with no complaints from make.

I'll try with a not-old version of Cygwin some time during the week.
Title: Re: How to compile. Also, update your compiling environment.
Post by: AL|EN on March 14, 2017, 06:59:40 PM

Code: [Select]
$ make --version
GNU Make 4.2.1
Ten program został zbudowany dla systemu i686-pc-cygwin
Copyright (C) 1988-2016 Free Software Foundation, Inc.
Licencja GPLv3+: GNU GPL wersja 3 lub nowsza <http://gnu.org/licenses/gpl.html>
To oprogramowanie jest wolnodostępne: można je swobodnie zmieniać i rozpowszechniać.
Nie ma ŻADNEJ GWARANCJI w zakresie dopuszczalnym przez prawo.
I'm using 32-bit OCaml
Title: Re: How to compile. Also, update your compiling environment.
Post by: Argent77 on March 15, 2017, 08:53:07 AM
I can confirm that latest Cygwin installations fail to compile WeiDU with the above-mentioned error.

If it helps, a comparison between current (working) and latest package versions of my Cygwin installation: http://i.imgur.com/LRDeIkj.png
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on March 15, 2017, 05:18:11 PM
Upon closer inspection, the idsparser.d ALIEN posted looks whacked. The less indented lines should end with a backslash, to escape the newline, and the spurious "obj/x86_WIN32/" that comes after the backslash should not be there. So I guess this has something to do with sed, which is among the updated packages (and which is used here).

Can someone make sure they have perl installed and apply this patch and see if it helps?
Code: [Select]
diff --git a/Makefile.ocaml b/Makefile.ocaml
index f13d027..2f4a2ba 100755
--- a/Makefile.ocaml
+++ b/Makefile.ocaml
@@ -324,12 +324,12 @@ cleancaml:
 
 # If you have perl but not sed you can use this line instead. Don't you
 # wish we were using autoconf?
-#FIXDEPEND:=perl -e 'while(<>) { s%[^/\\ :]+[/\\]% %g; s%([^ :\\\n]+)%\$$(OBJDIR)/$$1%g; print $$_;}'
-ifdef WINDIR
-  FIXDEPEND:=sed -e '{ s%[^/\\ :][^/\\ :]*[/\\]% %g; s%\([^ :\\\n][^ :\\\n]*\)%$(OBJDIR)/\1%g; }' # -e 's.obj/x86_WIN32/[^o]*$$..g'
-else
-  FIXDEPEND:=sed -e '{ s%[^/\\ :][^/\\ :]*[/\\]% %g; s%\([^ :\\\n][^ :\\\n]*\)%$(OBJDIR)/\1%g; }'
-endif
+FIXDEPEND:=perl -e 'while(<>) { s%[^/\\ :]+[/\\]% %g; s%([^ :\\\n]+)%\$$(OBJDIR)/$$1%g; print $$_;}'
+#ifdef WINDIR
+#  FIXDEPEND:=sed -e '{ s%[^/\\ :][^/\\ :]*[/\\]% %g; s%\([^ :\\\n][^ :\\\n]*\)%$(OBJDIR)/\1%g; }' # -e 's.obj/x86_WIN32/[^o]*$$..g'
+#else
+#  FIXDEPEND:=sed -e '{ s%[^/\\ :][^/\\ :]*[/\\]% %g; s%\([^ :\\\n][^ :\\\n]*\)%$(OBJDIR)/\1%g; }'
+#endif

You can use the -p1 option to patch to strip the a/b stuff or make the corresponding changes à la main.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Argent77 on March 15, 2017, 06:17:21 PM
Doesn't work either. Resulting idsparser.d:
Code: [Select]
  $(OBJDIR)/idsparser.cmo :  $(OBJDIR)/util.cmx  $(OBJDIR)/parsing.cmx  $(OBJDIR)/ids.cmx \$(OBJDIR)/
     $(OBJDIR)/batteriesInit.cmx   $(OBJDIR)/idsparser.cmi
  $(OBJDIR)/idsparser.cmx :  $(OBJDIR)/util.cmx  $(OBJDIR)/parsing.cmx  $(OBJDIR)/ids.cmx \$(OBJDIR)/
     $(OBJDIR)/batteriesInit.cmx   $(OBJDIR)/idsparser.cmi
Title: Re: How to compile. Also, update your compiling environment.
Post by: Argent77 on March 15, 2017, 06:29:08 PM
Update: Manually downgrading to sed-4.2.2-3 fixes the issue (for now).

To do this, start Cygwin installer (setup-x86.exe), select "Full" view and make a search for "sed". In the "New" column click on the entry repeatedly until version 4.2.2-3 is selected. Finish the installation.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on March 16, 2017, 01:32:16 PM
Ok, so this is caused by something all of a sudden starting to use CRLF instead of LF. The perl issue is apparently that for whatever reason, my make and whatever make was used those 15 odd years ago when this build system was written do not escape the $(OBJDIR) variable, but Cygwin make does.

Someone kindly check if current devel works without downgrading sed.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Argent77 on March 16, 2017, 02:16:28 PM
Works fine now (with both sed and perl).

On an unrelated note, I made an attempt to port Windows WeiDU to 64-bit. I was able to make Elkhound 64-bit ready, but failed to compile WeiDU itself because of incomplete 64-bit Windows OCaml support. From what I read on various sites it's unlikely that official OCaml64 packages will ever be fixed for Windows, so I guess we have to make do with 32-bit WeiDU for the time being.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on March 16, 2017, 03:19:00 PM
Got any patches for the elkhound stuff? No reason that can't be 64-bit even if the rest of it isn't.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Argent77 on March 16, 2017, 04:46:46 PM
Here you go:
Code: [Select]
diff -Naur elkhound-orig/src/ast/exampletest.cc elkhound/src/ast/exampletest.cc
--- elkhound-orig/src/ast/exampletest.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/ast/exampletest.cc 2017-03-16 21:54:24.000000000 +0100
@@ -29,15 +29,15 @@
   Super *s4 = new Sub2(4, 104);
 
   // **** render it into xml
-  cout << "**************** first" << endl;
+  std::cout << "**************** first" << std::endl;
   nl0->xmlPrint(cout,0);
-  cout << "**************** second" << endl;
+  std::cout << "**************** second" << std::endl;
   al0->xmlPrint(cout,0);
-  cout << "**************** third" << endl;
+  std::cout << "**************** third" << std::endl;
   s3->xmlPrint(cout,0);
-  cout << "**************** fourth" << endl;
+  std::cout << "**************** fourth" << std::endl;
   s4->xmlPrint(cout,0);
-  cout << "**************** done" << endl;
+  std::cout << "**************** done" << std::endl;
 
   return 0;
 }
diff -Naur elkhound-orig/src/ast/gramlex.cc elkhound/src/ast/gramlex.cc
--- elkhound-orig/src/ast/gramlex.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/ast/gramlex.cc 2017-03-16 21:41:24.000000000 +0100
@@ -8,6 +8,10 @@
 
 #include <fstream>       // std::cout, std::ifstream
 
+// might break earlier flex versions
+#ifndef FLEX_STD
+  #define FLEX_STD std::
+#endif // FLEX_STD
 
 // workaround for flex-2.5.31
 #ifdef FLEX_STD    // detect later versions of flex
diff -Naur elkhound-orig/src/elkhound/examples/arith/arith.cc elkhound/src/elkhound/examples/arith/arith.cc
--- elkhound-orig/src/elkhound/examples/arith/arith.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/examples/arith/arith.cc 2017-03-16 21:46:32.000000000 +0100
@@ -59,7 +59,7 @@
 // --------------------- main ----------------------
 ArithLexer lexer;
 
-int main(int argc)
+int main(int argc, char *argv[])
 {
   // initialize lexer by grabbing first token
   lexer.nextToken(&lexer);
diff -Naur elkhound-orig/src/elkhound/examples/cexp/cexp3mrg.cc elkhound/src/elkhound/examples/cexp/cexp3mrg.cc
--- elkhound-orig/src/elkhound/examples/cexp/cexp3mrg.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/examples/cexp/cexp3mrg.cc 2017-03-16 21:59:54.000000000 +0100
@@ -9,14 +9,14 @@
 void Exp::incRefCt()
 {
   refCt++;
-  trace("refct") << "incremented refct of " << this << " to " << refCt << endl;
+  trace("refct") << "incremented refct of " << this << " to " << refCt << std::endl;
 }
 
 void Exp::decRefCt()
 {
   xassert(refCt > 0);
   --refCt;
-  trace("refct") << "decremented refct of " << this << " to " << refCt << endl;
+  trace("refct") << "decremented refct of " << this << " to " << refCt << std::endl;
   if (refCt == 0) {
     delete this;
   }
diff -Naur elkhound-orig/src/elkhound/gramanl.cc elkhound/src/elkhound/gramanl.cc
--- elkhound-orig/src/elkhound/gramanl.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/gramanl.cc 2017-03-16 21:49:14.000000000 +0100
@@ -2231,7 +2231,7 @@
 
 STATICDEF unsigned ItemSet::hash(ItemSet const *key)
 {
-  unsigned crc = key->kernelItemsCRC;
+  uintptr_t crc = key->kernelItemsCRC;
   return HashTable::lcprngHashFn((void*)crc);
 }
 
diff -Naur elkhound-orig/src/elkhound/ssxmain.cc elkhound/src/elkhound/ssxmain.cc
--- elkhound-orig/src/elkhound/ssxmain.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/ssxmain.cc 2017-03-16 21:54:44.000000000 +0100
@@ -118,14 +118,14 @@
   // count # of parses
   PTreeNode *top = (PTreeNode*)treeTop;
   TreeCount numParses = top->countTrees();
-  cout << "num parses: " << numParses << endl;
+  std::cout << "num parses: " << numParses << std::endl;
 
   // print what it should be
   int n = (inputLen - 1) / 2;
-  cout << "input is x^" << inputLen
-       << "; C(" << n
-       << ") = " << C(n)
-       << endl;
+  std::cout << "input is x^" << inputLen
+            << "; C(" << n
+            << ") = " << C(n)
+            << std::endl;
 
   return 0;
 }
diff -Naur elkhound-orig/src/elkhound/triv/AdB.gr.in elkhound/src/elkhound/triv/AdB.gr.in
--- elkhound-orig/src/elkhound/triv/AdB.gr.in 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/triv/AdB.gr.in 2017-03-16 22:18:20.000000000 +0100
@@ -9,7 +9,7 @@
 }
 
 nonterm A {
-  fun merge(p1, p2) [ cout << "merging nonterminal A\n"; return p1; ]
+  fun merge(p1, p2) [ std::cout << "merging nonterminal A\n"; return p1; ]
 
   -> d;
   -> B;
diff -Naur elkhound-orig/src/elkhound/triv/CAdB.gr.in elkhound/src/elkhound/triv/CAdB.gr.in
--- elkhound-orig/src/elkhound/triv/CAdB.gr.in 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/triv/CAdB.gr.in 2017-03-16 22:18:26.000000000 +0100
@@ -20,7 +20,7 @@
 }
 
 nonterm A {
-  fun merge(p1, p2) [ cout << "merging nonterminal A\n"; return p1; ]
+  fun merge(p1, p2) [ std::cout << "merging nonterminal A\n"; return p1; ]
 
   -> d;
   -> B;
diff -Naur elkhound-orig/src/elkhound/triv/DeclExpr.gr.in elkhound/src/elkhound/triv/DeclExpr.gr.in
--- elkhound-orig/src/elkhound/triv/DeclExpr.gr.in 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/triv/DeclExpr.gr.in 2017-03-16 22:18:30.000000000 +0100
@@ -15,7 +15,7 @@
 }
 
 nonterm Stmt {
-  merge(L,R)  [ cout << "merging Stmt\n"; return L; ]
+  merge(L,R)  [ std::cout << "merging Stmt\n"; return L; ]
   dup(v)      [ return v; ]
   del(v)      []
 
diff -Naur elkhound-orig/src/elkhound/triv/EEb.gr.in elkhound/src/elkhound/triv/EEb.gr.in
--- elkhound-orig/src/elkhound/triv/EEb.gr.in 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/triv/EEb.gr.in 2017-03-16 22:18:36.000000000 +0100
@@ -9,7 +9,7 @@
 }
 
 nonterm E {
-  fun merge(L,R) [ cout << "merging E\n"; return ++count; ]
+  fun merge(L,R) [ std::cout << "merging E\n"; return ++count; ]
   fun dup(v)     [ return ++count; ]
   fun del(v)     []
 
diff -Naur elkhound-orig/src/elkhound/trivmain.cc elkhound/src/elkhound/trivmain.cc
--- elkhound-orig/src/elkhound/trivmain.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/trivmain.cc 2017-03-16 22:02:24.000000000 +0100
@@ -156,7 +156,7 @@
   // count # of parses
   if (count) {
     TreeCount numParses = top->countTrees();
-    cout << "num parses: " << numParses << endl;
+    std::cout << "num parses: " << numParses << std::endl;
 
     TreeCount should = 0;    // meaning unknown
     if (0==strcmp(GRAMMAR_NAME, "triv/SSx.tree.bin")) {
@@ -167,17 +167,17 @@
     }
 
     if (should != 0) {
-      cout << "should be: " << should << endl;
+      std::cout << "should be: " << should << std::endl;
       if (should != numParses) {
-        cout << "MISMATCH in number of parse trees\n";
+        std::cout << "MISMATCH in number of parse trees\n";
       }
     }
   }
-  cout << "tree nodes: " << PTreeNode::allocCount
-       << endl;
+  std::cout << "tree nodes: " << PTreeNode::allocCount
+            << std::endl;
 
   if (tracingSys("printTree")) {
-    top->printTree(cout);
+    top->printTree(std::cout);
   }
 }
 
diff -Naur elkhound-orig/src/smbase/bflatten.cc elkhound/src/smbase/bflatten.cc
--- elkhound-orig/src/smbase/bflatten.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/bflatten.cc 2017-03-16 21:34:04.000000000 +0100
@@ -92,7 +92,7 @@
   }
   else /*reading*/ {
     // read the int name
-    int name = readInt();
+    intptr_t name = readInt();
 
     if (name == 0) {      // null
       xassert(nullable);
diff -Naur elkhound-orig/src/smbase/bflatten.h elkhound/src/smbase/bflatten.h
--- elkhound-orig/src/smbase/bflatten.h 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/bflatten.h 2017-03-16 21:34:48.000000000 +0100
@@ -15,7 +15,7 @@
 
   struct OwnerMapping {
     void *ownerPtr;       // a pointer
-    int intName;          // a unique integer name
+    intptr_t intName;     // a unique integer name
   };
   OwnerHashTable<OwnerMapping> ownerTable;      // owner <-> int mapping
   int nextUniqueName;     // counter for making int names
diff -Naur elkhound-orig/src/smbase/bitarray.cc elkhound/src/smbase/bitarray.cc
--- elkhound-orig/src/smbase/bitarray.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/bitarray.cc 2017-03-16 21:55:42.000000000 +0100
@@ -231,9 +231,9 @@
   string s2 = toStringViaIter(b);
   if (s1 != s2 ||
       !s1.equals(str)) {
-    cout << "str: " << str << endl;
-    cout << " s1: " << s1 << endl;
-    cout << " s2: " << s2 << endl;
+    std::cout << "str: " << str << std::endl;
+    std::cout << " s1: " << s1 << std::endl;
+    std::cout << " s2: " << s2 << std::endl;
     xbase("testIter failed");
   }
 
@@ -249,8 +249,8 @@
 
   string cStr = toString(c);
   if (!inv.equals(cStr)) {
-    cout << " inv: " << inv << endl;
-    cout << "cStr: " << cStr << endl;
+    std::cout << " inv: " << inv << std::endl;
+    std::cout << "cStr: " << cStr << std::endl;
     xbase("test inverter failed");
   }
 }
@@ -277,18 +277,18 @@
   string iStr = toString(i);
 
   if (!uStr.equals(expectUnion)) {
-    cout << "         s1: " << s1 << endl;
-    cout << "         s2: " << s2 << endl;
-    cout << "       uStr: " << uStr << endl;
-    cout << "expectUnion: " << expectUnion << endl;
+    std::cout << "         s1: " << s1 << std::endl;
+    std::cout << "         s2: " << s2 << std::endl;
+    std::cout << "       uStr: " << uStr << std::endl;
+    std::cout << "expectUnion: " << expectUnion << std::endl;
     xbase("test union failed");
   }
 
   if (!iStr.equals(expectIntersection)) {
-    cout << "                s1: " << s1 << endl;
-    cout << "                s2: " << s2 << endl;
-    cout << "              iStr: " << iStr << endl;
-    cout << "expectIntersection: " << expectIntersection << endl;
+    std::cout << "                s1: " << s1 << std::endl;
+    std::cout << "                s2: " << s2 << std::endl;
+    std::cout << "              iStr: " << iStr << std::endl;
+    std::cout << "expectIntersection: " << expectIntersection << std::endl;
     xbase("test intersection failed");
   }
 }
@@ -300,9 +300,9 @@
   bool answer = b.anyEvenOddBitPair();
   if (answer != expect) {
     static char const *boolName[] = { "false", "true" };
-    cout << "     s: " << s << endl;
-    cout << "answer: " << boolName[answer] << endl;
-    cout << "expect: " << boolName[expect] << endl;
+    std::cout << "     s: " << s << std::endl;
+    std::cout << "answer: " << boolName[answer] << std::endl;
+    std::cout << "expect: " << boolName[expect] << std::endl;
     xbase("test anyEvenOddBitPair failed");
   }
 }
@@ -365,7 +365,7 @@
   testAnyEvenOddBitPair("11110", true);
   testAnyEvenOddBitPair("01100", false);
 
-  cout << "bitarray is ok\n";
+  std::cout << "bitarray is ok\n";
 }
 
 USUAL_MAIN
diff -Naur elkhound-orig/src/smbase/growbuf.cc elkhound/src/smbase/growbuf.cc
--- elkhound-orig/src/smbase/growbuf.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/growbuf.cc 2017-03-16 21:53:58.000000000 +0100
@@ -43,7 +43,7 @@
       xfailure("buffer contents are wrong");
     }
   }
-  cout << "growbuf ok\n";
+  std::cout << "growbuf ok\n";
 }
 
 USUAL_MAIN
diff -Naur elkhound-orig/src/smbase/srcloc.cc elkhound/src/smbase/srcloc.cc
--- elkhound-orig/src/smbase/srcloc.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/srcloc.cc 2017-03-16 22:00:08.000000000 +0100
@@ -748,7 +748,7 @@
 
     fseek(fp, 0, SEEK_END);
     len = (int)ftell(fp);
-    cout << "length of " << fname << ": " << len << endl;
+    std::cout << "length of " << fname << ": " << len << std::endl;
   }
 
   // get locations for the start and end
@@ -897,23 +897,23 @@
   int ppLine;
   for (ppLine = 1; ppLine < 10; ppLine++) {
     SourceLoc loc = mgr.encodeLineCol("srcloc.tmp", ppLine, 1);
-    cout << "ppLine " << ppLine << ": " << toString(loc) << endl;
+    std::cout << "ppLine " << ppLine << ": " << toString(loc) << std::endl;
   }
 
   // similar for last few lines
   for (ppLine = pp->numLines - 4; ppLine <= pp->numLines; ppLine++) {
     SourceLoc loc = mgr.encodeLineCol("srcloc.tmp", ppLine, 1);
-    cout << "ppLine " << ppLine << ": " << toString(loc) << endl;
+    std::cout << "ppLine " << ppLine << ": " << toString(loc) << std::endl;
   }
 
   // see how the expander line behaves
   if (!expanderLine) {
-    cout << "didn't find expander line!\n";
+    std::cout << "didn't find expander line!\n";
     exit(2);
   }
   else {
     SourceLoc loc = mgr.encodeLineCol("srcloc.tmp", expanderLine, 1);
-    cout << "expander column 1: " << toString(loc) << endl;
+    std::cout << "expander column 1: " << toString(loc) << std::endl;
 
     // in the pp file, I can advance the expander horizontally a long ways;
     // this should truncate to column 9
@@ -922,16 +922,16 @@
     char const *fname;
     int offset;
     mgr.decodeOffset(loc, fname, offset);
-    cout << "expander column 21: " << fname << ", offset " << offset << endl;
+    std::cout << "expander column 21: " << fname << ", offset " << offset << std::endl;
     xassert(0==strcmp(fname, "srcloc.test.cc"));
 
     // map that to line/col, which should show the truncation
     int line, col;
     orig->charToLineCol(offset, line, col);
-    cout << "expander column 21: " << locString(fname, line, col) << endl;
+    std::cout << "expander column 21: " << locString(fname, line, col) << std::endl;
     if (col != 9 && col != 10) {
       // 9 is for LF line endings, 10 for CRLF
-      cout << "expected column 9 or 10!\n";
+      std::cout << "expected column 9 or 10!\n";
       exit(2);
     }
   }
@@ -947,7 +947,7 @@
 
   for (int ppLine = 1; ppLine <= pp->numLines; ppLine++) {
     SourceLoc loc = mgr.encodeLineCol("srcloc.test2.cc", ppLine, 1);
-    cout << "ppLine " << ppLine << ": " << toString(loc) << endl;
+    std::cout << "ppLine " << ppLine << ": " << toString(loc) << std::endl;
   }
 }
 
@@ -956,7 +956,7 @@
 {
   xBase::logExceptions = false;
   traceAddSys("progress");
-  traceProgress() << "begin" << endl;
+  traceProgress() << "begin" << std::endl;
 
   if (argc >= 2) {
     // set maxStaticLocs low to test the warning
@@ -974,22 +974,22 @@
     testFile("srcloc.h");
   }
 
-  traceProgress() << "end" << endl;
+  traceProgress() << "end" << std::endl;
 
   // protect against degeneracy by printing the length of
   // the longest line
-  cout << "\n";
-  cout << "long line len: " << longestLen << endl;
+  std::cout << "\n";
+  std::cout << "long line len: " << longestLen << std::endl;
 
   // test the statics
-  cout << "invalid: " << toString(SL_UNKNOWN) << endl;
-  cout << "here: " << toString(HERE_SOURCELOC) << endl;
+  std::cout << "invalid: " << toString(SL_UNKNOWN) << std::endl;
+  std::cout << "here: " << toString(HERE_SOURCELOC) << std::endl;
 
-  cout << "\n";
+  std::cout << std::endl;
   testHashMap();
   testHashMap2();
 
-  cout << "srcloc is ok\n";
+  std::cout << "srcloc is ok\n";
 }
 
 ARGS_MAIN
diff -Naur elkhound-orig/src/smbase/srcloc.test.cc elkhound/src/smbase/srcloc.test.cc
--- elkhound-orig/src/smbase/srcloc.test.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/srcloc.test.cc 2017-03-16 22:00:22.000000000 +0100
@@ -757,7 +757,7 @@
 
     fseek(fp, 0, SEEK_END);
     len = (int)ftell(fp);
-    cout << "length of " << fname << ": " << len << endl;
+    std::cout << "length of " << fname << ": " << len << std::endl;
   }
 
   // get locations for the start and end
@@ -906,23 +906,23 @@
   int ppLine;
   for (ppLine = 1; ppLine < 10; ppLine++) {
     SourceLoc loc = mgr.encodeLineCol("srcloc.tmp", ppLine, 1);
-    cout << "ppLine " << ppLine << ": " << toString(loc) << endl;
+    std::cout << "ppLine " << ppLine << ": " << toString(loc) << std::endl;
   }
 
   // similar for last few lines
   for (ppLine = pp->numLines - 4; ppLine <= pp->numLines; ppLine++) {
     SourceLoc loc = mgr.encodeLineCol("srcloc.tmp", ppLine, 1);
-    cout << "ppLine " << ppLine << ": " << toString(loc) << endl;
+    std::cout << "ppLine " << ppLine << ": " << toString(loc) << std::endl;
   }
 
   // see how the expander line behaves
   if (!expanderLine) {
-    cout << "didn't find expander line!\n";
+    std::cout << "didn't find expander line!\n";
     exit(2);
   }
   else {
     SourceLoc loc = mgr.encodeLineCol("srcloc.tmp", expanderLine, 1);
-    cout << "expander column 1: " << toString(loc) << endl;
+    std::cout << "expander column 1: " << toString(loc) << std::endl;
 
     // in the pp file, I can advance the expander horizontally a long ways;
     // this should truncate to column 9
@@ -931,16 +931,16 @@
     char const *fname;
     int offset;
     mgr.decodeOffset(loc, fname, offset);
-    cout << "expander column 21: " << fname << ", offset " << offset << endl;
+    std::cout << "expander column 21: " << fname << ", offset " << offset << std::endl;
     xassert(0==strcmp(fname, "srcloc.cc"));
 
     // map that to line/col, which should show the truncation
     int line, col;
     orig->charToLineCol(offset, line, col);
-    cout << "expander column 21: " << locString(fname, line, col) << endl;
+    std::cout << "expander column 21: " << locString(fname, line, col) << std::endl;
     if (col != 9 && col != 10) {
       // 9 is for LF line endings, 10 for CRLF
-      cout << "expected column 9 or 10!\n";
+      std::cout << "expected column 9 or 10!\n";
       exit(2);
     }
   }
@@ -950,7 +950,7 @@
 void entry(int argc, char ** /*argv*/)
 {
   traceAddSys("progress");
-  traceProgress() << "begin" << endl;
+  traceProgress() << "begin" << std::endl;
 
   if (argc >= 2) {
     // set maxStaticLocs low to test the warning
@@ -968,21 +968,21 @@
     testFile("srcloc.h");
   }
 
-  traceProgress() << "end" << endl;
+  traceProgress() << "end" << std::endl;
 
   // protect against degeneracy by printing the length of
   // the longest line
-  cout << "\n";
-  cout << "long line len: " << longestLen << endl;
+  std::cout << std::endl;
+  std::cout << "long line len: " << longestLen << std::endl;
 
   // test the statics
-  cout << "invalid: " << toString(SL_UNKNOWN) << endl;
-  cout << "here: " << toString(HERE_SOURCELOC) << endl;
+  std::cout << "invalid: " << toString(SL_UNKNOWN) << std::endl;
+  std::cout << "here: " << toString(HERE_SOURCELOC) << std::endl;
 
-  cout << "\n";
+  std::cout << std::endl;
   testHashMap();
 
-  cout << "srcloc is ok\n";
+  std::cout << "srcloc is ok\n";
 }
 
 ARGS_MAIN
diff -Naur elkhound-orig/src/smbase/str.cpp elkhound/src/smbase/str.cpp
--- elkhound-orig/src/smbase/str.cpp 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/str.cpp 2017-03-16 22:00:34.000000000 +0100
@@ -468,9 +468,9 @@
 
 void test(unsigned long val)
 {
-  //std::cout << stringb(val << " in hex: 0x" << stringBuilder::Hex(val)) << endl;
+  //std::cout << stringb(val << " in hex: 0x" << stringBuilder::Hex(val)) << std::endl;
 
-  std::cout << stringb(val << " in hex: " << SBHex(val)) << endl;
+  std::cout << stringb(val << " in hex: " << SBHex(val)) << std::endl;
 }
 
 int main()
@@ -483,7 +483,7 @@
   test(1);
 
   std::cout << "stringf: " << stringf("int=%d hex=%X str=%s char=%c float=%f",
-                                 5, 0xAA, "hi", 'f', 3.4) << endl;
+                                 5, 0xAA, "hi", 'f', 3.4) << std::endl;
 
   std::cout << "tests passed\n";
 
diff -Naur elkhound-orig/src/smbase/strhash.cc elkhound/src/smbase/strhash.cc
--- elkhound-orig/src/smbase/strhash.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/strhash.cc 2017-03-16 22:01:28.000000000 +0100
@@ -333,7 +333,7 @@
   dataArray = new StringArray(0);
   char *delim = " \t\n\r\v\f";
   std::filebuf fb;
-  fb.open (inFileName, ios::in);
+  fb.open (inFileName, std::ios::in);
   std::istream in(&fb);
   while(true) {
     stringBuilder s;
@@ -492,7 +492,7 @@
       }
     } else if (strcmp(*argv, "--file")==0) {
       if (numRandStrs) {
-        std::cout << "do not use --random and --file together" << endl;
+        std::cout << "do not use --random and --file together" << std::endl;
         usage();
         exit(1);
       }
diff -Naur elkhound-orig/src/smbase/svdict.cc elkhound/src/smbase/svdict.cc
--- elkhound-orig/src/smbase/svdict.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/svdict.cc 2017-03-16 21:58:54.000000000 +0100
@@ -496,7 +496,7 @@
             dict2.remove(key.c_str());
           }
           else {
-            dict2.modify(key.c_str(), (void*)((int)value + 24));
+            dict2.modify(key.c_str(), (void*)((intptr_t)value + 24));
           }
           xassert(dict2 != dict);
         }
diff -Naur elkhound-orig/src/smbase/typ.h elkhound/src/smbase/typ.h
--- elkhound-orig/src/smbase/typ.h 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/typ.h 2017-03-16 21:32:06.000000000 +0100
@@ -5,6 +5,8 @@
 #ifndef __TYP_H
 #define __TYP_H
 
+#include <stdint.h>
+
 // byte
 typedef unsigned char byte;
 typedef signed char signed_byte;
@@ -30,8 +32,8 @@
 
 // This used when I want to cast a pointer to an integer for something
 // like hashing the address.  It need not be injective.
-inline long pointerToInteger(void const *p)
-  { return (long)p; }
+inline intptr_t pointerToInteger(void const *p)
+  { return (intptr_t)p; }
 
 
 // This can be used to compare two pointers, even when they do not point
@@ -45,7 +47,7 @@
   // existence of this function at least ensures I only have to change
   // one place.
   return p==q?               0 :
-         (long)p < (long)q? -1 :      // would use std::less<> here
+         (intptr_t)p < (intptr_t)q? -1 :      // would use std::less<> here
                             +1 ;
 }
 
diff -Naur elkhound-orig/src/smbase/voidlist.cc elkhound/src/smbase/voidlist.cc
--- elkhound-orig/src/smbase/voidlist.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/voidlist.cc 2017-03-16 21:52:18.000000000 +0100
@@ -749,10 +749,10 @@
 // whereas isSorted would forget that info)
 void verifySorted(VoidList const &list)
 {
-  int prev = 0;
+  intptr_t prev = 0;
   VoidListIter iter(list);
   for (; !iter.isDone(); iter.adv()) {
-    int current = (int)iter.data();
+    intptr_t current = (intptr_t)iter.data();
     xassert(prev <= current);    // numeric address test
     prev = current;
   }
I've tested it on Cygwin (32bit and 64bit) and Debian 7.6 (32bit).

However, "make check" failed with the following error on Cygwin (both 32bit and 64bit):
Code: [Select]
------------ [12] triv/ESb.gr.exe triv/ESb.in1 ------------
reduced by E -> empty
reduced by E -> empty
reduced by S -> a
reduced by S -> a
WARNING: there is no action to deallocate nonterm S
reduced by S -> E S b
reduced by S -> E S b
WARNING: there is no action to deallocate nonterm S
reduced by S -> E S b
reduced by S -> E S b
WARNING: there is no action to deallocate nonterm S
reduced by S -> E S b
reduced by S -> E S b
WARNING: there is no action to deallocate nonterm S
Exception thrown: Assertion failed: referenceCount > 0, file glr.cc line 455
Assertion failed: referenceCount > 0, file glr.cc line 455

[12] A regression test command failed:
  triv/ESb.gr.exe triv/ESb.in1
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on March 17, 2017, 03:29:17 PM
Hah, the check target fails with a compiler error for me (it does this without the patch as well, but with a different error). Well, it might be a while before I can add this to master. I'm not that knowledgeable about elkhound, so I can't say how serious the test failure is. And before I can investigate I have to clean up the code base sufficiently, which is not a high priority at this time. Edit: Additionally, diffing the generated parsers reveals a few differences I can't evaluate (largely because they are numbers with no context).

Thanks for the patch. I've committed it to a branch.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Argent77 on April 14, 2017, 10:07:20 AM
I'm getting a compiler error when I try to compile WeiDU 240.01 on Mac OSX:
Code: [Select]
Compiling obj/x86_LINUX/idslexer.ml to native code
File "src/idslexer.mll", line 3, characters 0-14:
Error: Unbound module Idsparser
make: *** [obj/x86_LINUX/idslexer.cmx] Error 1

I could track it back to the commit "Fix post-processing of dependency files (https://github.com/WeiDUorg/weidu/commit/a22c4cd5d6c1163c6cc7ac882cae49c0039751f8)" which is the first one triggering this error.

Any idea how to fix it?
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on April 14, 2017, 12:10:47 PM
What's the contents of obj/.depend/idslexer.d? Does perl work better than sed?
Title: Re: How to compile. Also, update your compiling environment.
Post by: Argent77 on April 14, 2017, 02:03:45 PM
What's the contents of obj/.depend/idslexer.d? Does perl work better than sed?

The content of obj/.depend/idslexer.d:
Code: [Select]
  obj/x86_LINUX/idslexerobj/x86_LINUX/.cmo:  obj/x86_LINUX/util.cmx   obj/x86_LINUX/idsparobj/x86_LINUX/serobj/x86_LINUX/.cmi
  obj/x86_LINUX/idslexerobj/x86_LINUX/.cmx:  obj/x86_LINUX/util.cmx   obj/x86_LINUX/idsparobj/x86_LINUX/serobj/x86_LINUX/.cmx

Switching from sed to perl seems to fix the issue on Mac OS X.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on April 14, 2017, 02:37:30 PM
Can you comment the sed line, uncomment the cat line and post the contents of the file again?
And again with sed but with this patch applied?
Code: [Select]
diff --git a/Makefile.ocaml b/Makefile.ocaml
index 9843389..11e9e51 100755
--- a/Makefile.ocaml
+++ b/Makefile.ocaml
@@ -325,7 +325,7 @@ cleancaml:
 # If you have perl but not sed you can use this line instead. Don't you
 # wish we were using autoconf?
 #FIXDEPEND:=perl -e 'while(<>) { s%[^/\\ :]+[/\\]% %g; s%([^ :\\\n\r]+)%$(OBJDIR)/$$1%g; print $$_;}'
-FIXDEPEND:=sed -e '{ s%[^/\\ :][^/\\ :]*[/\\]% %g; s%\([^ :\\\n\r][^ :\\\n\r]*\)%$(OBJDIR)/\1%g; }'
+FIXDEPEND:=sed -e '{ s%[^/\\ :][^/\\ :]*[/\\]% %g }'
 
 # FIXDEPEND:=cat
 DEPINCLUDES= -I $(OBJDIR) $(SOURCEDIRS:%=-I %)
Title: Re: How to compile. Also, update your compiling environment.
Post by: Argent77 on April 14, 2017, 03:02:02 PM
Content of obj/.depend/idslexer.d after enabling cat:
Code: [Select]
obj/x86_LINUX/idslexer.cmo: src/util.cmx obj/x86_LINUX/idsparser.cmi
obj/x86_LINUX/idslexer.cmx: src/util.cmx obj/x86_LINUX/idsparser.cmx

Compiler messages after applying patch (contains lots of sed-related messages):
Code: [Select]
Generating dependency information for src/tph.ml
sed: 1: "{ s%[^/\\ :][^/\\ :]*[/ ...": bad flag in substitute command: '}'
Generating dependency information for src/parsing.ml
sed: 1: "{ s%[^/\\ :][^/\\ :]*[/ ...": bad flag in substitute command: '}'
Generating dependency information for src/version.ml
sed: 1: "{ s%[^/\\ :][^/\\ :]*[/ ...": bad flag in substitute command: '}'
cp src/arch_osx.ml src/arch.ml
Generating dependency information for src/arch.ml
sed: 1: "{ s%[^/\\ :][^/\\ :]*[/ ...": bad flag in substitute command: '}'
Generating dependency information for src/stats.ml
sed: 1: "{ s%[^/\\ :][^/\\ :]*[/ ...": bad flag in substitute command: '}'
cp src/case_ins_mac.ml src/case_ins.ml
Generating dependency information for src/case_ins.ml
sed: 1: "{ s%[^/\\ :][^/\\ :]*[/ ...": bad flag in substitute command: '}'
Generating dependency information for batteries-lite/batteriesInit.ml
sed: 1: "{ s%[^/\\ :][^/\\ :]*[/ ...": bad flag in substitute command: '}'
Generating dependency information for batteries-lite/batList.ml
sed: 1: "{ s%[^/\\ :][^/\\ :]*[/ ...": bad flag in substitute command: '}'
Compiling batteries-lite/batList.ml to native code
File "batteries-lite/batList.ml", line 1, characters 0-1:
Error: Could not find the .cmi file for interface batteries-lite/batList.mli.
cp: batteries-lite/batList.cmi: No such file or directory
cp: batteries-lite/batList.o: No such file or directory
make: *** [obj/x86_LINUX/batList.cmx] Error 1

obj/.depend/idslexer.d (as well as all other .d files in this folder) are empty.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on April 14, 2017, 03:18:36 PM
Try this
Code: [Select]
+FIXDEPEND:=sed -e '{ s%[^/\\ :][^/\\ :]*[/\\]% %g; }'

OSX-sed is apparently more picky about syntax than GNU-sed.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Argent77 on April 14, 2017, 03:25:43 PM
Still no luck. Content of obj/.depend/idslexer.d:
Code: [Select]
  idslexer.cmo:  util.cmx   idsparser.cmi
  idslexer.cmx:  util.cmx   idsparser.cmx
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on April 14, 2017, 03:54:02 PM
That it does not compile is expected. This was to isolate the problem (which inexplicably lies with the second substitution). What version of OS X and sed is this?
Title: Re: How to compile. Also, update your compiling environment.
Post by: Argent77 on April 14, 2017, 04:14:28 PM
I'm using Mac OS X 10.7.4 (Lion) in a VM.

It's apparently not possible (http://stackoverflow.com/questions/37639496/how-can-i-check-the-version-of-sed-in-os-x) to get the version number for sed on Mac OS X. However, I could extract several dates from embedded source files. The most recent one dates back to 2005/05/10.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on April 14, 2017, 05:24:12 PM
Can you try this? To see if it's matching against the \r that was added in the commit.
Code: [Select]
+FIXDEPEND:=sed -e '{ s%[^/\\ :][^/\\ :]*[/\\]% %g; s%\([^ :\\\n][^ :\\\n]*\)%$(OBJDIR)/\1%g; }'
Title: Re: How to compile. Also, update your compiling environment.
Post by: Argent77 on April 14, 2017, 05:45:36 PM
That's much better. I was able to successfully compile weidu on Mac OS X. Content of obj/.depend/idslexer.d:
Code: [Select]
  obj/x86_LINUX/idslexer.cmo:  obj/x86_LINUX/util.cmx   obj/x86_LINUX/idsparser.cmi
  obj/x86_LINUX/idslexer.cmx:  obj/x86_LINUX/util.cmx   obj/x86_LINUX/idsparser.cmx

But there is one downside. On Windows it terminates with the following error:
Code: [Select]
Generating dependency information for src/case_ins.ml
obj/.depend/idsparser.d:2: *** missing separator.  Stop.

Content of obj/.depend/idsparser.d:
Code: [Select]
  obj/x86_WIN32/idsparser.cmo :  obj/x86_WIN32/util.cmx  obj/x86_WIN32/parsing.cmx  obj/x86_WIN32/ids.cmx \obj/x86_WIN32/
     obj/x86_WIN32/batteriesInit.cmx   obj/x86_WIN32/idsparser.cmi
  obj/x86_WIN32/idsparser.cmx :  obj/x86_WIN32/util.cmx  obj/x86_WIN32/parsing.cmx  obj/x86_WIN32/ids.cmx \obj/x86_WIN32/
     obj/x86_WIN32/batteriesInit.cmx   obj/x86_WIN32/idsparser.cmi
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on April 15, 2017, 05:19:27 AM
Yeah, it's not going to work on Windows, since the change was made to get it working (again) on Windows.

The issue seems to be that OS X (BSD) sed does not recognise \r as a control character unless the regexp format is enhanced basic (which is not default). This supposedly also affects \n, but \n does not seem to have this problem, regardless.
In short, eff this. Building WeiDU on OS X now requires Perl.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Argent77 on April 15, 2017, 07:13:06 AM
The following workaround should also work on all available platforms:
Code: [Select]
+FIXDEPEND:=tr -d '\r' | sed -e '{ s%[^/\\ :][^/\\ :]*[/\\]% %g; s%\([^ :\\\n][^ :\\\n]*\)%$(OBJDIR)/\1%g; }'
Title: Re: How to compile. Also, update your compiling environment.
Post by: Argent77 on May 08, 2017, 05:05:39 AM
@Wisp: I found a workaround for retaining the old behavior of setup-*.exe triggering UAC on more recent Cygwin installations. In the Cygwin package selection uninstall all "windows-default-manifest" packages. (Make sure to uncheck "Select required packages" in the following step!)

Source: https://github.com/Alexpux/MSYS2-packages/issues/454#issuecomment-186498740

This can only be a short-term solution though, since I don't know whether it may cause unwanted side effects in future Windows versions. It would probably be better to include a custom manifest in the weidu binary that defines this kind of behavior.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on May 08, 2017, 03:26:11 PM
Good to know. Thanks. The need to have WeiDU running with elevated privileges should disappear together with the interactive mode of, well, interaction.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Argent77 on November 17, 2017, 02:11:08 PM
I'm not really happy how elevated privileges are currently handled by the Windows binary of WeiDU, since it requires that ugly Cygwin hack mentioned in my previous post.

There is a more elegant method by implementing the required code into WeiDU itself. Example code can be found here: https://code.msdn.microsoft.com/CppUACSelfElevation-5bfc52dd

Would it be feasible to add this functionality to WeiDU?
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on November 18, 2017, 07:09:27 AM
If the default manifest exists, the MinGW toolchain will link it. From what I can find on mailing lists and such, renaming or removing the file is the closest thing there is to a supported way of not having it linked.

Bolting GUI code onto a terminal app probably would not fly. As I see it, the correct way of handling this would be to include a correct manifest into the binary. But since WeiDU should not run elevated, but needs to in order to update other binaries, that themselves need elevation to run, that is not possible until the auto-update behaviour has been axed.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Argent77 on November 18, 2017, 09:53:31 AM
The code seems to work fine in console apps as well. I've made a small console test app to demonstrate: Sources (https://us.v-cdn.net/5019558/uploads/editor/4n/lhxc7d7c5lma.zip)

Not sure if it would play nice with WeiDU's auto-update mechanism though.
Title: Re: How to compile. Also, update your compiling environment.
Post by: aqrit on November 18, 2017, 12:09:05 PM
Quote
the correct way of handling this would be to include a correct manifest into the binary
This.
Do it as a post-build step if nothing else.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on November 23, 2017, 03:21:00 PM
The code seems to work fine in console apps as well. I've made a small console test app to demonstrate: Sources (https://us.v-cdn.net/5019558/uploads/editor/4n/lhxc7d7c5lma.zip)

Not sure if it would play nice with WeiDU's auto-update mechanism though.
This would seem to require making the explicit choice to drop compatibility with Win XP. Considering the demographics, I would be unsurprised to learn there were hold-outs still. I'm also very reluctant to add something to WeiDU to ask for elevated rights since I don't want WeiDU to run with elevated rights. Considering the stuff that goes into WeiDU's security sausage (you don't want to know) and the frequent false positives by AV (which are themselves pretty garbage, but they increase uncertainty; I mean, your AV says it's a virus and you need to run it with admin rights), running WeiDU elevated would be a bad idea, even if the idea of needlessly running stuff elevated does not put you off. I don't see a downside to continuing to rely on Windows automatic prompt-for-elevation functionality until an asInvoker manifest can be added.
Title: Re: How to compile. Also, update your compiling environment.
Post by: enderandrew on January 11, 2018, 02:45:56 PM
Works fine now (with both sed and perl).

On an unrelated note, I made an attempt to port Windows WeiDU to 64-bit. I was able to make Elkhound 64-bit ready, but failed to compile WeiDU itself because of incomplete 64-bit Windows OCaml support. From what I read on various sites it's unlikely that official OCaml64 packages will ever be fixed for Windows, so I guess we have to make do with 32-bit WeiDU for the time being.
It looks like there are updated OCaml 64-bit packages for Windows now if someone wants to give this another go.

https://fdopen.github.io/opam-repository-mingw/installation/
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on February 07, 2018, 12:08:29 PM
PSA: WeiDU won't presently build on OCaml >= 4.06 because breaking changes and after I've updated the code, WeiDU won't build on OCaml <4.02 4.03, because of another issue.
Title: Re: How to compile. Also, update your compiling environment.
Post by: AstroBryGuy on March 12, 2018, 03:29:55 PM
Any idea when the update will be done? I had set up my machine for building WeiDU on macOS, but Homebrew only has OCaml 4.0.6.1 available. :(

Title: Re: How to compile. Also, update your compiling environment.
Post by: Argent77 on March 12, 2018, 06:10:47 PM
You could compile an older OCaml version yourself (List of OCaml releases (https://ocaml.org/releases/)). Homebrew should provide everything necessary for the build process.

I have done that just recently and compiled OCaml 4.05 for my OSX 10.11 VM. I would suggest to install it somewhere separately to avoid interference with the Homebrew OCaml version (and update PATH accordingly).

For WeiDU you have to redirect the OCAMLDIR variable to the new OCaml path in the Configuration file. In my case I also had to enforce byte code compilation or the resulting binary wouldn't run on my older (32-bit) OSX VM.
Code: [Select]
PROFILE=0 NATIVECAML=0 make weidu
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on March 13, 2018, 02:49:12 PM
Any idea when the update will be done?
Not as such. I was going to try to estimate how much work it was, but instead I ended up setting up a new build environment for Windows, since my live one is 4.01. If it's causing problems, I'll give it a priority bump.
Title: Re: How to compile. Also, update your compiling environment.
Post by: AstroBryGuy on March 13, 2018, 07:29:03 PM
@Wisp - I'll try building an older version of OCaml. Not a problem.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on January 20, 2019, 06:59:28 AM
The required minimum version of OCaml is now 4.03. The issue preventing WeiDU from building on 4.06 or later was fixed some time ago.
Title: Re: How to compile. Also, update your compiling environment.
Post by: AL|EN on February 20, 2019, 03:58:19 AM
http://www.weidu.org/~thebigg/elkhound.zip dosen't contain Elkhound64 for windows. Where I can find it?
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on February 20, 2019, 11:42:30 AM
https://github.com/WeiDUorg/elkhound/releases
I'll be moving the binary distribution to github.
Title: Re: How to compile. Also, update your compiling environment.
Post by: AL|EN on February 20, 2019, 01:37:33 PM
Very good idea, something which I would proposed myself but since I was sure that you are aware about the benefits, I assumed that you are simply too busy to handle such change.

BTW: My previous build env stooped working, now no matter what I do, I can't compile weidu for windows. Instructions have dependency on too many moving parts, is unclear how to install OCaml for windows etc. Could you just simply zip whole cygwin + ocaml folders and post it as archives, so anyone can simply download, extract, change paths inside configuration and run make?
Title: Re: How to compile. Also, update your compiling environment.
Post by: AL|EN on February 22, 2019, 06:48:37 AM
Well, linux build also failing with syntax errors. Tested with xubuntu 18.04, OCaml 4.03.1 and 4.07.1 master/devel.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on February 23, 2019, 04:39:15 AM
You need to be more specific about what problems you are having. What error messages you are getting, at which point they appear, and so on.
Title: Re: How to compile. Also, update your compiling environment.
Post by: AL|EN on February 26, 2019, 03:43:23 AM
Let's start with linux, Ubuntu 18.04.2 LTS 64-bit, clean installation, devel branch:


OPam:
Code: [Select]
a@ubuntu:~/weidu$ opam switch
#  switch                      compiler                    description
→  default                     ocaml-base-compiler.4.07.1  default
   ocaml-base-compiler.4.03.0  ocaml-base-compiler.4.03.0  ocaml-base-compiler.4.03.0
   ocaml-base-compiler.4.04.0  ocaml-base-compiler.4.04.0  ocaml-base-compiler.4.04.0

doesn't matter which OCaml version I use, every time I get this error:

Code: [Select]
a@ubuntu:~/weidu$ make
/home/a/.opam/ocaml-base-compiler.4.03.0/bin/ocamlyacc  src/toldparser.mly
17 shift/reduce conflicts.
Generating dependency information for obj/x86_LINUX/toldparser.mli
ocaml str.cma unix.cma -w p scripts/make_gr.ml
ocaml src/trealparserin.gr
File "./src/trealparserin.gr", line 1, characters 0-2:
Error: Syntax error
Makefile.ocaml:243: recipe for target 'obj/x86_LINUX/trealparserin.mli' failed
make: [obj/x86_LINUX/trealparserin.mli] Error 2 (ignored)
mv: cannot stat 'src/trealparserin.ml': No such file or directory
mv: cannot stat 'src/trealparserin.mli': No such file or directory
/home/a/.opam/ocaml-base-compiler.4.03.0/bin/ocamlyacc  src/dparser.mly
1 reduce/reduce conflict.
Generating dependency information for obj/x86_LINUX/dparser.mli
/home/a/.opam/ocaml-base-compiler.4.03.0/bin/ocamlyacc  src/bafparser.mly
Generating dependency information for obj/x86_LINUX/bafparser.mli
/home/a/.opam/ocaml-base-compiler.4.03.0/bin/ocamlyacc  src/refactordparser.mly
Generating dependency information for obj/x86_LINUX/refactordparser.mli
/home/a/.opam/ocaml-base-compiler.4.03.0/bin/ocamlyacc  src/refactorbafparser.mly
Generating dependency information for obj/x86_LINUX/refactorbafparser.mli
/home/a/.opam/ocaml-base-compiler.4.03.0/bin/ocamlyacc  src/bcsparser.mly
1 shift/reduce conflict.
Generating dependency information for obj/x86_LINUX/bcsparser.mli
/home/a/.opam/ocaml-base-compiler.4.03.0/bin/ocamlyacc  src/idsparser.mly
3 shift/reduce conflicts.
Generating dependency information for obj/x86_LINUX/idsparser.mli
Generating dependency information for hashtbl-4.03.0/myhashtbl.mli
Generating dependency information for batteries-lite/batList.mli
Generating dependency information for src/tolower.ml
Generating dependency information for src/weinstall.ml
Generating dependency information for src/myarg.ml
Generating dependency information for src/main.ml
Generating dependency information for src/autoupdate.ml
Generating dependency information for src/changelog.ml
Generating dependency information for src/tpwork.ml
Generating dependency information for src/tpaction.ml
Generating dependency information for src/tppatch.ml
Generating dependency information for src/tpuninstall.ml
Generating dependency information for src/tppe.ml
Generating dependency information for src/mymarshal.ml
Generating dependency information for src/parsewrappers.ml
cp src/tparser.in src/tparser.ml
Generating dependency information for src/tparser.ml
ocaml str.cma unix.cma -w p scripts/make_old_mll.ml
/home/a/.opam/ocaml-base-compiler.4.03.0/bin/ocamllex src/toldlexer.mll
111 states, 589 transitions, table size 3022 bytes
1717 additional bytes used for bindings
Generating dependency information for obj/x86_LINUX/toldlexer.ml
Generating dependency information for obj/x86_LINUX/toldparser.ml
ocaml str.cma unix.cma -w p scripts/make_tll.ml
/home/a/.opam/ocaml-base-compiler.4.03.0/bin/ocamllex src/tlexer.mll
114 states, 594 transitions, table size 3060 bytes
1735 additional bytes used for bindings
Generating dependency information for obj/x86_LINUX/tlexer.ml
Generating dependency information for src/tphelp.ml
Generating dependency information for src/tpstate.ml
Generating dependency information for src/kit.ml
Generating dependency information for src/automate.ml
Generating dependency information for elkhound/lrparse.ml
Generating dependency information for elkhound/glr.ml
Generating dependency information for elkhound/objpool.ml
Generating dependency information for elkhound/arraystack.ml
Generating dependency information for elkhound/parsetables.ml
Generating dependency information for elkhound/lexerint.ml
Generating dependency information for elkhound/useract.ml
Generating dependency information for elkhound/smutil.ml
Generating dependency information for src/json.ml
Generating dependency information for src/sql.ml
Generating dependency information for obj/x86_LINUX/dparser.ml
/home/a/.opam/ocaml-base-compiler.4.03.0/bin/ocamllex src/dlexer.mll
60 states, 536 transitions, table size 2504 bytes
Generating dependency information for obj/x86_LINUX/dlexer.ml
Generating dependency information for src/tp.ml
Generating dependency information for src/mos.ml
Generating dependency information for src/sav.ml
Generating dependency information for src/diff.ml
Generating dependency information for src/myxdiff.ml
Generating dependency information for obj/x86_LINUX/bafparser.ml
/home/a/.opam/ocaml-base-compiler.4.03.0/bin/ocamllex src/baflexer.mll
76 states, 748 transitions, table size 3448 bytes
Generating dependency information for obj/x86_LINUX/baflexer.ml
Generating dependency information for obj/x86_LINUX/refactordparser.ml
/home/a/.opam/ocaml-base-compiler.4.03.0/bin/ocamllex src/refactordlexer.mll
39 states, 311 transitions, table size 1478 bytes
Generating dependency information for obj/x86_LINUX/refactordlexer.ml
Generating dependency information for obj/x86_LINUX/refactorbafparser.ml
/home/a/.opam/ocaml-base-compiler.4.03.0/bin/ocamllex src/refactorbaflexer.mll
14 states, 371 transitions, table size 1568 bytes
Generating dependency information for obj/x86_LINUX/refactorbaflexer.ml
Generating dependency information for src/refactorbaf.ml
Generating dependency information for src/dc.ml
Generating dependency information for src/dlg.ml
Generating dependency information for obj/x86_LINUX/bcsparser.ml
/home/a/.opam/ocaml-base-compiler.4.03.0/bin/ocamllex src/bcslexer.mll
51 states, 369 transitions, table size 1782 bytes
Generating dependency information for obj/x86_LINUX/bcslexer.ml
Generating dependency information for src/bcs.ml
Generating dependency information for obj/x86_LINUX/idsparser.ml
/home/a/.opam/ocaml-base-compiler.4.03.0/bin/ocamllex src/idslexer2.mll
32 states, 699 transitions, table size 2988 bytes
Generating dependency information for obj/x86_LINUX/idslexer2.ml
/home/a/.opam/ocaml-base-compiler.4.03.0/bin/ocamllex src/idslexer.mll
33 states, 574 transitions, table size 2494 bytes
Generating dependency information for obj/x86_LINUX/idslexer.ml
Generating dependency information for src/ids.ml
Generating dependency information for src/cre.ml
Generating dependency information for src/load.ml
Generating dependency information for src/tlk.ml
Generating dependency information for src/biff.ml
Generating dependency information for src/cbif.ml
Generating dependency information for src/key.ml
Generating dependency information for src/xor.ml
echo "let associate_these a = Var.set_string \"WEIDU_ARCH\" \"amd64\" ; Var.set_string \"WEIDU_OS\" \"unix\"; Var.set_string \"WEIDU_VER\" !Util.weidu_version" > src/arch2.ml
echo "let _ = associate_these ()" >> src/arch2.ml
Generating dependency information for src/arch2.ml
Generating dependency information for src/var.ml
Generating dependency information for src/modder.ml
Generating dependency information for src/util.ml
ocaml str.cma unix.cma -w p -unsafe-string scripts/make_tph.ml
Generating dependency information for src/tph.ml
Generating dependency information for src/parsing.ml
Generating dependency information for src/version.ml
cp src/arch_unix.ml src/arch.ml
Generating dependency information for src/arch.ml
Generating dependency information for src/stats.ml
cp src/case_ins_linux.ml src/case_ins.ml
Generating dependency information for src/case_ins.ml
Generating dependency information for hashtbl-4.03.0/hashtblinit.ml
Generating dependency information for hashtbl-4.03.0/myhashtbl.ml
Generating dependency information for batteries-lite/batteriesInit.ml
Generating dependency information for batteries-lite/batList.ml
ocaml src/trealparserin.gr
File "./src/trealparserin.gr", line 1, characters 0-2:
Error: Syntax error
Makefile.ocaml:243: recipe for target 'obj/x86_LINUX/trealparserin.mli' failed
make: [obj/x86_LINUX/trealparserin.mli] Error 2 (ignored)
mv: cannot stat 'src/trealparserin.ml': No such file or directory
mv: cannot stat 'src/trealparserin.mli': No such file or directory
Compiling interface batteries-lite/batList.mli
Compiling batteries-lite/batList.ml to native code
File "batteries-lite/batList.ml", line 633, characters 17-21:
Warning 52: the argument of this constructor should not be matched against a
constant pattern; the actual value of the argument could change
in the future.
File "batteries-lite/batList.ml", line 637, characters 17-21:
Warning 52: the argument of this constructor should not be matched against a
constant pattern; the actual value of the argument could change
in the future.
Compiling batteries-lite/batteriesInit.ml to native code
Compiling interface hashtbl-4.03.0/myhashtbl.mli
Compiling hashtbl-4.03.0/myhashtbl.ml to native code
Compiling hashtbl-4.03.0/hashtblinit.ml to native code
Compiling src/case_ins.ml to native code
Compiling src/stats.ml to native code
Compiling src/arch.ml to native code
Compiling src/version.ml to native code
Compiling src/parsing.ml to native code
Compiling src/tph.ml to native code
Compiling src/util.ml to native code
File "src/util.ml", line 485, characters 4-15:
Warning 3: deprecated: String.copy
Compiling src/modder.ml to native code
Compiling src/var.ml to native code
Compiling src/arch2.ml to native code
Compiling src/xor.ml to native code
Compiling src/key.ml to native code
Compiling src/cbif.ml to native code
Compiling src/biff.ml to native code
Compiling src/tlk.ml to native code
Compiling src/load.ml to native code
File "src/load.ml", line 646, characters 25-40:
Warning 52: the argument of this constructor should not be matched against a
constant pattern; the actual value of the argument could change
in the future.
File "_none_", line 1:
Warning 52: the argument of this constructor should not be matched against a
constant pattern; the actual value of the argument could change
in the future.
Compiling src/cre.ml to native code
Compiling src/ids.ml to native code
Compiling interface obj/x86_LINUX/idsparser.mli
Compiling obj/x86_LINUX/idsparser.ml to native code
Compiling obj/x86_LINUX/idslexer.ml to native code
Compiling obj/x86_LINUX/idslexer2.ml to native code
Compiling src/bcs.ml to native code
File "src/bcs.ml", line 226, characters 59-74:
Warning 52: the argument of this constructor should not be matched against a
constant pattern; the actual value of the argument could change
in the future.
File "src/bcs.ml", line 375, characters 34-49:
Warning 52: the argument of this constructor should not be matched against a
constant pattern; the actual value of the argument could change
in the future.
Compiling interface obj/x86_LINUX/bcsparser.mli
Compiling obj/x86_LINUX/bcsparser.ml to native code
Compiling obj/x86_LINUX/bcslexer.ml to native code
Compiling src/dlg.ml to native code
Compiling src/dc.ml to native code
Compiling src/refactorbaf.ml to native code
Compiling interface obj/x86_LINUX/refactorbafparser.mli
Compiling obj/x86_LINUX/refactorbafparser.ml to native code
Compiling obj/x86_LINUX/refactorbaflexer.ml to native code
Compiling interface obj/x86_LINUX/refactordparser.mli
Compiling obj/x86_LINUX/refactordparser.ml to native code
Compiling obj/x86_LINUX/refactordlexer.ml to native code
Compiling interface obj/x86_LINUX/bafparser.mli
Compiling obj/x86_LINUX/bafparser.ml to native code
Compiling obj/x86_LINUX/baflexer.ml to native code
Compiling src/myxdiff.ml to native code
Compiling src/diff.ml to native code
Compiling src/sav.ml to native code
File "src/sav.ml", line 42, characters 25-37:
Warning 52: the argument of this constructor should not be matched against a
constant pattern; the actual value of the argument could change
in the future.
File "src/sav.ml", line 43, characters 25-46:
Warning 52: the argument of this constructor should not be matched against a
constant pattern; the actual value of the argument could change
in the future.
Compiling src/mos.ml to native code
Compiling src/tp.ml to native code
Compiling interface obj/x86_LINUX/dparser.mli
Compiling obj/x86_LINUX/dparser.ml to native code
File "src/dparser.mly", line 42, characters 37-48:
Warning 3: deprecated: String.copy
Compiling obj/x86_LINUX/dlexer.ml to native code
Compiling src/sql.ml to native code
Compiling src/json.ml to native code
Compiling elkhound/smutil.ml to native code
Compiling elkhound/useract.ml to native code
Compiling elkhound/lexerint.ml to native code
Compiling elkhound/parsetables.ml to native code
Compiling elkhound/arraystack.ml to native code
Compiling elkhound/objpool.ml to native code
Compiling elkhound/glr.ml to native code
Compiling elkhound/lrparse.ml to native code
Compiling src/automate.ml to native code
Compiling src/kit.ml to native code
Compiling src/tpstate.ml to native code
Compiling src/tphelp.ml to native code
make: *** No rule to make target 'obj/x86_LINUX/trealparserin.ml', needed by 'obj/x86_LINUX/trealparser.ml'.  Stop.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on February 26, 2019, 11:39:37 AM
Please verify that you have elkhound on your path. If it is, you should get something from
Code: [Select]
which elkhound. If it's not already, getting elkhound onto your path might be as easy as putting it in ~/bin and restarting your terminal or otherwise re-running ~/.profile.
Title: Re: How to compile. Also, update your compiling environment.
Post by: AL|EN on February 27, 2019, 02:33:10 AM
The problem was non-standard path to 'elkhound' binary (even if executable bit was set):
Quote
ifeq "$(shell uname -m)" "x86_64"
         export WEIDU_ARCH = amd64
         export ELKHOUND_BIN = /home/a/elkhound64
      else
         export WEIDU_ARCH = x86
         export ELKHOUND_BIN = /home/a/elkhound 
      endif

as soon as I copied 'elkhound' and 'elkhound64' binaries to /usr/bin and changed paths to:

Quote
ifeq "$(shell uname -m)" "x86_64"
         export WEIDU_ARCH = amd64
         export ELKHOUND_BIN = elkhound64
      else
         export WEIDU_ARCH = x86
         export ELKHOUND_BIN = elkhound 
      endif

it worked. Linux works, let's now deal with Windows.
Title: Re: How to compile. Also, update your compiling environment.
Post by: Magus_BGforge on December 27, 2019, 12:22:50 AM
I'm trying to build on Linux also, the build itself works fine, but the resulting binary segfaults on launch.
For some reason, it's also quite larger, even when I build the exact same tag (246):
Code: [Select]
-rwxr-xr-x 1 root root  1.6M Dec 27 06:09 weidu
-rwxr-xr-x 1 root root 1018K May 22  2019 weidu.246
UPX is installed and working. The OS is Ubuntu 18.04 x64.

Any advice?
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on December 27, 2019, 01:15:46 PM
I'm trying to build on Linux also, the build itself works fine, but the resulting binary segfaults on launch.
For some reason, it's also quite larger, even when I build the exact same tag (246):
Code: [Select]
-rwxr-xr-x 1 root root  1.6M Dec 27 06:09 weidu
-rwxr-xr-x 1 root root 1018K May 22  2019 weidu.246
UPX is installed and working. The OS is Ubuntu 18.04 x64.

Any advice?
Does not using UPX change anything? I mean, it's largely BS, anyway.

What version of OCaml are you using and how are you building? make weidu?
Title: Re: How to compile. Also, update your compiling environment.
Post by: Magus_BGforge on December 28, 2019, 08:24:46 AM
Code: [Select]
ii  ocaml                           4.05.0-10ubuntu1     amd64                ML language implementation with a class-based object system

ii  upx-ucl                         3.94-4               amd64                efficient live-compressor for executables
Not using UPX results in an 8Mb binary, so it's definitely doing something. But this binary doesn't segfault.
I'm building with "make linux_zip".
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on December 28, 2019, 03:17:42 PM
Well, all UPX does is reduce the on-disk file size by a few MiB, so if that causes segfaults, I suggest you don't use UPX. I don't know why it happens (segfaults are usually illegal attempts at accessing memory and UPX does memory stuff as part of the in-place decompression); I've probably used the same version at some point in the past.
Title: Re: How to compile. Also, update your compiling environment.
Post by: AL|EN on October 03, 2020, 05:36:17 AM
@wisp I can't find revelant GitHub issue where there was discussion regarding new build system for weidu. Now, since the maintainer of the WeiDU Mac is gone, I think it would be the best to create CI in order to build and create weidu releases. I could give it a try (since it's relatively easy for someone with my tech background) but this can happen only after the new build system are in place so there won't be huge amount of duplicated work.
Title: Re: How to compile. Also, update your compiling environment.
Post by: AL|EN on June 03, 2021, 04:48:31 AM
I'm aware that Windows build instructions say that we need native Windows OCaml. Is there any specific reason to not use OCaml provided with Cygwin? More specifically, by using opam?
Title: Re: How to compile. Also, update your compiling environment.
Post by: Wisp on June 18, 2021, 10:30:42 AM
I have not looked into it in detail, but it might be that the Cygwin-hosted non-MinGW OCaml produces binaries that are Cygwin-dependent.
Title: Re: How to compile. Also, update your compiling environment.
Post by: AL|EN on June 18, 2021, 02:35:00 PM
That's correct. The Cygwin-hosted non-MinGW OCaml produces binaries that are Cygwin-dependent, they do require cygwin.dll on Windows. So it was a wise recommendation to not use Cygwin OCaml build.

Note for future myself when I again forget about certain meanders of current WeiDU build system:

- follow https://fdopen.github.io/opam-repository-mingw/installation, create two different Cygwin installation for 32-bit and 64-bit
- for 64-bit you can try the graphical installer
- for 32-bit, ignore the graphical installer because it will have 64-bit Cygwin + 32-bit Ocaml which is not desired -> perform a manual installation of Cygwin 32-bit installation and follow 'Manual Installation' instruction to get opam32, then install desired OCaml variant using OPam
- put elkhound32.exe/elkhound64.exe into Cygwin\bin because you can't provide a full path inside the configuration