i'm trying to studying in OS development but now have some troubles with SConstruct scripting.
First at all, i'm follow the YT tutorial of OS development.
我正在努力学习操作系统开发,但现在在SConstruct脚本编写方面遇到了一些问题。首先,我遵循了操作系统开发的YT教程。
(Link: https://www.youtube.com/watch?v=ohT59ZfXo6k&list=PLFjM7v6KGMpiH2G-kT781ByCNC_0pKpPN&index=18&ab_channel=nanobyte)
(链接:https://www.youtube.com/watch?v=ohT59ZfXo6k&list=PLFjM7v6KGMpiH2G-kT781ByCNC_0pKpPN&index=18&ab_channel=nanobyte)
And now stopped in the middle of Live, where SCons replace make files.
现在停止在Live的中间,在那里SCons取代了Make文件。
My tool chain: gcc 13.1.0 + binutils 2.39 (during building with .mk i not getting any problems (In-build gcc is 11.4.0 and binutils 2.38))
我的工具链:GCC 13.1.0+binutils 2.39(在.mk构建过程中没有遇到任何问题(内置GCC是11.4.0,binutils是2.38))
SConstruct code taken from source tutorial repository:
https://github.com/nanobyte-dev/nanobyte_os/tree/master
SConstruct代码摘自源代码教程资源库:https://github.com/nanobyte-dev/nanobyte_os/tree/master
All scripts with building are same that I have. But anyway I'm getting an error every time.
所有的脚本与建筑是一样的,我有。但不管怎样,我每次都会收到一个错误。
Main SConstruct script: https://github.com/nanobyte-dev/nanobyte_os/blob/master/SConstruct
主SConstruct脚本:https://github.com/nanobyte-dev/nanobyte_os/blob/master/SConstruct
First stage script: https://github.com/nanobyte-dev/nanobyte_os/blob/master/src/bootloader/stage1/SConscript
第一阶段剧本:https://github.com/nanobyte-dev/nanobyte_os/blob/master/src/bootloader/stage1/SConscript
Second stage script: https://github.com/nanobyte-dev/nanobyte_os/blob/master/src/bootloader/stage2/SConscript
第二阶段剧本:https://github.com/nanobyte-dev/nanobyte_os/blob/master/src/bootloader/stage2/SConscript
Image creation script: https://github.com/nanobyte-dev/nanobyte_os/blob/master/image/SConscript
图像创建脚本:https://github.com/nanobyte-dev/nanobyte_os/blob/master/image/SConscript
I'm getting next error.
我要犯下一个错误了。
> scons: Reading SConscript files ... scons: done reading SConscript
> files. scons: Building targets ... Assembling
> [src/boot_loader/fst_stg/boot.asm] Linking
> [build/i686_debug/fst_stg_fat12/fst_stg.bin] i686-elf-gcc: fatal
> error: '-fuse-linker-plugin', but liblto_plugin.so not found
> compilation terminated. scons: ***
> [build/i686_debug/fst_stg_fat12/fst_stg.bin] Error 1 scons: building
> terminated because of errors.
My ubuntu distro is Ubuntu 22.04.3 LTS
我的Ubuntu发行版是Ubuntu 22.04.3 LTS
Also with locate i can see that liblto_plugin.so in my tool chain:
另外,通过Locate,我可以在我的工具链中看到liblto_plugin.so:
.../tool_chain/gcc-build-13.1.0/gcc/liblto_plugin.so
.../tool_chain/gcc-build-13.1.0/lto-plugin/.libs/liblto_plugin.so
.../tool_chain/i686-elf/libexec/gcc/i686-elf/13.1.0/liblto_plugin.so
UPDATE
更新
I fix this issue by installing another linux distributive (Was Ubuntu -> Now it is Fedora)
我通过安装另一个Linux发行版(以前是Ubuntu->现在是Fedora)修复了这个问题。
更多回答
"have some troubles with SConstruct scripting." - So, do you just build existing project or do you write your own? In the last case you need to put the code into the question post itself. For debug why some compiler/linker option doesn't work you need firstly to determine the exact command line which invokes it. In case of SCons, this can be achieved by setting appropriate *COMSTR
variable to the empty string.
“在SConstruct脚本编写方面遇到一些麻烦。”-那么,你是只构建现有的项目,还是自己编写?在最后一种情况下,您需要将代码放入问题帖子本身。对于调试某些编译器/链接器选项不起作用的原因,您首先需要确定调用它的确切命令行。对于SCons,这可以通过将适当的*COMSTR变量设置为空字符串来实现。
@Tsyvarev Yes, I'm writing my own project, but because I only understand this issue, it is almost no different from the code from the repository. But still, here's a link to what I'm writing: github.com/j1sk1ss/CordellOS.EXMPL I will add *COMSTR and update question post in few hours. Also i think that problem situated in tool chain, and today i will try to recompile project on my macbook.
@Tsyvarev是的,我正在写我自己的项目,但因为我只理解这个问题,所以它与存储库的代码几乎没有什么不同。不过,这里仍然有指向我所写内容的链接:githeb.com/j1sk1ss/CordellOS.EXMPL我将在几个小时内添加*COMSTR并更新问题帖子。我也认为这个问题出在工具链上,今天我会尝试在我的MacBook上重新编译项目。
Glad you got it fixed, though switching distros isn't a common answer :) Something like what you hit is "always a path problem" - you know you have the library file, but the link doesn't find it, that would suggest LIBPATH
isn't set quite right. The SConstruct sets that from toolchainGccLibs
, which is built up to include a middle /lib/
but your locate output shows it in a path including libexec
instead. That was probably your problem. Disabling the override of LINKCOMSTR
, as suggested by @Tsyvarev would probably have let you see.
很高兴你修复了它,尽管切换发行版并不是一个常见的答案:)像你遇到的东西“总是一个路径问题”-你知道你有库文件,但链接找不到它,这表明LIBPATH设置得不是很正确。SConstruct从ToolchainGccLibs设置它,它被构建为包括一个中间/lib/,但是您的定位输出将它显示在包含libexec的路径中。那可能就是你的问题了。按照@Tsyvarev的建议禁用LINKCOMSTR的覆盖可能会让您看到。
@Mats Wichmann Yes, switching to another OS with a complete reinstallation is not the best solution, but anyway I solved the problem and now very happy! In addition, changing the distribution was not difficult for me, since Ubuntu was not my main system...
@Mats Wichmann是的,切换到另一个完全重新安装的操作系统不是最好的解决方案,但无论如何我解决了问题,现在非常高兴!此外,更改发行版对我来说并不困难,因为Ubuntu不是我的主要系统……
我是一名优秀的程序员,十分优秀!