Closed widlarizer closed 1 month ago
I broke this by accident in #4643 by the looks of it, oops. Because init_share_dirname
depends on Python now when ENABLE_PYTHON is defined, Python needs to be initialized first.
This patch should fix it.
diff --git a/kernel/yosys.cc b/kernel/yosys.cc
index 374b07d06..774c7f37d 100644
--- a/kernel/yosys.cc
+++ b/kernel/yosys.cc
@@ -547,12 +547,6 @@ void yosys_setup()
if(already_setup)
return;
already_setup = true;
- init_share_dirname();
- init_abc_executable_name();
-
-#define X(_id) RTLIL::ID::_id = "\\" # _id;
-#include "kernel/constids.inc"
-#undef X
#ifdef WITH_PYTHON
// With Python 3.12, calling PyImport_AppendInittab on an already
@@ -566,6 +560,13 @@ void yosys_setup()
}
#endif
+ init_share_dirname();
+ init_abc_executable_name();
+
+#define X(_id) RTLIL::ID::_id = "\\" # _id;
+#include "kernel/constids.inc"
+#undef X
+
Pass::init_register();
yosys_design = new RTLIL::Design;
yosys_celltypes.setup();
diff --git a/setup.py b/setup.py
index b3a6a9280..b39b579e0 100644
--- a/setup.py
+++ b/setup.py
@@ -76,7 +76,7 @@ class libyosys_so_ext(Extension):
# yosys-abc
yosys_abc_target = os.path.join(pyosys_path, "yosys-abc")
shutil.copy("yosys-abc", yosys_abc_target)
- bext.spawn(["strip", "-S", "yosys-abc"])
+ bext.spawn(["strip", "-S", yosys_abc_target])
# share directory
share_target = os.path.join(pyosys_path, "share")
I'll go ahead and test that wheels are still okay.
Wheels tested and pass with this change, as does this:
./yosys -y <(echo "
import libyosys as ys
d = ys.Design()
ys.run_pass('help', d)
print(sys.path)
print(sys.argv)") -- test argv
Super, super sorry for the inconvenience.
Don't worry about it, I'm just glad it's a quick fix
Fixes #4669. To test the python side this needs the changes from #4671 but even with that I get a segfault with
valgrind ./yosys -y foo
starting with this:@donn any ideas?