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

Offline Argent77

  • Planewalker
  • *****
  • Posts: 144
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: 897
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: 144
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: 897
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: 144
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: 897
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: 144
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: 897
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: 144
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: 897
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: 144
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: 144
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: 897
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: 144
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?

 

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

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