Dne 26.7.2018 v 15:11 Mamoru TASAKA napsal(a):
> Sending to mailing list:
>
> Vít Ondruch wrote on 07/26/2018 09:18 PM:
>>
>>
>> Dne 26.7.2018 v 13:40 Mamoru TASAKA napsal(a):
>>> Vít Ondruch wrote on 07/26/2018 06:28 PM:
>>>> Hi,
>>>>
>>>> Ruby currently fails to build due to removal of GCC from buildroot.
>>>> The
>>>> build failure is due to one test case [1] which fails now and which
>>>> should be probably fixed to pass even without GCC.
>>>>
>>>> However, digging into this, I wonder if Ruby should have "BR: gcc" or
>>>> "BR: gcc-c++". The thing is, that Ruby is checking presence of C++
>>>> compiler during its configuration phase.
>>>
>>> ruby-libs contains:
>>>
>>>
>>> /usr/lib64/ruby/rbconfig.rb:180:  CONFIG["CXXFLAGS"] = "-O2 -g -pipe
>>> -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
>>> -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong
>>> -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
>>> -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic
>>> -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection"
>>> /usr/lib64/ruby/rbconfig.rb:181:  CONFIG["CXX"] = "g++"
>>> /usr/share/ruby/mkmf.rb:74:  CXX_EXT = %w[cc mm cxx cpp]
>>> /usr/share/ruby/mkmf.rb:76:    CXX_EXT.concat(%w[C])
>>> /usr/share/ruby/mkmf.rb:82:  SRC_EXT = C_EXT + CXX_EXT
>>> /usr/share/ruby/mkmf.rb:1830:        $CXXFLAGS += " " << cflags
>>> /usr/share/ruby/mkmf.rb:1963:CXX = #{CONFIG['CXX']}
>>> /usr/share/ruby/mkmf.rb:1984:CXXFLAGS = $(CCDLFLAGS) #$CXXFLAGS
>>> $(ARCH_FLAG)
>>> /usr/share/ruby/mkmf.rb:2429:    command = compile_command %
>>> COMPILE_CXX
>>> /usr/share/ruby/mkmf.rb:2430:    asm_command =
>>> compile_command.sub(/compiling/, 'translating') % ASSEMBLE_CXX
>>> /usr/share/ruby/mkmf.rb:2431:    CXX_EXT.each do |e|
>>> /usr/share/ruby/mkmf.rb:2458:    if
>>> srcs.any?(&%r"\.(?:#{CXX_EXT.join('|')})\z".method(:===))
>>> /usr/share/ruby/mkmf.rb:2510:    $CXXFLAGS = (with_config("cxxflags",
>>> arg_config("CXXFLAGS", config["CXXFLAGS"]))||'').dup
>>> /usr/share/ruby/mkmf.rb:2666:  COMPILE_CXX =
>>> config_string('COMPILE_CXX') || '$(CXX) $(INCFLAGS) $(CPPFLAGS)
>>> $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<'
>>> /usr/share/ruby/mkmf.rb:2676:  ASSEMBLE_CXX =
>>> config_string('ASSEMBLE_CXX') || COMPILE_CXX.sub(/(?<=\s)-c(?=\s)/,
>>> '-S')
>>>
>>> So it is quite reasonable that ruby compilation checks
>>> CXX compiler.
>>
>> The ticket [1] I referenced even linked to commit which introduced some
>> of these lines [10]. However, this says nothing about usage of this
>> code. Neither the ruby-dev discussion provides more information [11].
>>
>> So is there some extension library which uses results of these checks?
>> Frankly I'd be much happier if this was removed from upstream, since why
>> special case C++, but not Rust for example. I am looking for some
>> evidence ....
>>
>
> https://koji.fedoraproject.org/koji/buildinfo?buildID=1124633
> https://github.com/knu/ruby-unf_ext/blob/master/ext/unf_ext/extconf.rb#L31
>

Ups, sorry, I forgot test it prior issuing the latest build (I was happy
enough that I workarounded the OpenSSL test failures) :(

However testing the build now, rubygem-unf_ext builds just fine. "gem
install unf_ext" works fine as well. Also, the RbConfig contains the CXX
variables referred in the extconf.rb:

~~~
$ rpm -q ruby-libs
ruby-libs-2.5.1-94.fc29.x86_64

$ ruby -r rbconfig -e "RbConfig::CONFIG.each {|c| p c}" | grep CXX
["configure_args", " '--build=x86_64-redhat-linux-gnu'
'--host=x86_64-redhat-linux-gnu' '--program-prefix='
'--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr'
'--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
'--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64'
'--libexecdir=/usr/libexec' '--localstatedir=/var'
'--sharedstatedir=/var/lib' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--with-rubylibprefix=/usr/share/ruby'
'--with-archlibdir=/usr/lib64' '--with-rubyarchprefix=/usr/lib64/ruby'
'--with-sitedir=/usr/local/share/ruby/site_ruby'
'--with-sitearchdir=/usr/local/lib64/ruby/site_ruby'
'--with-vendordir=/usr/share/ruby/vendor_ruby'
'--with-vendorarchdir=/usr/lib64/ruby/vendor_ruby'
'--with-rubyhdrdir=/usr/include' '--with-rubyarchhdrdir=/usr/include'
'--with-sitearchhdrdir=$(sitehdrdir)/$(arch)'
'--with-vendorarchhdrdir=$(vendorhdrdir)/$(arch)'
'--with-rubygemsdir=/usr/share/rubygems' '--with-ruby-pc=ruby.pc'
'--with-compress-debug-sections=no' '--disable-rpath' '--enable-shared'
'--with-ruby-version=' '--enable-multiarch'
'--with-prelude=./abrt_prelude.rb' 'build_alias=x86_64-redhat-linux-gnu'
'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
'LDFLAGS=-Wl,-z,relro   -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld' 'CXXFLAGS=-O2 -g -pipe
-Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'"]
["CXXFLAGS", "-O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions
-fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection"]
["CXX", "g++"]
["CFLAGS", "-O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions
-fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-fPIC"]
~~~

Actually, this makes me even less worried, because for RPM build, we can
use %{optflags} and we are relatively safe here, but I was more worried
about pure "gem install" scenario.


Vít
_______________________________________________
ruby-sig mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]/message/WSH7MFZPPV5GTCYSYPKJW7EMUJYGS5J6/

Reply via email to