Open fresh88888888 opened 1 year ago
How is your directory structure?
Same issue in here. I follow to docs and got issue struct MyPair: ^ @"$mymodule"::@MyPair mojo: /__w/modular/modular/KGEN/include/KGEN/MojoParser/DeclResolver.h:164: M::KGEN::LIT::ASTDecl &M::KGEN::LIT::DeclResolver::getDeclForTypeSymbol(mlir::SymbolRefAttr) const: Assertion `it != declForTypeSymbol.end() && "Unknown decl symbol!"' failed. Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes. Stack dump:
fn main(): ^......... let mine = MyPair(2, 4) ...........................<
let mine = MyPair(2, 4)
^......................< Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var
LLVM_SYMBOLIZER_PATH
to point to it): 0 mojo 0x000055f27448c797 1 mojo 0x000055f27448a36e 2 mojo 0x000055f27448ce6f 3 libc.so.6 0x00007fcf23442520 4 libc.so.6 0x00007fcf23496a7c pthread_kill + 300 5 libc.so.6 0x00007fcf23442476 raise + 22 6 libc.so.6 0x00007fcf234287f3 abort + 211 7 libc.so.6 0x00007fcf2342871b 8 libc.so.6 0x00007fcf23439e96 9 mojo 0x000055f27486e59d 10 mojo 0x000055f27486e408 11 mojo 0x000055f27486e72a 12 mojo 0x000055f2748a2f34 13 mojo 0x000055f2748a3abe 14 mojo 0x000055f2748f103d 15 mojo 0x000055f2748b8c9b 16 mojo 0x000055f2748dcd6e 17 mojo 0x000055f2748d4a94 18 mojo 0x000055f2748d4946 19 mojo 0x000055f27488e952 20 mojo 0x000055f27488696e 21 mojo 0x000055f274884ea9 22 mojo 0x000055f274850d3a 23 mojo 0x000055f2748516ab 24 mojo 0x000055f274456d3f 25 mojo 0x000055f274441f60 26 mojo 0x000055f274455c4d 27 mojo 0x000055f27443bb6d 28 libc.so.6 0x00007fcf23429d90 29 libc.so.6 0x00007fcf23429e40 __libc_start_main + 128 30 mojo 0x000055f27443b0fe [1] 18349 IOT instruction (core dumped) mojo main.mojo
OS: Ubuntu 22.04
@fresh88888888 I believe the problem is your filename. The "init" file needs to be surrounded by double-underscores: __init__.mojo
, but your output indicates you did not do that:
~/mojo/demo$ mojo build main.mojo
Included from mypackage/init.mojo:1:
mypackage/mymodule.mojo:1:1: error: unable to locate module 'mymodule'
If you're folllowing the documentation here, then your file structure should look like this:
main.mojo
mypackage
├── __init__.mojo
└── mymodule.mojo
Please verify, thanks.
I'm having the same issue on a M2 Ultra and today's install. My init file does have the double underscores.
Issue description
main.mojo
from mypackage import MyPair fn main(): let mine = MyPair(2, 4) mine.dump()
init.mojo
from .mymodule import MyPair
mymodule.mojo
struct MyPair: var first: Int var second: Int
~/mojo/demo$ mojo build main.mojo
Included from mypackage/init.mojo:1: mypackage/mymodule.mojo:1:1: error: unable to locate module 'mymodule'
Steps to reproduce
struct MyPair: ^ @"$mymodule"::@MyPair mojo: /__w/modular/modular/KGEN/lib/MojoParser/DeclResolver.h:160: M::KGEN::LIT::ASTDecl &M::KGEN::LIT::DeclResolver::getDeclForTypeSymbol(mlir::SymbolRefAttr) const: Assertion `it != declForTypeSymbol.end() && "Unknown decl symbol!"' failed. [2763460:2763460:20230917,145124.125802:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2) [2763460:2763460:20230917,145124.125897:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2) Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes. Stack dump: