fluent / fluent-package-builder

td-agent (Fluentd) Building and Packaging System
Apache License 2.0
21 stars 23 forks source link

.package_note-fluent-package-5.0.1-1.amzn2023.x86_64.ld is no exist #590

Open wdxal opened 9 months ago

wdxal commented 9 months ago

OS:AmaonLinux2023 Version:5.0.1-1(LTS) Install: Step 1: curl -fsSL https://toolbelt.treasuredata.com/sh/install-amazon2023-fluent-package5-lts.sh | sh Step 2: fluent-gem install mysql2

Error: $ cat /opt/fluent/lib/ruby/gems/3.2.0/extensions/x86_64-linux/3.2.0/mysql2-0.5.5/mkmf.log LD_LIBRARY_PATH=.:/opt/fluent/lib "gcc -o conftest -I/opt/fluent/include/ruby-3.2.0/x86_64-linux -I/opt/fluent/include/ruby-3.2.0/ruby/backward -I/opt/fluent/include/ruby-3.2.0 -I. -O2 -ftree-vectorize -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC conftest.c -L. -L/opt/fluent/lib -Wl,-rpath,/opt/fluent/lib -L. -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-dT,/root/rpmbuild/BUILD/fluent-package-5.0.1/.package_note-fluent-package-5.0.1-1.amzn2023.x8664.ld -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -m64 -Wl,-rpath,/opt/fluent/lib -L/opt/fluent/lib -lruby -lm -lpthread -lc" **/usr/bin/ld: cannot open linker script file /root/rpmbuild/BUILD/fluent-package-5.0.1/.package_note-fluent-package-5.0.1-1.amzn2023.x8664.ld: No such file or directory collect2: error: ld returned 1 exit status checked program was: / begin / 1: #include "ruby.h" 2: 3: int main(int argc, char argv) 4: { 5: return !!argv[argc]; 6: } / end /

Q: From the error message, the file(.package_note-fluent-package-5.0.1-1.amzn2023.x86_64.ld) is required when installing the mysql2 plug-in. Is this file created when fluent-package is installed?

kenhys commented 8 months ago

Is this file created when fluent-package is installed?

No, fluent-package doesn't install such a file.

Reported problem was reproducible. :thinking:

rm-you commented 3 months ago

I am having almost exactly the same problem. Amazon Linux 2023 Linux ip-10-200-0-210.ec2.internal 6.1.79-99.167.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 12 18:15:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

$ cat /opt/fluent/lib/ruby/gems/3.2.0/extensions/x86_64-linux/3.2.0/msgpack-1.3.3/mkmf.log LD_LIBRARY_PATH=.:/opt/fluent/lib "gcc -o conftest -I/opt/fluent/include/ruby-3.2.0/x86_64-linux -I/opt/fluent/include/ruby-3.2.0/ruby/backward -I/opt/fluent/include/ruby-3.2.0 -I. -O2 -ftree-vectorize -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC conftest.c -L. -L/opt/fluent/lib -Wl,-rpath,/opt/fluent/lib -L. -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-dT,/root/rpmbuild/BUILD/fluent-package-5.0.2/.package_note-fluent-package-5.0.2-1.amzn2023.x86_64.ld -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -m64 -Wl,-rpath,/opt/fluent/lib -L/opt/fluent/lib -lruby -lm -lpthread -lc" /usr/bin/ld: cannot open linker script file /root/rpmbuild/BUILD/fluent-package-5.0.2/.package_note-fluent-package-5.0.2-1.amzn2023.x86_64.ld: No such file or directory collect2: error: ld returned 1 exit status checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main(int argc, char **argv) 4: { 5: return !!argv[argc]; 6: } /* end */

Can be reproduced for me by installing anything that requires msgpack (or just installing msgpack). Probably other things too, that's just my repro case. This whole directory structure starting with /root/rpmbuild does not exist, probably something hardcoded somewhere in an install script?

ybandai-radstate commented 1 week ago

I am also having the same symptoms.

# uname -a
Linux moratame-prd-batch 6.1.82-99.168.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Mar 25 17:11:31 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

# fluent-gem install mysql2
Building native extensions. This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

    current directory: /opt/fluent/lib/ruby/gems/3.2.0/gems/mysql2-0.5.6/ext/mysql2
/opt/fluent/bin/ruby extconf.rb
checking for rb_absint_size()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/opt/fluent/bin/$(RUBY_BASE_NAME)
/opt/fluent/lib/ruby/3.2.0/mkmf.rb:490:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.

        from /opt/fluent/lib/ruby/3.2.0/mkmf.rb:583:in `try_link0'
        from /opt/fluent/lib/ruby/3.2.0/mkmf.rb:601:in `try_link'
        from /opt/fluent/lib/ruby/3.2.0/mkmf.rb:812:in `try_func'
        from /opt/fluent/lib/ruby/3.2.0/mkmf.rb:1116:in `block in have_func'
        from /opt/fluent/lib/ruby/3.2.0/mkmf.rb:989:in `block in checking_for'
        from /opt/fluent/lib/ruby/3.2.0/mkmf.rb:354:in `block (2 levels) in postpone'
        from /opt/fluent/lib/ruby/3.2.0/mkmf.rb:324:in `open'
        from /opt/fluent/lib/ruby/3.2.0/mkmf.rb:354:in `block in postpone'
        from /opt/fluent/lib/ruby/3.2.0/mkmf.rb:324:in `open'
        from /opt/fluent/lib/ruby/3.2.0/mkmf.rb:350:in `postpone'
        from /opt/fluent/lib/ruby/3.2.0/mkmf.rb:988:in `checking_for'
        from /opt/fluent/lib/ruby/3.2.0/mkmf.rb:1115:in `have_func'
        from extconf.rb:34:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /opt/fluent/lib/ruby/gems/3.2.0/extensions/x86_64-linux/3.2.0/mysql2-0.5.6/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /opt/fluent/lib/ruby/gems/3.2.0/gems/mysql2-0.5.6 for inspection.
Results logged to /opt/fluent/lib/ruby/gems/3.2.0/extensions/x86_64-linux/3.2.0/mysql2-0.5.6/gem_make.out
# cat /opt/fluent/lib/ruby/gems/3.2.0/extensions/x86_64-linux/3.2.0/mysql2-0.5.6/mkmf.log
LD_LIBRARY_PATH=.:/opt/fluent/lib "gcc -o conftest -I/opt/fluent/include/ruby-3.2.0/x86_64-linux -I/opt/fluent/include/ruby-3.2.0/ruby/backward -I/opt/fluent/include/ruby-3.2.0 -I.    -O2 -ftree-vectorize -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC conftest.c  -L. -L/opt/fluent/lib -Wl,-rpath,/opt/fluent/lib -L. -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -Wl,-dT,/root/rpmbuild/BUILD/fluent-package-5.0.3/.package_note-fluent-package-5.0.3-1.amzn2023.x86_64.ld -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed  -m64   -Wl,-rpath,/opt/fluent/lib -L/opt/fluent/lib -lruby  -lm -lpthread  -lc"
/usr/bin/ld: cannot open linker script file /root/rpmbuild/BUILD/fluent-package-5.0.3/.package_note-fluent-package-5.0.3-1.amzn2023.x86_64.ld: そのようなファイルやディレクトリはありません
collect2: エラー: ld はステータス 1 で終了しました
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

In addition, I was able to install gem install mysql2 from gem install fluentd. I installed dnf install mysql-devel to solve this, but it doesn't seem to affect fluent-gem.

ybandai-radstate commented 1 week ago

I'm curious about the following differences. Is it possible to add the -I/usr/share/ruby3.2-rubygems specification somehow?

-- GET https://index.rubygems.org/gems/mysql2-0.5.6.gem
++ GET https://index.rubygems.org/quick/Marshal.4.8/mysql2-0.5.6.gemspec.rz
-- ["/usr/bin/ruby3.2", "-I/usr/share/ruby3.2-rubygems", "extconf.rb"]
++ ["/opt/fluent/bin/ruby", "extconf.rb"]

success

# gem install mysql2 -V
HEAD https://index.rubygems.org/
200 OK
GET https://index.rubygems.org/info/mysql2
200 OK
Downloading gem mysql2-0.5.6.gem
GET https://index.rubygems.org/gems/mysql2-0.5.6.gem
Fetching mysql2-0.5.6.gem
200 OK
/usr/local/share/ruby3.2-gems/gems/mysql2-0.5.6/CHANGELOG.md
... snip...
/usr/local/share/ruby3.2-gems/gems/mysql2-0.5.6/support/ruby_enc_to_mysql.rb
Building native extensions. This could take a while...
current directory: /usr/local/share/ruby3.2-gems/gems/mysql2-0.5.6/ext/mysql2
["/usr/bin/ruby3.2", "-I/usr/share/ruby3.2-rubygems", "extconf.rb"]
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_gc_mark_movable()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enc_interned_str() in ruby.h... yes
-----
Using mysql_config at /usr/bin/mysql_config
-----

error

# fluent-gem install mysql2 -V
HEAD https://index.rubygems.org/
200 OK
GET https://index.rubygems.org/info/mysql2
200 OK
GET https://index.rubygems.org/quick/Marshal.4.8/mysql2-0.5.6.gemspec.rz
200 OK
/opt/fluent/lib/ruby/gems/3.2.0/gems/mysql2-0.5.6/CHANGELOG.md
...snip...
/opt/fluent/lib/ruby/gems/3.2.0/gems/mysql2-0.5.6/support/ruby_enc_to_mysql.rb
Building native extensions. This could take a while...
current directory: /opt/fluent/lib/ruby/gems/3.2.0/gems/mysql2-0.5.6/ext/mysql2
["/opt/fluent/bin/ruby", "extconf.rb"]
checking for rb_absint_size()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.