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

Undefined symbols for architecture arm64 #7447

Open
BlowaterNostr opened this issue Jan 1, 2025 · 4 comments
Open

Undefined symbols for architecture arm64 #7447

BlowaterNostr opened this issue Jan 1, 2025 · 4 comments

Comments

@BlowaterNostr
Copy link

RUST_BACKTRACE=full roc build examples/path.roc
Undefined symbols for architecture arm64:
  "_roc__mainForHost_0_caller", referenced from:
      __ZN4host16call_the_closure17h961bd58618d767f2E in macos-arm64.o
  "_roc__mainForHost_1_exposed_generic", referenced from:
      _rust_main in macos-arm64.o
      __ZN7roc_app7aarch6411mainForHost17h5aa87a4c780e1f3bE in macos-arm64.o
  "_roc__mainForHost_1_exposed_size", referenced from:
      _rust_main in macos-arm64.o
  "_roc_fx_path_type", referenced from:
      _roc_fx_path_type_fastcc_wrapper in roc_app5XUBhi.o
  "_roc_fx_stderr_line", referenced from:
      _roc_fx_stderr_line_fastcc_wrapper in roc_app5XUBhi.o
  "_roc_fx_stdout_line", referenced from:
      _roc_fx_stdout_line_fastcc_wrapper in roc_app5XUBhi.o
ld: symbol(s) not found for architecture arm64
examples/path: No such file or directory
thread 'main' panicked at crates/compiler/build/src/program.rs:1037:17:
not yet implemented: linker failed with exit code Some(1)
stack backtrace:
   0:        0x101578674 - __mh_execute_header
   1:        0x100a31d00 - __mh_execute_header
   2:        0x1015746f0 - __mh_execute_header
   3:        0x10157846c - __mh_execute_header
   4:        0x101579b88 - __mh_execute_header
   5:        0x101579884 - __mh_execute_header
   6:        0x10157a180 - __mh_execute_header
   7:        0x101579f5c - __mh_execute_header
   8:        0x101578b0c - __mh_execute_header
   9:        0x101579cf0 - __mh_execute_header
  10:        0x104e5ccf8 - __ZN4llvm15SmallVectorBaseIyE8grow_podEPvmm
  11:        0x100be95c4 - __mh_execute_header
  12:        0x100be64c0 - __mh_execute_header
  13:        0x100cd6584 - __mh_execute_header
  14:        0x100bb14b8 - __mh_execute_header
  15:        0x100ba22ac - __mh_execute_header
  16:        0x100ba22d0 - __mh_execute_header
  17:        0x10156c800 - __mh_execute_header
  18:        0x100bb5200 - __mh_execute_header
@Anton-4
Copy link
Collaborator

Anton-4 commented Jan 1, 2025

Hi @BlowaterNostr,
This appears to be about the basic-cli path example.

I'm not sure if you want to build the platform from source or not, if not use this:

app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.17.0/lZFLstMUCUvd5bjnnpYromZJXkQUrdhbva4xdBInicE.tar.br" }

import pf.Stdout
import pf.Path

main = run |> Task.onErr \err -> crash "ERROR: $(Inspect.toStr err)"

run =
    path = Path.fromStr "path.roc"
    a = Path.isFile! path
    b = Path.isDir! path
    c = Path.isSymLink! path
    d = Path.type! path

    Stdout.line "isFile: $(Inspect.toStr a) isDir: $(Inspect.toStr b) isSymLink: $(Inspect.toStr c) type: $(Inspect.toStr d)"

if you do want to build basic-cli from source:

# In the basic-cli folder:
git checkout 0.17.0
./jump-start.sh
roc build.roc --linker=legacy

If I made an incorrect assumption, seeing your full examples/path.roc and any commands you ran before this one would be helpful.

I'll add a nice comment that links to the build instructions in each example.

@Anton-4
Copy link
Collaborator

Anton-4 commented Jan 1, 2025

I've made some improvements to the basic-cli examples:
roc-lang/basic-cli@f2825da
roc-lang/basic-cli#300

Feel free to provide additional suggestions for improvements.

@BlowaterNostr
Copy link
Author

BlowaterNostr commented Jan 2, 2025

@Anton-4 the code you pasted works but I get a new error:

app [main!] {
    pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.17.0/lZFLstMUCUvd5bjnnpYromZJXkQUrdhbva4xdBInicE.tar.br",
    json: "https://github.com/lukewilliamboswell/roc-json/releases/download/0.11.0/z45Wzc-J39TLNweQUoLw3IGZtkQiEN3lTBv3BXErRjQ.tar.br",
}

import pf.Http
import pf.Stdout
import json.Json

# HTTP GET request with easy decoding to json
main! = \_args ->

    # Easy decoding/deserialization of { "foo": "something" } into a Roc var
    { foo } = try Http.get! "http://localhost:8000" Json.utf8
    # If you want to see an example of the server side, see basic-cli/ci/rust_http_server/src/main.rs

    Stdout.line! "The json I received was: { foo: \"$(foo)\" }"

got

✗ roc run http-get-json.roc
An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: <https://github.com/roc-lang/roc/issues/new/choose>
a Expr::TrySuffix expression was not completely removed in desugar_value_def_suffixed
Location: crates/compiler/can/src/expr.rs:1254:40

@lukewilliamboswell
Copy link
Collaborator

@BlowaterNostr -- you've posted an example using the older release of basic-cli. The new (still pre-release) is required if you want to use purity inference.

This works for me.... if I have a server running locally

app [main!] {
    pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br",
    json: "https://github.com/lukewilliamboswell/roc-json/releases/download/0.11.0/z45Wzc-J39TLNweQUoLw3IGZtkQiEN3lTBv3BXErRjQ.tar.br",
}

import pf.Http
import pf.Stdout
import json.Json

# HTTP GET request with easy decoding to json
main! = \_args ->

    # Easy decoding/deserialization of { "foo": "something" } into a Roc var
    { foo } = try Http.get! "http://localhost:8000" Json.utf8
    # If you want to see an example of the server side, see basic-cli/ci/rust_http_server/src/main.rs

    Stdout.line! "The json I received was: { foo: \"$(foo)\" }"

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

No branches or pull requests

3 participants