beyondsociety / ibox

Ibox Operating System
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

-Wl,--allow-shlib-undefined being added to linking options when building Ibox with meson #3

Open beyondsociety opened 4 years ago

beyondsociety commented 4 years ago

For some reason, the meson build system adds -Wl,--allow-shlib-undefined to the command-line when linking. Since this is for osdev, there shouldn't be any extra options added to the build and needs to be removed. Looking through the meson manual there doesn't seem to be a way to remove it like I was able to with the as_needed and lundef build options. Not sure if there is a way to add my own configure options to meson to disable this command. Will need to do some more research to see what is causing this and if there is a way to turn this off when building ibox.

beyondsociety commented 4 years ago

Still looking into this issue, not sure if it is an issue with meson or my compilers pulling in this compile option. I will need to create a minimal test case to narrow down the issue before I submit a fix ticket to meson.

beyondsociety commented 4 years ago

I stripped down my code to just an assembly stub that then gets linked together as an executable so it can be booted by grub and had the ninja backend that gets called from meson to show how the code is getting compiled/linked together. If I don't add any default build options to meson, it calls --as_needed and --no_undefined which can be turned off with b_asneeded and b_lundef in the meson.build file. If these two options are passed to meson, it then adds --allow-shlib-undefined which has no builtin option to disable. Looking through the meson code, in compilers.py under the code for apples bitcode, it calls allow-shlib-undefined which then passes the linker option in linkers.py.

I am not sure why this gets set as default when I don't have any shared libraries compiled in, only libgcc which is a static library needed for my cross-compiled gcc. I was able to modify the meson code and add a base default option to toggle it off like the two other base options that get turned on by default. I plan to submit a issue ticket to meson about it and the way I was able to fix it along with other options to solve this issue, hopefully it gets fixed. There is also a way to add your own options to my code in meson, but haven't figure out how to use it yet and don't know if it is a valuable solution to the issue at hand.

beyondsociety commented 4 years ago

Played around with the meson-options and got it to finally work, it will add an extra option to the code but won't turn off this issue since it is builtin to the meson code. The only way to turn it off it modify the code or add an optional b_option to toggle it off. I sent an issue ticket to meson and created a minimal example repo for the issue, now I have to wait to get it fixed and if they want I can submit a pull request with the modified code to turn it off.