LuxLang / lux

The Lux Programming Language
Mozilla Public License 2.0
1.69k stars 50 forks source link

Build failure on 0.8.0 for Hello World example from book #71

Closed citrusmunch closed 1 year ago

citrusmunch commented 1 year ago

Hi! I can successfully build and run the hello world example from the book, as-is for version 0.7.0. When I change everything to 0.8.0 in the project.lux I get the following:

[BUILD FAILED] ``` my_project ❯ lux build [?] Fetching com.github.luxlang:lux-jvm-0.8.0 from "/Users/cnmne/.m2/repository" [X] Missed com.github.luxlang:lux-jvm-0.8.0 from "/Users/cnmne/.m2/repository" [?] Fetching com.github.luxlang:stdlib-0.8.0 from "/Users/cnmne/.m2/repository" [X] Missed com.github.luxlang:stdlib-0.8.0 from "/Users/cnmne/.m2/repository" [?] Fetching com.github.luxlang:lux-jvm-0.8.0 from "https://repo1.maven.org/maven2/" [O] Found com.github.luxlang:lux-jvm-0.8.0 at "https://repo1.maven.org/maven2/" [?] Fetching com.github.luxlang:lux-jvm-function-0.6.5 from "https://repo1.maven.org/maven2/" [O] Found com.github.luxlang:lux-jvm-function-0.6.5 at "https://repo1.maven.org/maven2/" [?] Fetching com.github.luxlang:stdlib-0.8.0 from "https://repo1.maven.org/maven2/" [O] Found com.github.luxlang:stdlib-0.8.0 at "https://repo1.maven.org/maven2/" Local successes: Local failures: 0: "com.github.luxlang:lux-jvm-0.8.0" 1: "com.github.luxlang:stdlib-0.8.0" Remote successes: 0: "com.github.luxlang:lux-jvm-0.8.0" 1: "com.github.luxlang:lux-jvm-function-0.6.5" 2: "com.github.luxlang:stdlib-0.8.0" Remote failures: [BUILD STARTED] Duration: +45ms Compilation failed: {library/lux/data/format/tar.invalid_end_of_archive} [BUILD FAILED] ```
project.lux ``` ... project.lux ["" ["identity" ["my.group" "my_project" "0.1.0-SNAPSHOT"] "repositories" ["https://oss.sonatype.org/content/repositories/snapshots/" "https://oss.sonatype.org/service/local/staging/deploy/maven2/"] "dependencies" [["com.github.luxlang" "stdlib" "0.8.0" "tar"]] "lux" ["com.github.luxlang" "lux-jvm" "0.8.0" "jar"] "program" main.main]] ... By default, Aedifex uses the "source" directory for finding your source-code. ... The file containing our program will be my_project/source/main.lux. ```

I'm using the aedifex.jar asset from the 0.8.0 release in each case. I have no experience with the "Nexus Repository Manager", so I'm not sure if I might be using that incorrectly?

I've tried wiping the target directory and rebuilding. I haven't modified/deleted anything in ~/.m2/.

citrusmunch commented 1 year ago

This is on a ~2015 MacBook Air running macOS 12.7

and java version:

❯ java -version
openjdk version "21.0.1" 2023-10-17
OpenJDK Runtime Environment (build 21.0.1+12-29)
OpenJDK 64-Bit Server VM (build 21.0.1+12-29, mixed mode, sharing)
eduardoejp commented 1 year ago

That library/lux/data/format/tar.invalid_end_of_archive error that you got is only supposed to happen if the compiler has to open a TAR file that is corrupt or incorrectly formatted.

I don't have the slightest clue as to why it's happening to you, because the TAR for the standard library is properly packaged. And the same goes for the TAR files created for caching purposes.

Can you upload the stdlib TAR that you've got in your ~/.m2/? Also, any TAR file generated by the compiler for caching.

I'd like to take a look and see if there's anything unusual.

citrusmunch commented 1 year ago

The md5 and sha1 hashes all match for the ~/.m2/repository/com/github/luxlang/stdlib/0.8.0/stdlib-0.8.0.tar (which I've had to gzip for github). I wasn't able to find any cached tars in the usual places: .cache/, /usr/local/var/cache/, ~/Library/Caches/, /Library/Caches/, /System/Library/Caches, my_project/target(?).

eduardoejp commented 1 year ago

I wasn't able to find any cached tars in the usual places

The place to look for would be my_project/target. It would be a file named JVM.tar.

-_- I can't really think of what's causing you trouble. That error you're getting is one of those errors that can technically happen but you never actually expect to see it in real life.

You can maybe try using this version of Aedifex: aedifex.zip ^^^ You'll have to re-name it to aedifex.jar, since GitHub doesn't let me upload JARs.

It fixes a different bug, but it's backwards compatible to v0.8.0. Using it shouldn't be any different, but who knows...

eduardoejp commented 1 year ago

Well, well, well... It turns out, the problem is 100% on my end.

I think I bungled the release of the standard library. I just tried compiling a personal project using that 0.8.0 dependency, and I got the same error you're getting.

I never had that issue before because I don't consume the standard library that way in my projects. I just create a symbolic link to the source code in my hard-drive instead. That way, whenever I need to add something to the standard library that I need for a project, I can avoid the hassle of having to re-deploy and I can save that for later.

Well... it turns out that using the actually deployed stdlib breaks the build in the same way you're experiencing. It probably has to do with the fact that I had to package the stdlib manually this time around instead of going through Aedifex because of an issue it had at the time (the same issue I fixed in that updated Aedifex that I posted in my previous reply).

I'll see if I can repackaged things properly with Aedifex now and I'll push a v0.8.1 version later today. I'll close this issue once it's out so you'll know you can use it.

eduardoejp commented 1 year ago

@citrusmunch you can now import stdlib 0.8.1 and it should work. I only deployed that one package. The Lux compilers will work fine with it, so no need to change them.

citrusmunch commented 1 year ago

Thanks for the swift action! Though it seems I'm still having a bit of trouble. I can see the artifact here, but it doesn't seem to be fetching?

[BUILD FAILED] ```ShellSession ❯ rm -rf ~/.m2/repository/com/github/luxlang/ && lux clean && lux build Successfully cleaned target directory: target [?] Fetching com.github.luxlang:lux-jvm-0.8.0 from "/Users/cnmne/.m2/repository" [X] Missed com.github.luxlang:lux-jvm-0.8.0 from "/Users/cnmne/.m2/repository" [?] Fetching com.github.luxlang:stdlib-0.8.1 from "/Users/cnmne/.m2/repository" [X] Missed com.github.luxlang:stdlib-0.8.1 from "/Users/cnmne/.m2/repository" [?] Fetching com.github.luxlang:lux-jvm-0.8.0 from "https://repo1.maven.org/maven2/" [O] Found com.github.luxlang:lux-jvm-0.8.0 at "https://repo1.maven.org/maven2/" [?] Fetching com.github.luxlang:lux-jvm-function-0.6.5 from "https://repo1.maven.org/maven2/" [O] Found com.github.luxlang:lux-jvm-function-0.6.5 at "https://repo1.maven.org/maven2/" [?] Fetching com.github.luxlang:stdlib-0.8.1 from "https://repo1.maven.org/maven2/" [X] Missed com.github.luxlang:stdlib-0.8.1 from "https://repo1.maven.org/maven2/" [?] Fetching com.github.luxlang:stdlib-0.8.1 from "https://oss.sonatype.org/service/local/staging/deploy/maven2/" [X] Missed com.github.luxlang:stdlib-0.8.1 from "https://oss.sonatype.org/service/local/staging/deploy/maven2/" [?] Fetching com.github.luxlang:stdlib-0.8.1 from "https://oss.sonatype.org/content/repositories/snapshots/" [X] Missed com.github.luxlang:stdlib-0.8.1 from "https://oss.sonatype.org/content/repositories/snapshots/" Local successes: Local failures: 0: "com.github.luxlang:lux-jvm-0.8.0" 1: "com.github.luxlang:stdlib-0.8.1" Remote successes: 0: "com.github.luxlang:lux-jvm-0.8.0" 1: "com.github.luxlang:lux-jvm-function-0.6.5" Remote failures: 0: "com.github.luxlang:stdlib-0.8.1" [BUILD STARTED] Duration: +182ms Compilation failed: {library/lux/meta/compiler/meta/io/context.cannot_find_module} Module: "library/lux" Importer: "main" [BUILD FAILED] ```
project.lux ```ShellSession ❯ cat project.lux ... project.lux ["" ["identity" ["my.group" "my_project" "0.1.0-SNAPSHOT"] "repositories" ["https://oss.sonatype.org/content/repositories/snapshots/" "https://oss.sonatype.org/service/local/staging/deploy/maven2/"] "dependencies" [["com.github.luxlang" "stdlib" "0.8.1" "tar"]] "lux" ["com.github.luxlang" "lux-jvm" "0.8.0" "jar"] "program" main.main]] ... By default, Aedifex uses the "source" directory for finding your source-code. ... The file containing our program will be my_project/source/main.lux. ```
eduardoejp commented 1 year ago

😑 That's a new one. You're right. It doesn't even show up here: https://repo1.maven.org/maven2/com/github/luxlang/stdlib/ Maybe it takes a while for Maven to make it available... I'll keep an eye on things and see how the situation changes. That release was less than 24 hours ago... Maybe there's crazy latency in Maven land...

In the mean time, you can decompress this in the stdlib directory of your ~/.m2: 0.8.1.zip

citrusmunch commented 1 year ago

Using the zip file made some progress! Unfortunately still failing haha 😅. It seemed to complain about the def macro, which I thought might be out of date syntax-wise since it's documented as def:, but using that instead also yields a build error.

The full output's a doozy (and actually too long for github), so I've attached the output as files and also included just the last bits here as well (they're essentially the same?).

def

source/main.lux

```clojure ... main.lux (.require [library [lux (.except) [program (.only program)] ["[0]" debug] [control ["[0]" io]]]]) (def main (program args (io.io (debug.log! "Hello, world!")))) ... As you can see, this is nothing more than a very simple "Hello, world!" program to test things out. ... Everything will be explained later in the rest of the book. ```

❯ lux clean && lux build > def-1.log

def-1.log (full)

def-1.log (tail)

``` Duration: +1m29s893ms Compilation failed: {library/lux/meta/compiler.cannot_compile} Module: main ---------------------------------------------------------------- {library/lux/meta/compiler/language/lux/phase/declaration.not_a_declaration} Declaration: def [BUILD FAILED] ```

def:

source/main.lux

```clojure ... main.lux (.require [library [lux (.except) [program (.only program)] ["[0]" debug] [control ["[0]" io]]]]) ... CHANGED HERE `def' -> `def:' (def: main (program args (io.io (debug.log! "Hello, world!")))) ... As you can see, this is nothing more than a very simple "Hello, world!" program to test things out. ... Everything will be explained later in the rest of the book. ```

❯ lux clean && lux build > def-2.log

def-2.log (full)

def-2.log (tail)

``` Duration: +1m39s643ms Compilation failed: {library/lux/meta/compiler.cannot_compile} Module: main ---------------------------------------------------------------- {library/lux/meta/compiler/language/lux/phase/declaration.not_a_declaration} Declaration: def: [BUILD FAILED] ```

eduardoejp commented 1 year ago

The current name for that macro is the.

The updated example code would be:

(.require
 [library
  [lux (.except)
   [program (.only program)]
   ["[0]" debug]
   [control
    ["[0]" io]]]])

(the main
  (program args
    (io.io (debug.log! "Hello, world!"))))

However, here we enter a problematic territory.

I did not update the documentation prior to releasing v0.8.0, and I didn't even announce the release of 0.8.0.

Why? Because it's very apparent that folks don't want to use Lux, and so any effort placed on Lux's development beyond what I personally need is wasteful, since it has no ROI for me.

Maintaining the documentation (including the book) is unnecessary for me because I already know everything there is to know about the language, and I usually just look at the source code when trying to refresh my memory about something.

I don't know for what reason you have approached Lux, but if your goal is just to play around with it a little bit and then move on to something else; then I suggest that you just move on now. It's wasteful for me to maintain documentation for non-users.

citrusmunch commented 1 year ago

Everything seems to be working as expected now; thanks for making the time!

wrt the docs: I did notice some divergence, but assumed it was a temporary lag. I absolutely understand the need for an attention budget! If I might suggest, updating the README.md (especially the "Where do I learn Lux?" section) could help to temper expectations for any newcomers.

In the meantime I'll be wading through the source :)