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

Offline Argent77

  • Planewalker
  • *****
  • Posts: 187
Re: How to compile. Also, update your compiling environment.
« Reply #50 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.

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: How to compile. Also, update your compiling environment.
« Reply #51 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 %)

Offline Argent77

  • Planewalker
  • *****
  • Posts: 187
Re: How to compile. Also, update your compiling environment.
« Reply #52 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.

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: How to compile. Also, update your compiling environment.
« Reply #53 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.

Offline Argent77

  • Planewalker
  • *****
  • Posts: 187
Re: How to compile. Also, update your compiling environment.
« Reply #54 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

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: How to compile. Also, update your compiling environment.
« Reply #55 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?

Offline Argent77

  • Planewalker
  • *****
  • Posts: 187
Re: How to compile. Also, update your compiling environment.
« Reply #56 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 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.
« Last Edit: April 14, 2017, 04:31:14 PM by Argent77 »

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: How to compile. Also, update your compiling environment.
« Reply #57 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; }'

Offline Argent77

  • Planewalker
  • *****
  • Posts: 187
Re: How to compile. Also, update your compiling environment.
« Reply #58 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

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: How to compile. Also, update your compiling environment.
« Reply #59 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.
« Last Edit: April 15, 2017, 05:31:26 AM by Wisp »

Offline Argent77

  • Planewalker
  • *****
  • Posts: 187
Re: How to compile. Also, update your compiling environment.
« Reply #60 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; }'

Offline Argent77

  • Planewalker
  • *****
  • Posts: 187
Re: How to compile. Also, update your compiling environment.
« Reply #61 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.

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: How to compile. Also, update your compiling environment.
« Reply #62 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.

Offline Argent77

  • Planewalker
  • *****
  • Posts: 187
Re: How to compile. Also, update your compiling environment.
« Reply #63 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?

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: How to compile. Also, update your compiling environment.
« Reply #64 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.

Offline Argent77

  • Planewalker
  • *****
  • Posts: 187
Re: How to compile. Also, update your compiling environment.
« Reply #65 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

Not sure if it would play nice with WeiDU's auto-update mechanism though.
« Last Edit: November 18, 2017, 04:04:27 PM by Argent77 »

aqrit

  • Guest
Re: How to compile. Also, update your compiling environment.
« Reply #66 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.

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: How to compile. Also, update your compiling environment.
« Reply #67 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

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.

Offline enderandrew

  • Planewalker
  • *****
  • Posts: 8
Re: How to compile. Also, update your compiling environment.
« Reply #68 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/

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: How to compile. Also, update your compiling environment.
« Reply #69 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.
« Last Edit: February 11, 2018, 09:54:50 AM by Wisp »

Offline AstroBryGuy

  • Planewalker
  • *****
  • Posts: 154
  • Gender: Male
Re: How to compile. Also, update your compiling environment.
« Reply #70 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. :(


Offline Argent77

  • Planewalker
  • *****
  • Posts: 187
Re: How to compile. Also, update your compiling environment.
« Reply #71 on: March 12, 2018, 06:10:47 PM »
You could compile an older OCaml version yourself (List of OCaml 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
« Last Edit: March 13, 2018, 04:45:53 AM by Argent77 »

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: How to compile. Also, update your compiling environment.
« Reply #72 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.

Offline AstroBryGuy

  • Planewalker
  • *****
  • Posts: 154
  • Gender: Male
Re: How to compile. Also, update your compiling environment.
« Reply #73 on: March 13, 2018, 07:29:03 PM »
@Wisp - I'll try building an older version of OCaml. Not a problem.

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: How to compile. Also, update your compiling environment.
« Reply #74 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.

 

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.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

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)?: