Anyolite / anyolite

Embedded mruby/Ruby for Crystal
https://anyolite.github.io/anyolite
MIT License
161 stars 10 forks source link

having difficulty running the tests in a new clone of the repo #36

Closed drhuffman12 closed 5 months ago

drhuffman12 commented 1 year ago

Describe the problem Please describe your problem in a detailed way here, so others can understand it.

I ran crystal build main.rc and got this error:

$ crystal build test.cr
/usr/bin/ld: cannot find /home/drhuffman12/_tmp_/github/drhuffman12/anyolite/src/implementations/mruby/../../../build/glue/mruby/error_helper.o: No such file or directory
/usr/bin/ld: cannot find /home/drhuffman12/_tmp_/github/drhuffman12/anyolite/src/implementations/mruby/../../../build/glue/mruby/script_helper.o: No such file or directory
/usr/bin/ld: cannot find /home/drhuffman12/_tmp_/github/drhuffman12/anyolite/src/implementations/mruby/../../../build/glue/mruby/data_helper.o: No such file or directory
/usr/bin/ld: cannot find /home/drhuffman12/_tmp_/github/drhuffman12/anyolite/src/implementations/mruby/../../../build/glue/mruby/return_functions.o: No such file or directory
/usr/bin/ld: cannot find /home/drhuffman12/_tmp_/github/drhuffman12/anyolite/src/implementations/mruby/../../../build/mruby/lib/libmruby.a: No such file or directory
collect2: error: ld returned 1 exit status
Error: execution of command failed with exit status 1: cc "${@}" -o /home/drhuffman12/.cache/crystal/home-drhuffman12-_tmp_-github-drhuffman12-anyolite-src-BytecodeCompiler.cr/macro_run  -rdynamic -L/home/drhuffman12/.asdf/installs/crystal/1.9.2/bin/../lib/crystal "/home/drhuffman12/_tmp_/github/drhuffman12/anyolite/src/implementations/mruby/../../../build/glue/mruby/error_helper.o" "/home/drhuffman12/_tmp_/github/drhuffman12/anyolite/src/implementations/mruby/../../../build/glue/mruby/script_helper.o" "/home/drhuffman12/_tmp_/github/drhuffman12/anyolite/src/implementations/mruby/../../../build/glue/mruby/data_helper.o" "/home/drhuffman12/_tmp_/github/drhuffman12/anyolite/src/implementations/mruby/../../../build/glue/mruby/return_functions.o" "/home/drhuffman12/_tmp_/github/drhuffman12/anyolite/src/implementations/mruby/../../../build/mruby/lib/libmruby.a" -lm -lpcre2-8 -lgc -lpthread -levent -lrt -lpthread -ldl

I had previously just cloned the repo locally and ran shards install

Why do you not use the conventional crystal spec approach? That's like the next thing I try when trying out a new (to me) crystal repo. But, I'm glad that you at least included a ./test.cr file. :)

Some tips:

To Reproduce Please require a minimal working code example on how to reproduce the issue, if possible.

Avoid any unnecessary detail, but make sure the problem still persists in the example. If you are unable to provide a minimal working example, you may also refer to a specific repository instead.

Expected behavior If something does not work the way you would expect it to, please describe the expected behavior shortly. This is only necessary if you don't encounter obvious errors or crashes.

Platform and version Please describe which versions of Crystal and Anyolite you are using, which Anyolite flags you are using and which platform you are on.

Additional context Is there anything else you want to mention that did not fit into the previous sections?

Hadeweka commented 1 year ago

It seems that the shard installation process failed. Do you still have the output from shards install or are able to reproduce it?

As for the specs: I tried to do this, but ran into some weird problems. I need to fix some minor issues in Anyolite anyway, so I might try again.

drhuffman12 commented 1 year ago
$ shards install
Resolving dependencies
Hadeweka commented 1 year ago

Hm, that doesn't really help. Interesting that there is just no other output at all. Was this also the only output the first time you ran shards install for your project?

I still have no real information to work with, so it would be really helpful if you could try these things:

drhuffman12 commented 12 months ago

There wasn't much output. I tried to grab anything that looked relevant, To answer your questions...

platform and OS: Linux Mint 21.2

$ ruby -v
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]

no stand-alone rake installed (I guess I need to gem install rake.)

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04) 

I'll try the rake build_shard command after I add the rake gem. I'll try this this weekend or so.

stellarpower commented 11 months ago

I am getting the same:

🍑❯ podman run --rm -it -v ./anyolitebug:/w/ --workdir /w/  crystallang/crystal:1.8-dev
# cat *

require "anyolite"

Anyolite::RbInterpreter.create do |rb|
  puts rb.load_script_from_file("example.rb")
end

version: 2.0
shards:
  anyolite:
    git: https://github.com/anyolite/anyolite.git
    version: 1.1.0+git.commit.cfed3cf6ff51e60725ea36f866d74e8ffb8e4dd8

name: AnyoliteTest
version: 0.0.1

authors:
  - Hadeweka

dependencies:
  anyolite:
    github: Anyolite/anyolite
    branch: main
    version: 1.1.0

license: MIT

crystal: '>= 0.34.0'

targets:
  anyoliteTest:
    main: main.cr

# shards install
Resolving dependencies
Fetching https://github.com/anyolite/anyolite.git
Installing anyolite (1.1.0 at cfed3cf)
Postinstall of anyolite: crystal run install.cr
# shards run
Dependencies are satisfied
Building: anyoliteTest
Error target anyoliteTest failed to compile:
/usr/bin/ld: cannot find /w/lib/anyolite/src/implementations/mruby/../../../build/glue/mruby/error_helper.o: No such file or directory
/usr/bin/ld: cannot find /w/lib/anyolite/src/implementations/mruby/../../../build/glue/mruby/script_helper.o: No such file or directory
/usr/bin/ld: cannot find /w/lib/anyolite/src/implementations/mruby/../../../build/glue/mruby/data_helper.o: No such file or directory
/usr/bin/ld: cannot find /w/lib/anyolite/src/implementations/mruby/../../../build/glue/mruby/return_functions.o: No such file or directory
/usr/bin/ld: cannot find /w/lib/anyolite/src/implementations/mruby/../../../build/mruby/lib/libmruby.a: No such file or directory
collect2: error: ld returned 1 exit status
Error: execution of command failed with exit status 1: cc "${@}" -o /w/bin/anyoliteTest  -rdynamic -L/usr/bin/../lib/crystal "/w/lib/anyolite/src/implementations/mruby/../../../build/glue/mruby/error_helper.o" "/w/lib/anyolite/src/implementations/mruby/../../../build/glue/mruby/script_helper.o" "/w/lib/anyolite/src/implementations/mruby/../../../build/glue/mruby/data_helper.o" "/w/lib/anyolite/src/implementations/mruby/../../../build/glue/mruby/return_functions.o" "/w/lib/anyolite/src/implementations/mruby/../../../build/mruby/lib/libmruby.a" -lm -lpcre2-8 -lm -lgc -lpthread -levent -lrt -lpthread -ldl

root@8071a75158c8:/w# realpath /w/lib/anyolite/src/implementations/mruby/../../../build/
/w/lib/anyolite/build
root@8071a75158c8:/w# ls -lahR /w/lib/anyolite/
/w/lib/anyolite/:
total 108K
drwxr-xr-x 8 root root 4.0K Oct 22 15:54 .
drwxr-xr-x 3 root root 4.0K Oct 22 15:54 ..
drwxr-xr-x 4 root root 4.0K Oct 22 15:54 .github
-rw-r--r-- 1 root root  112 Oct 22 15:54 .gitignore
-rw-r--r-- 1 root root    0 Oct 22 15:54 .gitmodules
-rw-r--r-- 1 root root  18K Oct 22 15:54 Changelog.md
-rw-r--r-- 1 root root 1.1K Oct 22 15:54 LICENSE
-rw-r--r-- 1 root root 5.5K Oct 22 15:54 README.md
-rw-r--r-- 1 root root 8.5K Oct 22 15:54 Rakefile.rb
-rw-r--r-- 1 root root   24 Oct 22 15:54 anyolite.cr
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 config_files
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 examples
drwxr-xr-x 4 root root 4.0K Oct 22 15:54 glue
-rw-r--r-- 1 root root  147 Oct 22 15:54 install.cr
lrwxrwxrwx 1 root root    2 Oct 22 15:54 lib -> ..
-rw-r--r-- 1 root root  251 Oct 22 15:54 shard.yml
drwxr-xr-x 5 root root 4.0K Oct 22 15:54 src
-rw-r--r-- 1 root root  15K Oct 22 15:54 test.cr
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 utility

/w/lib/anyolite/.github:
total 16K
drwxr-xr-x 4 root root 4.0K Oct 22 15:54 .
drwxr-xr-x 8 root root 4.0K Oct 22 15:54 ..
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 ISSUE_TEMPLATE
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 workflows

/w/lib/anyolite/.github/ISSUE_TEMPLATE:
total 12K
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 .
drwxr-xr-x 4 root root 4.0K Oct 22 15:54 ..
-rw-r--r-- 1 root root 1.3K Oct 22 15:54 problem-report.md

/w/lib/anyolite/.github/workflows:
total 24K
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 .
drwxr-xr-x 4 root root 4.0K Oct 22 15:54 ..
-rw-r--r-- 1 root root  473 Oct 22 15:54 doc.yml
-rw-r--r-- 1 root root  660 Oct 22 15:54 mritest.yml
-rw-r--r-- 1 root root  476 Oct 22 15:54 test.yml
-rw-r--r-- 1 root root  694 Oct 22 15:54 wintest.yml

/w/lib/anyolite/config_files:
total 20K
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 .
drwxr-xr-x 8 root root 4.0K Oct 22 15:54 ..
-rw-r--r-- 1 root root  204 Oct 22 15:54 anyolite_config_external_ruby.json
-rw-r--r-- 1 root root  229 Oct 22 15:54 anyolite_config_mri.json
-rw-r--r-- 1 root root  263 Oct 22 15:54 anyolite_config_mruby.json

/w/lib/anyolite/examples:
total 48K
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 .
drwxr-xr-x 8 root root 4.0K Oct 22 15:54 ..
-rw-r--r-- 1 root root  260 Oct 22 15:54 bytecode_test.rb
-rw-r--r-- 1 root root  270 Oct 22 15:54 hp_example.rb
-rw-r--r-- 1 root root  106 Oct 22 15:54 mri_test.rb
-rw-r--r-- 1 root root  21K Oct 22 15:54 test.rb
-rw-r--r-- 1 root root 1.2K Oct 22 15:54 test_framework.rb

/w/lib/anyolite/glue:
total 16K
drwxr-xr-x 4 root root 4.0K Oct 22 15:54 .
drwxr-xr-x 8 root root 4.0K Oct 22 15:54 ..
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 mri
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 mruby

/w/lib/anyolite/glue/mri:
total 28K
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 .
drwxr-xr-x 4 root root 4.0K Oct 22 15:54 ..
-rw-r--r-- 1 root root 6.4K Oct 22 15:54 data_helper.c
-rw-r--r-- 1 root root 1.3K Oct 22 15:54 error_helper.c
-rw-r--r-- 1 root root 2.1K Oct 22 15:54 return_functions.c
-rw-r--r-- 1 root root 1.8K Oct 22 15:54 script_helper.c

/w/lib/anyolite/glue/mruby:
total 28K
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 .
drwxr-xr-x 4 root root 4.0K Oct 22 15:54 ..
-rw-r--r-- 1 root root 1.7K Oct 22 15:54 data_helper.c
-rw-r--r-- 1 root root 1.3K Oct 22 15:54 error_helper.c
-rw-r--r-- 1 root root 2.4K Oct 22 15:54 return_functions.c
-rw-r--r-- 1 root root 4.8K Oct 22 15:54 script_helper.c

/w/lib/anyolite/src:
total 144K
drwxr-xr-x 5 root root 4.0K Oct 22 15:54 .
drwxr-xr-x 8 root root 4.0K Oct 22 15:54 ..
-rw-r--r-- 1 root root   88 Oct 22 15:54 BytecodeCompiler.cr
-rw-r--r-- 1 root root   90 Oct 22 15:54 BytecodeGetter.cr
-rw-r--r-- 1 root root  513 Oct 22 15:54 Macro.cr
-rw-r--r-- 1 root root  58K Oct 22 15:54 Main.cr
-rw-r--r-- 1 root root 2.8K Oct 22 15:54 Preloader.cr
-rw-r--r-- 1 root root  406 Oct 22 15:54 RbArgCache.cr
-rw-r--r-- 1 root root 8.4K Oct 22 15:54 RbCast.cr
-rw-r--r-- 1 root root 1.5K Oct 22 15:54 RbClass.cr
-rw-r--r-- 1 root root  943 Oct 22 15:54 RbClassCache.cr
-rw-r--r-- 1 root root  304 Oct 22 15:54 RbInternal.cr
-rw-r--r-- 1 root root 2.5K Oct 22 15:54 RbInterpreter.cr
-rw-r--r-- 1 root root 1.3K Oct 22 15:54 RbModule.cr
-rw-r--r-- 1 root root 4.8K Oct 22 15:54 RbRefTable.cr
-rw-r--r-- 1 root root 1.9K Oct 22 15:54 RbTypeCache.cr
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 helper_classes
drwxr-xr-x 4 root root 4.0K Oct 22 15:54 implementations
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 macros

/w/lib/anyolite/src/helper_classes:
total 24K
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 .
drwxr-xr-x 5 root root 4.0K Oct 22 15:54 ..
-rw-r--r-- 1 root root  567 Oct 22 15:54 AnyolitePointer.cr
-rw-r--r-- 1 root root  474 Oct 22 15:54 HelperClasses.cr
-rw-r--r-- 1 root root 4.6K Oct 22 15:54 Regex.cr

/w/lib/anyolite/src/implementations:
total 16K
drwxr-xr-x 4 root root 4.0K Oct 22 15:54 .
drwxr-xr-x 5 root root 4.0K Oct 22 15:54 ..
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 mri
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 mruby

/w/lib/anyolite/src/implementations/mri:
total 32K
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 .
drwxr-xr-x 4 root root 4.0K Oct 22 15:54 ..
-rw-r--r-- 1 root root 1003 Oct 22 15:54 FormatString.cr
-rw-r--r-- 1 root root 6.3K Oct 22 15:54 Implementation.cr
-rw-r--r-- 1 root root  12K Oct 22 15:54 RbCore.cr

/w/lib/anyolite/src/implementations/mruby:
total 36K
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 .
drwxr-xr-x 4 root root 4.0K Oct 22 15:54 ..
-rw-r--r-- 1 root root 2.6K Oct 22 15:54 FormatString.cr
-rw-r--r-- 1 root root 3.3K Oct 22 15:54 Implementation.cr
-rw-r--r-- 1 root root  833 Oct 22 15:54 KeywordArgStruct.cr
-rw-r--r-- 1 root root  13K Oct 22 15:54 RbCore.cr

/w/lib/anyolite/src/macros:
total 144K
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 .
drwxr-xr-x 5 root root 4.0K Oct 22 15:54 ..
-rw-r--r-- 1 root root  19K Oct 22 15:54 ArgConversions.cr
-rw-r--r-- 1 root root 2.4K Oct 22 15:54 ArgTuples.cr
-rw-r--r-- 1 root root  12K Oct 22 15:54 FunctionCalls.cr
-rw-r--r-- 1 root root 2.3K Oct 22 15:54 FunctionGenerators.cr
-rw-r--r-- 1 root root 1.6K Oct 22 15:54 ObjectAllocations.cr
-rw-r--r-- 1 root root 2.6K Oct 22 15:54 RubyConversions.cr
-rw-r--r-- 1 root root 4.5K Oct 22 15:54 RubyTypes.cr
-rw-r--r-- 1 root root 8.0K Oct 22 15:54 UnionCasts.cr
-rw-r--r-- 1 root root  29K Oct 22 15:54 WrapAll.cr
-rw-r--r-- 1 root root  11K Oct 22 15:54 WrapMethodIndex.cr
-rw-r--r-- 1 root root  28K Oct 22 15:54 Wrappers.cr

/w/lib/anyolite/utility:
total 12K
drwxr-xr-x 2 root root 4.0K Oct 22 15:54 .
drwxr-xr-x 8 root root 4.0K Oct 22 15:54 ..
-rw-r--r-- 1 root root  

# find -iname build
# 

I presume the installation process should produce a directory named build and shouldn't be failing silently without this(?)

stellarpower commented 11 months ago

Okay, it was as simple as not having rake installed.

This line should probably be changed to output stdout and stderr form the system command, or throw an error - leave up to you how you want to handle.

Hadeweka commented 11 months ago

It's clearly stated in the Readme that you need Rake to install Anyolite.

I will add a check for Rake into the build process, but generally I'm not responsible for problems resulting from ignoring the Readme file.

stellarpower commented 11 months ago

That's not the point, I had further issues relating to permissions along the way. If rake fails for any reason, then the installation of the shard completes silently. It would be better to print the output of the process or ensure that the return code is zero, and this will catch any future errors. I also did not "ignore" the readme, my point is the last time I hit that bug inside the container, the cause was trivial. The OP's root cause might be different.

Hadeweka commented 11 months ago

Then please open a separate issue or pull request if that is the case, especially if you encounter different problems.

stellarpower commented 11 months ago

37

@drhuffman12 did you succeed in the end?

Hadeweka commented 7 months ago

Is there anything new about this issue?

If not, I would close it for now, as I can't reproduce it with the given information.