Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Mar 2014 22:13:29 +0200
From:      Tijl Coosemans <tijl@coosemans.org>
To:        Matthew Pherigo <hybrid120@gmail.com>
Cc:        "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Subject:   Re: lang/nimrod issue: missing forward slash
Message-ID:  <20140331221329.5e795449@kalimero.tijl.coosemans.org>
In-Reply-To: <2C2F5FA3-D5F3-4223-A163-F689DA5056BF@gmail.com>
References:  <C0A51891-9BF5-44DF-A466-887FB3AAD153@gmail.com> <20140331201111.18f2688b@kalimero.tijl.coosemans.org> <2C2F5FA3-D5F3-4223-A163-F689DA5056BF@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--MP_/ORJnaCt_Ipyp5PRRWcplqy5
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Mon, 31 Mar 2014 14:08:55 -0500 Matthew Pherigo wrote:
>> On Mar 31, 2014, at 1:11 PM, Tijl Coosemans <tijl@coosemans.org> wrote:
>>> On Mon, 31 Mar 2014 12:15:35 -0500 Matthew Pherigo wrote:
>>> I'm having a problem with lang/nimrod that's keeping me from doing any
>>> development at the moment. I think this is an issue created by the
>>> person who created the port (nimrod works fine on my arch linux VM),
>>> but I figured I'd check here in case anyone knows a fix.
>>> 
>>> When I try to compile anything from nimrod, the paths calls the compiler
>>> with are incorrect. For example, here is the (successful) compilation
>>> output of a program that doesn't depend on any external Libs (besides
>>> system.nim):
>> 
>> Can you make these example program available somewhere so I can try to
>> reproduce this?
> 
> The programs themselves don't make any difference. But, here they are.
> The first one is simply
> echo("Hello, world!")
> 
> The program that has external dependencies is a very incomplete calculator
> program, as follows:
> 
> import strutils
> var a, b, c: float
> var buf: string
> echo("Enter your first number! \n> ")
> buf = readLine(stdin)
> a = ParseFloat(buf)

It seems that nimrod currently requires procfs to be mounted.  I've
attached a patch to avoid that.  You can place it in lang/nimrod/files
and then rebuild the port.  You should also be able to remove
/etc/nimrod.cfg then.

--MP_/ORJnaCt_Ipyp5PRRWcplqy5
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=patch-lib-pure-os.nim

--- lib/pure/os.nim.orig
+++ lib/pure/os.nim
@@ -1389,8 +1389,6 @@
     result = getApplAux("/proc/self/exe")
   elif defined(solaris):
     result = getApplAux("/proc/" & $getpid() & "/path/a.out")
-  elif defined(freebsd):
-    result = getApplAux("/proc/" & $getpid() & "/file")
   elif defined(macosx):
     var size: cuint32
     getExecPath1(nil, size)
@@ -1399,16 +1397,14 @@
       result = "" # error!
   else:
     # little heuristic that may work on other POSIX-like systems:
-    result = string(getEnv("_"))
-    if len(result) == 0:
-      result = string(ParamStr(0))
-      # POSIX guaranties that this contains the executable
-      # as it has been executed by the calling process
-      if len(result) > 0 and result[0] != DirSep: # not an absolute path?
-        # iterate over any path in the $PATH environment variable
-        for p in split(string(getEnv("PATH")), {PathSep}):
-          var x = joinPath(p, result)
-          if ExistsFile(x): return x
+    result = string(ParamStr(0))
+    # POSIX guaranties that this contains the executable
+    # as it has been executed by the calling process
+    if len(result) > 0 and result[0] != DirSep: # not an absolute path?
+      # iterate over any path in the $PATH environment variable
+      for p in split(string(getEnv("PATH")), {PathSep}):
+        var x = joinPath(p, result)
+        if ExistsFile(x): return x
 
 proc getApplicationFilename*(): string {.rtl, extern: "nos$1", deprecated.} =
   ## Returns the filename of the application's executable.

--MP_/ORJnaCt_Ipyp5PRRWcplqy5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140331221329.5e795449>