On 4/17/24 11:38 AM, Marián Konček wrote:
Nice catch, using it and removing the line "conf.enable_debug" makes
the build use the proper flags. However, I still don't know how to
tell Rake to add a `-Wl,-soname,...` option to each .so separately.
Check out `build_config/default.rb`. It has a lot of commented out
options, one of those is config.linker. You can copy that over and
adjust for Fedora.
Copying a bit of the following linker options into the host-shared.rb
target, I get the -Wl,-z,relro etc from LDFLAGS in. However if something
more is needed I do not know, but you can easily append more flags.
~~~
# Linker settings
conf.linker do |linker|
linker.command = ENV['LD'] || 'gcc'
linker.flags = ENV['LDFLAGS']
linker.link_options = %Q[%{flags} -o "%{outfile}" %{objs} %{libs}]
end
~~~
I'd also note that `readelf --dynamic` for any binary gives: `Shared
library: [/builddir/build/BUILD/mruby-3.3.0/build/host/lib/libmruby.so]`
and the solib has no NAME section on it.
It seems that for the host-shared config, `config.archiver` seems like
the correct place for appending flags for .so files, since it is using GCC.
I spent some time with it, but so far I was unable to fully build
everything properly with also the `-soname`. I got to libmruby_core.so,
but then it started complaining for other artifacts. Probably the -L and
-l options also need adjustments in the linker when it comes to paths
after fixing the path.
It'll likely need more convincing. It seems it is doing a lot in
absolute paths, almost everywhere with everything, including soname data.
To be more in line with the guidelines WRT to the -soname option.
On 16. 4. 2024 18:11, Jarek Prokop wrote:
On 4/16/24 4:16 PM, Marián Konček wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=2275294
I applied downstream changes which build a shared object (upstream
provides no way of doing so, only a static library).
Upstream provides many ways to compile to many targets including
using solibs, have a look:
https://github.com/mruby/mruby/tree/3.3.0/build_config
One can even write it themselves if the upstream ones doesn't cater
to one's needs of their goal.
Definitions in that directory can be referred to in MRUBY_CONFIG
variable used in rake command as the filename without the extension,
for example to build a shared library:`rake MRUBY_CONFIG=host-shared
all `
Though in my small tests some adjustment for the upstream code would
be needed to have it respect Fedora {C,CXX,LD}FLAGS properly, but I
might've missed something.
Regards,
Jarek
--
--
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue