From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: James Cooper Newsgroups: gmane.lisp.guile.user Subject: Re: How best to produce a standalone executable with Guile? Date: Tue, 7 Apr 2020 09:31:53 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="61791"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Tue Apr 07 11:32:34 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jLkaw-000FvO-7O for guile-user@m.gmane-mx.org; Tue, 07 Apr 2020 11:32:34 +0200 Original-Received: from localhost ([::1]:43944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLkau-0003GV-VJ for guile-user@m.gmane-mx.org; Tue, 07 Apr 2020 05:32:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34675) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLkaZ-0003GE-N3 for guile-user@gnu.org; Tue, 07 Apr 2020 05:32:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLkaW-0002Rm-Id for guile-user@gnu.org; Tue, 07 Apr 2020 05:32:10 -0400 Original-Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]:39066) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLkaV-0002O2-Mn for guile-user@gnu.org; Tue, 07 Apr 2020 05:32:08 -0400 Original-Received: by mail-ot1-x32c.google.com with SMTP id x11so2408868otp.6 for ; Tue, 07 Apr 2020 02:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aucklanduni.ac.nz; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=JtFtP/HBKtHkBXvajEq0SO3UOFFAQo/4tRFAQsSNCr8=; b=H4eUtkcaQbVgmV3PW/AI1PDP4h69gnPWCcsKjoGZ4nhdNo5EjZFEIUNEo/r+ovGpEb 1EHMTyPMmL8L3TFSmTjQjfvfZD08W0rUrYCxlbLHVxWs3NuRl9fB70Q7hZ4TwI1mkV1s CD+sielDRRYLE5AwrsQ57psrdam4E3p4BcFSE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=JtFtP/HBKtHkBXvajEq0SO3UOFFAQo/4tRFAQsSNCr8=; b=JeRaQmAZvn5qkisPM5v1OVhRklBpdlbr1MeOnA918xBhrdC7yjZNAGkNqYZsTPTPsP it9k6fAqdP5/IXXMst7BTV+8fNWlQ1+nSM+QmQUE4JYEwzCwhHEhJyXrnm6sj4d6q/k/ 53jheZ62DAiVJJ6WU/9ZjOnDVz07H004jkwXoLwx0Z4DeWVtZVL9pDsO+F4GrY120JIt 2lYgLHQZFIp7Z7pt3ec5NhfQwW2kpObvX30o1doLKgq22FY/ZNsx1BN601dWsaOEsxxI ib5XosBF2Cx/+NsuYYe+L0umk9r0FWmGD0inpHUVDxkPI9ALdmyfB/nU1F6zLZIFIgYY PBAw== X-Gm-Message-State: AGi0PuZTMXCWgcfM17zAfyHqjJhn+AiFNLZseA8i2JsXiq3PNefgRNX2 uLkWMrVGXEC3l3CjHnv3M7LG92+cZbE3oIRKYNh6LHxP X-Google-Smtp-Source: APiQypIE/lo699oVj4mUynJBu01fDTD7qIZXrG8FoDpFoH8WEI9tA59bMsut2dhDiUcTguapoC4zbiPmon5gVjd/+Ec= X-Received: by 2002:a05:6830:239b:: with SMTP id l27mr816574ots.278.1586251923909; Tue, 07 Apr 2020 02:32:03 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::32c X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:16370 Archived-At: Hi Matt and Christopher, Thank you for your responses. Apologies for replying to my email - for some reason I never received either of yours into my inbox, I only saw them when I looked up my email on the mailing list archive online. I'm afraid I am not (currently) a Guix user. I did try to install it on my working system but had no end of issues, which led me to leave it for the time being and instead simply build Guile from source. That's a story for another time, however, and it certainly sounds like something I should look into. Am I correct in understanding that guild essentially is what the Guile runtime will use to compile my source files before executing them? And that the way to create a traditional executable would be to create a C program that includes libguile.h and wraps my actual Guile program (probably using scm_boot_guile)? I'll try out this approach as soon as I can. If you're wondering, the reason why I'm interested in having a traditional executable is that I'm planning to run comparative benchmarking directly on equivalent versions of the same program in different languages, and I *think *that will work a lot better if I can specify an executable name for the Guile implementation. Thanks again. Regards, James On Sun, 5 Apr 2020 at 05:28, James Cooper wrote: > Hi Guile folks, > > I am currently experimenting with a handful of languages that include > modern implementations of Concurrent ML, to determine which one appears > best able to handle computationally- and message-heavy workloads (at least > for my purposes, Computer Vision). Guile is one of the languages I am > trying out with the Fibers library. > > My question is, how can I best go about creating Linux executables from > Guile, where said programs benefit from the most ahead-of-time compilation > and optimisation possible? I don't believe they strictly need to be > standalone, as the environment I will be running the programs in will > likely be the same as the development environment. So they can undoubtedly > have dependencies on external libraries. Furthermore, I am perfectly happy > with the process being a bit convoluted, as I can easily automate it with a > makefile. I would, however, prefer if at all possible that the option to > target other processor architectures remains available down the line (I > assume using GCC can enable this, but I'm not sure). > > I have looked at all the sections of the Guile manual that appeared > relevant, but to be honest I'm still a bit confused about what the best > approach would be. *s* *9.4.5 Bytecode* in the manual seems to suggest > that one can use guild to produce what will be a standalone executable > that looks like an ELF binary to the system and runs on the Guile VM, but > I'm entirely sure if I am reading it correctly. *s 6.18.5 Compiling > Scheme Code* also discusses compilation but seems to denounce the > practice explicitly. *s 9.3.8 Just-In-Time Native Code* talks about JIT > compilation to native code for a given target. Is it possible to apply > this process ahead-of-time? > > A potential alternative approach I can see is using the capabilities of > running Guile code in a C program (compiled with GCC). This would > presumably involve creating a template C program that just calls the > appropriate Guile functions and passes the relevant command line parameters > in. > > Any thoughts on what would likely produce the most efficient executable in > the end? The target programs do not need to modify themselves at run-time > (or really do anything dynamic) if that makes a difference. And does > anyone know of pre-existing examples they could point me to? Please do let > me know if there is further information I could provide that would help. > Thanks in advance. > > Regards, > > James >