mold icon indicating copy to clipboard operation
mold copied to clipboard

Cannot build project using tealr and Mold linker

Open Peepo-Juice opened this issue 1 year ago • 2 comments

If you just create a blank project and add this dependency:

tealr = { version = "0.9", features = [
    "mlua_luajit",
    "mlua_vendored",
    "mlua_send",
    "mlua_macros",
] }
You should get this error:
error[E0463]: can't find crate for 'tealr_derive'
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/mlu.rs:93:9
   |
93 | pub use tealr_derive::MluaFromTo...
   |         ^^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for 'tealr_derive'
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/mlu.rs:100:9
    |
100 | pub use tealr_derive::MluaTealD...
    |         ^^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for 'tealr_derive'
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/mlu.rs:109:9
    |
109 | pub use tealr_derive::MluaUserD...
    |         ^^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for 'tealr_derive'
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/lib.rs:29:9
   |
29 | pub use tealr_derive::ToTypename;
   |         ^^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for 'tealr_derive'
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/lib.rs:36:9
   |
36 | pub use tealr_derive::compile_in...
   |         ^^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for 'tealr_derive'
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/lib.rs:42:9
   |
42 | pub use tealr_derive::embed_comp...
   |         ^^^^^^^^^^^^ can't find crate

error[E0432]: unresolved imports 'crate::ToTypename', 'crate::ToTypename', 'crate::ToTypename', 'crate::ToTypename', 'crate::ToTypename', 'crate::ToTypename', 'crate::ToTypename', 'crate::ToTypename', 'crate::ToTypename', 'crate::ToTypename', 'crate::ToTypename'
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/mlu/teal_data.rs:1:5
   |
1  | use crate::ToTypename;
   |     ^^^^^^^^^^^^^^^^^
   |
  ::: /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/mlu/teal_data_fields.rs:3:5
   |
3  | use crate::ToTypename;
   |     ^^^^^^^^^^^^^^^^^
   |
  ::: /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/mlu/teal_data_methods.rs:5:29
   |
5  | ...tiValue, ToTypename};
   |             ^^^^^^^^^^
   |
  ::: /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/mlu/typed_function.rs:5:29
   |
5  | ...tiValue, ToTypename};
   |             ^^^^^^^^^^
   |
  ::: /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/mlu/user_data_proxy.rs:5:45
   |
5  | ...nerator, ToTypename, Type, Ty...
   |             ^^^^^^^^^^
   |
  ::: /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/mlu/user_data_wrapper.rs:9:62
   |
9  | ...tiValue, ToTypename, TypeName};
   |             ^^^^^^^^^^
   |
  ::: /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/export_instance.rs:3:54
   |
3  | ...dOfType, ToTypename, TypeName};
   |             ^^^^^^^^^^
   |
  ::: /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/teal_multivalue.rs:3:46
   |
3  | ...dOfType, ToTypename, Type};
   |             ^^^^^^^^^^
   |
  ::: /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_generator.rs:32:71
   |
32 | ...amePart, ToTypename, Type, Ty...
   |             ^^^^^^^^^^
   |
  ::: /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_representation.rs:1:59
   |
1  | ...gleType, ToTypename, Type};
   |             ^^^^^^^^^^
   |
  ::: /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_walker.rs:3:42
   |
3  | ...amePart, ToTypename, Type, Ty...
   |             ^^^^^^^^^^

error: cannot find attribute 'tealr' in this scope
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/exported_function.rs:23:5
   |
23 |     tealr(tealr_name = crate)
   |     ^^^^^

error: cannot find attribute 'tealr' in this scope
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/exported_function.rs:32:9
   |
32 |         tealr(remote = X)
   |         ^^^^^

error: cannot find attribute 'tealr' in this scope
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/teal_multivalue.rs:17:5
   |
17 |     tealr(tealr_name = crate)
   |     ^^^^^

error: cannot find attribute 'tealr' in this scope
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/teal_multivalue.rs:23:9
   |
23 |         tealr(remote =  String))]
   |         ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_generator.rs:135:5
    |
135 |     tealr(tealr_name = crate)
    |     ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_generator.rs:142:9
    |
142 | ...   tealr(remote =  RecordGen...
    |       ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_generator.rs:171:5
    |
171 |     tealr(tealr_name = crate)
    |     ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_generator.rs:178:5
    |
178 |     tealr(remote = V)
    |     ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_generator.rs:232:5
    |
232 |     tealr(tealr_name = crate)
    |     ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_generator.rs:243:5
    |
243 |     tealr(remote = V)
    |     ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_generator.rs:286:5
    |
286 |     tealr(tealr_name = crate)
    |     ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_generator.rs:297:9
    |
297 |         tealr(remote = V)
    |         ^^^^^

error: cannot find attribute 'tealr' in this scope
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_representation.rs:44:5
   |
44 |     tealr(tealr_name = crate)
   |     ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_representation.rs:138:5
    |
138 |     tealr(tealr_name = crate)
    |     ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_representation.rs:147:9
    |
147 |         tealr(remote =  String))]
    |         ^^^^^

error: cannot find attribute 'tealr' in this scope
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_walker.rs:19:5
   |
19 |     tealr(tealr_name = crate)
   |     ^^^^^

error: cannot find attribute 'tealr' in this scope
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_walker.rs:25:9
   |
25 |         tealr(remote =  String))]
   |         ^^^^^

error: cannot find attribute 'tealr' in this scope
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_walker.rs:30:9
   |
30 |         tealr(remote =  V))]
   |         ^^^^^

error: cannot find attribute 'tealr' in this scope
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_walker.rs:52:5
   |
52 |     tealr(tealr_name = crate)
   |     ^^^^^

error: cannot find attribute 'tealr' in this scope
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/type_walker.rs:73:5
   |
73 |     tealr(tealr_name = crate)
   |     ^^^^^

error: cannot find attribute 'tealr' in this scope
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/lib.rs:62:5
   |
62 |     tealr(tealr_name = crate)
   |     ^^^^^

error: cannot find attribute 'tealr' in this scope
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/lib.rs:68:5
   |
68 |     tealr(remote =  String))]
   |     ^^^^^

error: cannot find attribute 'tealr' in this scope
  --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/lib.rs:93:5
   |
93 |     tealr(tealr_name = crate)
   |     ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/lib.rs:113:5
    |
113 |     tealr(tealr_name = crate)
    |     ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/lib.rs:133:5
    |
133 |     tealr(tealr_name = crate)
    |     ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/lib.rs:153:5
    |
153 |     tealr(tealr_name = crate)
    |     ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/lib.rs:159:9
    |
159 |         tealr(remote =  Type))]
    |         ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/lib.rs:164:9
    |
164 |         tealr(remote =  Type))]
    |         ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/lib.rs:182:5
    |
182 |     tealr(tealr_name = crate)
    |     ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/lib.rs:196:13
    |
196 | ...   tealr(remote =  NewTypeAr...
    |       ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/lib.rs:203:13
    |
203 | ...   tealr(remote =  Type))]
    |       ^^^^^

error: cannot find attribute 'tealr' in this scope
   --> /home/peepo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tealr-0.9.1/src/lib.rs:212:13
    |
212 | ...   tealr(remote =  NewTypeAr...
    |       ^^^^^

Some errors have detailed explanations: E0432, E0463.
For more information about an error, try 'rustc --explain E0432'.
error: could not compile 'tealr' (lib) due to 39 previous errors

Hunting down for the cause, i ran into this: https://github.com/rust-lang/rust/pull/114470 . So I disabled Mold to test it out, and it builds fine! The problem is that I need Mold's performance. 1.5seconds compile time vs. 15 seconds. Yikes! I'm too spoiled to go back to this, lol.

Peepo-Juice avatar May 11 '24 15:05 Peepo-Juice

I have no idea about this bug, since it's a compile failure and not a link failure. Are you really sure that mold is the cause of the issue?

rui314 avatar May 12 '24 01:05 rui314

I have no idea about this bug, since it's a compile failure and not a link failure. Are you really sure that mold is the cause of the issue?

To be honest, im not 100% sure. Both lld and mold dont work, only the default linker. I cant tell which compiler gets used cus im a noob, so I'm not sure if the compiler is being changed whenever i comment out the lines in the config.toml, which would give me a red herring.

Peepo-Juice avatar May 12 '24 01:05 Peepo-Juice