ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:96656] [Ruby master Bug#16480] Ruby 2.7, C++, and rb_define_method compilation error
       [not found] <redmine.issue-16480.20200104180721@ruby-lang.org>
@ 2020-01-04 18:07 ` ruby
  2020-01-06  1:03 ` [ruby-core:96677] " shyouhei
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: ruby @ 2020-01-04 18:07 UTC (permalink / raw)
  To: ruby-core

Issue #16480 has been reported by jasonroelofs (Jason Roelofs).

----------------------------------------
Bug #16480: Ruby 2.7, C++, and rb_define_method compilation error
https://bugs.ruby-lang.org/issues/16480

* Author: jasonroelofs (Jason Roelofs)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin18]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
I maintain the Rice library which provides constructs for exposing C++ libraries into Ruby. With Ruby 2.7.0 I've got a hard compilation failure that I'm not sure how to fix.[1]

Diving into this, I've found that rb_define_method, when compiled under C++, is now a macro that uses templates to choose the correct overload by the given arity. However, this seems to require a constexpr-compatible use of rb_define_method, making the API unavailable for more dynamic uses[1].

The PR that made these changes is here[3].

I've looked for ways to get around this macro change but have been unable to make anything work. Is there a way I've missed to directly call the underlying C API function or is this now simply not possible with Ruby 2.7.0?

[1] https://github.com/jasonroelofs/rice/issues/119
[2] https://github.com/jasonroelofs/rice/blob/master/rice/detail/method_data.cpp#L78
[3] https://github.com/ruby/ruby/pull/2461




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:96677] [Ruby master Bug#16480] Ruby 2.7, C++, and rb_define_method compilation error
       [not found] <redmine.issue-16480.20200104180721@ruby-lang.org>
  2020-01-04 18:07 ` [ruby-core:96656] [Ruby master Bug#16480] Ruby 2.7, C++, and rb_define_method compilation error ruby
@ 2020-01-06  1:03 ` shyouhei
  2020-01-09 14:14 ` [ruby-core:96739] " nobu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: shyouhei @ 2020-01-06  1:03 UTC (permalink / raw)
  To: ruby-core

Issue #16480 has been updated by shyouhei (Shyouhei Urabe).

Assignee set to nobu (Nobuyoshi Nakada)
Status changed from Open to Assigned

It indeed seems to be a bug.  For C extensions, that arity argument can be a variable.  There is a fallback code.  But for C++, there is no way to accept non-constexpr arities.  This is a problem.

@nobu Can you provide us a workaround?  Or revert, because there is no way to support the extension library?

----------------------------------------
Bug #16480: Ruby 2.7, C++, and rb_define_method compilation error
https://bugs.ruby-lang.org/issues/16480#change-83660

* Author: jasonroelofs (Jason Roelofs)
* Status: Assigned
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version: 
* ruby -v: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin18]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
I maintain the Rice library which provides constructs for exposing C++ libraries into Ruby. With Ruby 2.7.0 I've got a hard compilation failure that I'm not sure how to fix.[1]

Diving into this, I've found that rb_define_method, when compiled under C++, is now a macro that uses templates to choose the correct overload by the given arity. However, this seems to require a constexpr-compatible use of rb_define_method, making the API unavailable for more dynamic uses[1].

The PR that made these changes is here[3].

I've looked for ways to get around this macro change but have been unable to make anything work. Is there a way I've missed to directly call the underlying C API function or is this now simply not possible with Ruby 2.7.0?

[1] https://github.com/jasonroelofs/rice/issues/119
[2] https://github.com/jasonroelofs/rice/blob/master/rice/detail/method_data.cpp#L78
[3] https://github.com/ruby/ruby/pull/2461




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:96739] [Ruby master Bug#16480] Ruby 2.7, C++, and rb_define_method compilation error
       [not found] <redmine.issue-16480.20200104180721@ruby-lang.org>
  2020-01-04 18:07 ` [ruby-core:96656] [Ruby master Bug#16480] Ruby 2.7, C++, and rb_define_method compilation error ruby
  2020-01-06  1:03 ` [ruby-core:96677] " shyouhei
@ 2020-01-09 14:14 ` nobu
  2020-01-09 23:35 ` [ruby-core:96744] " ruby
  2020-01-11  1:58 ` [ruby-core:96774] " nobu
  4 siblings, 0 replies; 5+ messages in thread
From: nobu @ 2020-01-09 14:14 UTC (permalink / raw)
  To: ruby-core

Issue #16480 has been updated by nobu (Nobuyoshi Nakada).


Doesn't `#undef rb_define_method` in that file work?

----------------------------------------
Bug #16480: Ruby 2.7, C++, and rb_define_method compilation error
https://bugs.ruby-lang.org/issues/16480#change-83726

* Author: jasonroelofs (Jason Roelofs)
* Status: Assigned
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version: 
* ruby -v: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin18]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
I maintain the Rice library which provides constructs for exposing C++ libraries into Ruby. With Ruby 2.7.0 I've got a hard compilation failure that I'm not sure how to fix.[1]

Diving into this, I've found that rb_define_method, when compiled under C++, is now a macro that uses templates to choose the correct overload by the given arity. However, this seems to require a constexpr-compatible use of rb_define_method, making the API unavailable for more dynamic uses[1].

The PR that made these changes is here[3].

I've looked for ways to get around this macro change but have been unable to make anything work. Is there a way I've missed to directly call the underlying C API function or is this now simply not possible with Ruby 2.7.0?

[1] https://github.com/jasonroelofs/rice/issues/119
[2] https://github.com/jasonroelofs/rice/blob/master/rice/detail/method_data.cpp#L78
[3] https://github.com/ruby/ruby/pull/2461




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:96744] [Ruby master Bug#16480] Ruby 2.7, C++, and rb_define_method compilation error
       [not found] <redmine.issue-16480.20200104180721@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2020-01-09 14:14 ` [ruby-core:96739] " nobu
@ 2020-01-09 23:35 ` ruby
  2020-01-11  1:58 ` [ruby-core:96774] " nobu
  4 siblings, 0 replies; 5+ messages in thread
From: ruby @ 2020-01-09 23:35 UTC (permalink / raw)
  To: ruby-core

Issue #16480 has been updated by jasonroelofs (Jason Roelofs).


nobu (Nobuyoshi Nakada) wrote:
> Doesn't `#undef rb_define_method` in that file work?

Ah yes it looks like it does and thanks for putting together the PR.

----------------------------------------
Bug #16480: Ruby 2.7, C++, and rb_define_method compilation error
https://bugs.ruby-lang.org/issues/16480#change-83731

* Author: jasonroelofs (Jason Roelofs)
* Status: Assigned
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version: 
* ruby -v: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin18]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
I maintain the Rice library which provides constructs for exposing C++ libraries into Ruby. With Ruby 2.7.0 I've got a hard compilation failure that I'm not sure how to fix.[1]

Diving into this, I've found that rb_define_method, when compiled under C++, is now a macro that uses templates to choose the correct overload by the given arity. However, this seems to require a constexpr-compatible use of rb_define_method, making the API unavailable for more dynamic uses[1].

The PR that made these changes is here[3].

I've looked for ways to get around this macro change but have been unable to make anything work. Is there a way I've missed to directly call the underlying C API function or is this now simply not possible with Ruby 2.7.0?

[1] https://github.com/jasonroelofs/rice/issues/119
[2] https://github.com/jasonroelofs/rice/blob/master/rice/detail/method_data.cpp#L78
[3] https://github.com/ruby/ruby/pull/2461




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:96774] [Ruby master Bug#16480] Ruby 2.7, C++, and rb_define_method compilation error
       [not found] <redmine.issue-16480.20200104180721@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2020-01-09 23:35 ` [ruby-core:96744] " ruby
@ 2020-01-11  1:58 ` nobu
  4 siblings, 0 replies; 5+ messages in thread
From: nobu @ 2020-01-11  1:58 UTC (permalink / raw)
  To: ruby-core

Issue #16480 has been updated by nobu (Nobuyoshi Nakada).

Status changed from Assigned to Closed

The arities must be eventually compile-time constants for the nature.
I think this case is quite special, and it is resolved in that project.

----------------------------------------
Bug #16480: Ruby 2.7, C++, and rb_define_method compilation error
https://bugs.ruby-lang.org/issues/16480#change-83768

* Author: jasonroelofs (Jason Roelofs)
* Status: Closed
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version: 
* ruby -v: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin18]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
I maintain the Rice library which provides constructs for exposing C++ libraries into Ruby. With Ruby 2.7.0 I've got a hard compilation failure that I'm not sure how to fix.[1]

Diving into this, I've found that rb_define_method, when compiled under C++, is now a macro that uses templates to choose the correct overload by the given arity. However, this seems to require a constexpr-compatible use of rb_define_method, making the API unavailable for more dynamic uses[1].

The PR that made these changes is here[3].

I've looked for ways to get around this macro change but have been unable to make anything work. Is there a way I've missed to directly call the underlying C API function or is this now simply not possible with Ruby 2.7.0?

[1] https://github.com/jasonroelofs/rice/issues/119
[2] https://github.com/jasonroelofs/rice/blob/master/rice/detail/method_data.cpp#L78
[3] https://github.com/ruby/ruby/pull/2461




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-11  1:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-16480.20200104180721@ruby-lang.org>
2020-01-04 18:07 ` [ruby-core:96656] [Ruby master Bug#16480] Ruby 2.7, C++, and rb_define_method compilation error ruby
2020-01-06  1:03 ` [ruby-core:96677] " shyouhei
2020-01-09 14:14 ` [ruby-core:96739] " nobu
2020-01-09 23:35 ` [ruby-core:96744] " ruby
2020-01-11  1:58 ` [ruby-core:96774] " nobu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).