build/Makefile:1458: recipe for target 'build/ruby.unit.so' failed

Igor Sysoev igor at sysoev.ru
Mon Apr 2 16:42:30 UTC 2018


> On 2 Apr 2018, at 19:27, Yury Kotlyarov <yury.kotlyarov at gmail.com> wrote:
> 
> what's wrong with PIE option btw?

PIE creates executable binary instead of shared library (ruby.unit.so).
This is a reason why linker links crt1.o (executable start function) and tries
to find main() function which presents in executable binaries:

/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'


-- 
Igor Sysoev
http://nginx.com

> 
> С уважением,
> Котляров Юрий
> +7 965 823 3843
> 
> Спорт Автоматика
> http://sportautomatics.ru
> https://www.facebook.com/sportautomatics
> https://vk.com/sportautomatics
> 
> 2018-04-02 11:36 GMT-04:00 Max Romanov <max.romanov at nginx.com>:
> According to log from https://pastebin.com/8e1LcB2D, Unit configured using this command:
> 
> # ./configure --prefix=/usr --state=/var/lib/unit --control=unix:/var/run/control.unit.sock --pid=/var/run/unit.pid --log=/var/log/unit.log --tests --modules=/usr/lib/unit/modules --cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/unit-0.7/pkg/deb/debuild/unit-0.7=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --ld-opt='-Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie’
> 
> Avoid using ‘-pie’ in --ld-opt and Ruby shared library will be linked without errors.
> 
> Best regards,
> Max Romanov
> 
>> On 1 Apr 2018, at 03:48 , Yury Kotlyarov <yury.kotlyarov at gmail.com> wrote:
>> 
>> Hey again,
>> 
>> the previous issue with the ruby was fixed by rebuilding ruby with shared:
>> 
>> RUBY_CONFIGURE_OPTS=--enable-shared rbenv install 2.5.0
>> 
>> But I still can't build ruby module:
>> 
>> # make all
>> 
>> Gives:
>> 
>> /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
>> (.text+0x20): undefined reference to `main'
>> build/src/ruby/nxt_ruby-ruby.o: In function `nxt_ruby_head_send_part':
>> /root/projects/unit/src/ruby/nxt_ruby.c:717: undefined reference to `nxt_app_msg_write_raw'
>> /root/projects/unit/src/ruby/nxt_ruby.c:723: undefined reference to `nxt_app_msg_write_raw'
>> /root/projects/unit/src/ruby/nxt_ruby.c:729: undefined reference to `nxt_app_msg_write_raw'
>> build/src/ruby/nxt_ruby-ruby.o: In function `nxt_ruby_rack_result_body_file_write':
>> /root/projects/unit/src/ruby/nxt_ruby.c:796: undefined reference to `nxt_file_open'
>> /root/projects/unit/src/ruby/nxt_ruby.c:806: undefined reference to `nxt_file_info'
>> /root/projects/unit/src/ruby/nxt_ruby.c:820: undefined reference to `nxt_file_read'
>> /root/projects/unit/src/ruby/nxt_ruby.c:830: undefined reference to `nxt_app_msg_write_raw'
>> /root/projects/unit/src/ruby/nxt_ruby.c:846: undefined reference to `nxt_file_close'
>> /root/projects/unit/src/ruby/nxt_ruby.c:840: undefined reference to `nxt_file_close'
>> build/src/ruby/nxt_ruby-ruby.o: In function `nxt_ruby_rack_result_body_each':
>> /root/projects/unit/src/ruby/nxt_ruby.c:861: undefined reference to `nxt_app_msg_write_raw'
>> build/src/ruby/nxt_ruby-ruby.o: In function `nxt_ruby_read_add_env':
>> /root/projects/unit/src/ruby/nxt_ruby.c:530: undefined reference to `nxt_app_msg_read_str'
>> /root/projects/unit/src/ruby/nxt_ruby.c:530: undefined reference to `nxt_app_msg_read_str'
>> build/src/ruby/nxt_ruby-ruby.o: In function `nxt_ruby_read_request':
>> /root/projects/unit/src/ruby/nxt_ruby.c:408: undefined reference to `nxt_app_msg_read_str'
>> /root/projects/unit/src/ruby/nxt_ruby.c:413: undefined reference to `nxt_app_msg_read_size'
>> build/src/ruby/nxt_ruby-ruby.o: In function `nxt_ruby_read_add_env':
>> /root/projects/unit/src/ruby/nxt_ruby.c:530: undefined reference to `nxt_app_msg_read_str'
>> /root/projects/unit/src/ruby/nxt_ruby.c:530: undefined reference to `nxt_app_msg_read_str'
>> /root/projects/unit/src/ruby/nxt_ruby.c:530: undefined reference to `nxt_app_msg_read_str'
>> build/src/ruby/nxt_ruby-ruby.o: In function `nxt_ruby_read_request':
>> /root/projects/unit/src/ruby/nxt_ruby.c:454: undefined reference to `nxt_app_msg_read_str'
>> build/src/ruby/nxt_ruby-ruby.o: In function `nxt_ruby_read_add_env':
>> /root/projects/unit/src/ruby/nxt_ruby.c:530: undefined reference to `nxt_app_msg_read_str'
>> build/src/ruby/nxt_ruby-ruby.o:/root/projects/unit/src/ruby/nxt_ruby.c:530: more undefined references to `nxt_app_msg_read_str' follow
>> build/src/ruby/nxt_ruby-ruby.o: In function `nxt_ruby_read_request':
>> /root/projects/unit/src/ruby/nxt_ruby.c:515: undefined reference to `nxt_app_msg_read_size'
>> build/src/ruby/nxt_ruby-ruby.o: In function `nxt_ruby_write':
>> /root/projects/unit/src/ruby/nxt_ruby.c:603: undefined reference to `nxt_app_msg_write_raw'
>> /root/projects/unit/src/ruby/nxt_ruby.c:603: undefined reference to `nxt_app_msg_write_raw'
>> /root/projects/unit/src/ruby/nxt_ruby.c:603: undefined reference to `nxt_app_msg_write_raw'
>> /root/projects/unit/src/ruby/nxt_ruby.c:603: undefined reference to `nxt_app_msg_write_raw'
>> build/src/ruby/nxt_ruby-ruby.o: In function `nxt_ruby_rack_app_run':
>> /root/projects/unit/src/ruby/nxt_ruby.c:364: undefined reference to `nxt_app_msg_flush'
>> build/src/ruby/nxt_ruby-ruby.o: In function `nxt_ruby_rack_result_status':
>> /root/projects/unit/src/ruby/nxt_ruby.c:559: undefined reference to `nxt_sprintf'
>> build/src/ruby/nxt_ruby-ruby.o: In function `nxt_ruby_head_send_part':
>> /root/projects/unit/src/ruby/nxt_ruby.c:735: undefined reference to `nxt_app_msg_write_raw'
>> build/src/ruby/nxt_ruby_stream_io-ruby.o: In function `nxt_ruby_stream_io_read':
>> /root/projects/unit/src/ruby/nxt_ruby_stream_io.c:205: undefined reference to `nxt_app_msg_read_raw'
>> collect2: error: ld returned 1 exit status
>> build/Makefile:1458: recipe for target 'build/ruby.unit.so' failed
>> make: *** [build/ruby.unit.so] Error 1 
>> 
>> Full list at https://pastebin.com/8e1LcB2D
>> 
>> TIA,
>> Yury
>> 
>> _______________________________________________
>> unit mailing list
>> unit at nginx.org
>> https://mailman.nginx.org/mailman/listinfo/unit
> 
> 
> _______________________________________________
> unit mailing list
> unit at nginx.org
> https://mailman.nginx.org/mailman/listinfo/unit
> 
> _______________________________________________
> unit mailing list
> unit at nginx.org
> https://mailman.nginx.org/mailman/listinfo/unit



More information about the unit mailing list