Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: build: initial linux x86_64 support using nix #6

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bennyandresen
Copy link

@bennyandresen bennyandresen commented Mar 21, 2023

it basically builds without error. Both the shared graal library "LibScimacs" and the Rust library "scimacs". It can't be loaded for a reason I don't yet understand.

Module could not be opened: "/home/benny/Code/Playground/scimacs/scimacs.so", "/home/benny/Code/Playground/scimacs/scimacs.so: undefined symbol: graal_create_isolate"

Full results:

$ emacs --script test.el
Testing scimacs...
Loadable module found: /home/benny/Code/Playground/scimacs/scimacs.so

Error: module-open-failed ("/home/benny/Code/Playground/scimacs/scimacs.so" "/home/benny/Code/Playground/scimacs/scimacs.so: undefined symbol: graal_create_isolate")
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode 0x10aa1fbde7aef0ea>))
  debug-early-backtrace()
  debug-early(error (module-open-failed "/home/benny/Code/Playground/scimacs/scimacs.so" "/home/benny/Code/Playground/scimacs/scimacs.so: undefined symbol: graal_create_isolate"))
  require(scimacs)
  (progn (message (format "Loadable module found: %s" location)) (require 'scimacs) (message "Symbols loaded from scimacs:") (mapatoms #'(lambda (symbol) (let ((symbol-name (symbol-name symbol))) (if (string-prefix-p "scimacs-" symbol-name) (message (format "  %s" symbol-name)))))) (message "Evaluating forms with sci:") (mapcar #'(lambda (form) (message (format "  %s ; => %s" form (scimacs-eval-sci form)))) '("[1 2 3]" "(+ 1 1)" "(mapv inc (range 5))" "(reduce + (range 5))")))
  (if location (progn (message (format "Loadable module found: %s" location)) (require 'scimacs) (message "Symbols loaded from scimacs:") (mapatoms #'(lambda (symbol) (let ((symbol-name (symbol-name symbol))) (if (string-prefix-p "scimacs-" symbol-name) (message (format "  %s" symbol-name)))))) (message "Evaluating forms with sci:") (mapcar #'(lambda (form) (message (format "  %s ; => %s" form (scimacs-eval-sci form)))) '("[1 2 3]" "(+ 1 1)" "(mapv inc (range 5))" "(reduce + (range 5))"))) (message "Could not find loadable module!"))
  (let* ((location (and t (locate-library "scimacs")))) (if location (progn (message (format "Loadable module found: %s" location)) (require 'scimacs) (message "Symbols loaded from scimacs:") (mapatoms #'(lambda (symbol) (let ((symbol-name (symbol-name symbol))) (if (string-prefix-p "scimacs-" symbol-name) (message (format "  %s" symbol-name)))))) (message "Evaluating forms with sci:") (mapcar #'(lambda (form) (message (format "  %s ; => %s" form (scimacs-eval-sci form)))) '("[1 2 3]" "(+ 1 1)" "(mapv inc (range 5))" "(reduce + (range 5))"))) (message "Could not find loadable module!")))
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_99>(#<buffer  *load*> "/home/benny/Code/Playground/scimacs/test.el")
  load-with-code-conversion("/home/benny/Code/Playground/scimacs/test.el" "/home/benny/Code/Playground/scimacs/test.el" nil t #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_99>)
  command-line--load-script("/home/benny/Code/Playground/scimacs/test.el")
  command-line-1(("-scriptload" "test.el"))
  command-line()
  normal-top-level()
Module could not be opened: "/home/benny/Code/Playground/scimacs/scimacs.so", "/home/benny/Code/Playground/scimacs/scimacs.so: undefined symbol: graal_create_isolate"

@bennyandresen bennyandresen changed the title build: initial linux x86_64 support using nix WIP: build: initial linux x86_64 support using nix Mar 21, 2023
@bennyandresen bennyandresen marked this pull request as draft March 21, 2023 20:29
@bennyandresen
Copy link
Author

Just to share my thoughts on where it's stuck at the moment:
The rust shared library is not re-exporting the symbols from the graalvm shared library on Linux.

I've played around with it a bit and then found this and it doesn't look good for linux:
rust-lang/rfcs#2771

The workarounds with lto and incremental all didn't help. I haven't spent the time yet to see if a wrapping export is fruitful.

@bennyandresen
Copy link
Author

Reason why I think it's related to rust and still be target specific is for example this kind of comment: rust-lang/rust#50007 (comment)

Yesterday I saw several such comments but my history is long and I don't have a full text search. :-)

bb.edn Outdated Show resolved Hide resolved
@borkdude
Copy link
Collaborator

@bennyandresen I'm trying to make a CI config for Github actions in this branch:

https://github.com/jackrusher/scimacs/actions/runs/4490409982/jobs/7897440985

It fails with a maybe similar error?

@jackrusher is going to try a C-wrapper as well, maybe it will help also with this problem.

@borkdude
Copy link
Collaborator

The macOS build (same config) builds fine: https://github.com/jackrusher/scimacs/actions/runs/4490508701/jobs/7897670703

bb.edn: addition of the linux shared library extension
build.rs: linux is case sensitive
@bennyandresen
Copy link
Author

@bennyandresen I'm trying to make a CI config for Github actions in this branch:

https://github.com/jackrusher/scimacs/actions/runs/4490409982/jobs/7897440985

It fails with a maybe similar error?

That error is related to the case sensitivity in linux in the build.rs file. With a lower case "s" it should continue past that stage.

@borkdude
Copy link
Collaborator

Thanks, I corrected that now and enabled ubuntu again, let's see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants