* [ruby-core:103323] [Ruby master Bug#17788] ruby 3.0.0 - compiling c++ extension on alpine fails
@ 2021-04-08 23:03 maia
2021-04-09 0:17 ` [ruby-core:103325] " xtkoba+ruby
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: maia @ 2021-04-08 23:03 UTC (permalink / raw)
To: ruby-core
Issue #17788 has been reported by memel (Maia Engeli).
----------------------------------------
Bug #17788: ruby 3.0.0 - compiling c++ extension on alpine fails
https://bugs.ruby-lang.org/issues/17788
* Author: memel (Maia Engeli)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux-musl]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Compiling gem with C++ extension fails on alpine 3xx with Ruby 3.0.0 and Ruby 3.0.1
(does not fail on Ubuntu 18 ¯\\_(ツ)_/¯)
Error:
```
compiling testgem.cc
In file included from /root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/ruby.h:39,
from /root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby.h:38,
from testgem.cc:2:
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/internal/memory.h:275:16: error: conflicting declaration of 'void* ruby_nonempty_memcpy(void*, const void*, size_t)' with 'C' linkage
275 | #define memcpy ruby_nonempty_memcpy
| ^~~~~~~~~~~~~~~~~~~~
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/internal/memory.h:265:1: note: previous declaration with 'C++' linkage
265 | ruby_nonempty_memcpy(void *dest, const void *src, size_t n)
| ^~~~~~~~~~~~~~~~~~~~
```
Code for reproduction:
extconf.rb
```
require 'mkmf'
create_makefile 'testgem'
```
testgem.cc
```
#include <stdio.h>
#include <ruby.h>
#include <iostream>
VALUE says(VALUE _self, VALUE str) {
Check_Type(str, T_STRING);
puts(StringValueCStr(str));
return Qnil;
}
void Init_testgem() {
VALUE mod = rb_define_module("Simon");
const int num_args = 1;
std::cout << "*** testgem initialized ***" << std::endl;
rb_define_module_function(mod, "says", says, num_args);
}
---Files--------------------------------
testgem.cc (394 Bytes)
extconf.rb (41 Bytes)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:103325] [Ruby master Bug#17788] ruby 3.0.0 - compiling c++ extension on alpine fails
2021-04-08 23:03 [ruby-core:103323] [Ruby master Bug#17788] ruby 3.0.0 - compiling c++ extension on alpine fails maia
@ 2021-04-09 0:17 ` xtkoba+ruby
2021-04-09 1:37 ` [ruby-core:103327] " shyouhei
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: xtkoba+ruby @ 2021-04-09 0:17 UTC (permalink / raw)
To: ruby-core
Issue #17788 has been updated by xtkoba (Tee KOBAYASHI).
File ruby-ruby_nonempty_memcpy-musl-cxx.patch added
Repro (named `bug17788.cc`):
```c
#include <sys/types.h>
//extern "C" {
void *
ruby_nonempty_memcpy(void *dest, const void *src, size_t n)
{
return dest;
}
//}
#undef memcpy
#define memcpy ruby_nonempty_memcpy
#include <iostream>
```
```
$ x86_64-unknown-linux-musl-g++ -c bug17788.cc
bug17788.cc:13:16: error: conflicting declaration of 'void* ruby_nonempty_memcpy(void*, const void*, size_t)' with 'C' linkage
13 | #define memcpy ruby_nonempty_memcpy
| ^~~~~~~~~~~~~~~~~~~~
bug17788.cc:6:1: note: previous declaration with 'C++' linkage
6 | ruby_nonempty_memcpy(void *dest, const void *src, size_t n)
| ^~~~~~~~~~~~~~~~~~~~
```
A patch is attached for a workaround which wraps up the definition of `ruby_nonempty_memcpy` with `extern "C" { ... }`.
----------------------------------------
Bug #17788: ruby 3.0.0 - compiling c++ extension on alpine fails
https://bugs.ruby-lang.org/issues/17788#change-91415
* Author: memel (Maia Engeli)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux-musl]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Compiling gem with C++ extension fails on alpine 3xx with Ruby 3.0.0 and Ruby 3.0.1
(does not fail on Ubuntu 18 ¯\\_(ツ)_/¯)
Error:
```
compiling testgem.cc
In file included from /root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/ruby.h:39,
from /root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby.h:38,
from testgem.cc:2:
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/internal/memory.h:275:16: error: conflicting declaration of 'void* ruby_nonempty_memcpy(void*, const void*, size_t)' with 'C' linkage
275 | #define memcpy ruby_nonempty_memcpy
| ^~~~~~~~~~~~~~~~~~~~
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/internal/memory.h:265:1: note: previous declaration with 'C++' linkage
265 | ruby_nonempty_memcpy(void *dest, const void *src, size_t n)
| ^~~~~~~~~~~~~~~~~~~~
```
Code for reproduction:
extconf.rb
```
require 'mkmf'
create_makefile 'testgem'
```
testgem.cc
```
#include <stdio.h>
#include <ruby.h>
#include <iostream>
VALUE says(VALUE _self, VALUE str) {
Check_Type(str, T_STRING);
puts(StringValueCStr(str));
return Qnil;
}
void Init_testgem() {
VALUE mod = rb_define_module("Simon");
const int num_args = 1;
std::cout << "*** testgem initialized ***" << std::endl;
rb_define_module_function(mod, "says", says, num_args);
}
---Files--------------------------------
testgem.cc (394 Bytes)
extconf.rb (41 Bytes)
ruby-ruby_nonempty_memcpy-musl-cxx.patch (370 Bytes)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:103327] [Ruby master Bug#17788] ruby 3.0.0 - compiling c++ extension on alpine fails
2021-04-08 23:03 [ruby-core:103323] [Ruby master Bug#17788] ruby 3.0.0 - compiling c++ extension on alpine fails maia
2021-04-09 0:17 ` [ruby-core:103325] " xtkoba+ruby
@ 2021-04-09 1:37 ` shyouhei
2021-04-29 14:28 ` [ruby-core:103658] " xtkoba+ruby
2022-03-13 6:43 ` [ruby-core:107873] " nagachika (Tomoyuki Chikanaga)
3 siblings, 0 replies; 5+ messages in thread
From: shyouhei @ 2021-04-09 1:37 UTC (permalink / raw)
To: ruby-core
Issue #17788 has been updated by shyouhei (Shyouhei Urabe).
Good catch! Patch LGTM.
----------------------------------------
Bug #17788: ruby 3.0.0 - compiling c++ extension on alpine fails
https://bugs.ruby-lang.org/issues/17788#change-91418
* Author: memel (Maia Engeli)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux-musl]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Compiling gem with C++ extension fails on alpine 3xx with Ruby 3.0.0 and Ruby 3.0.1
(does not fail on Ubuntu 18 ¯\\_(ツ)_/¯)
Error:
```
compiling testgem.cc
In file included from /root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/ruby.h:39,
from /root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby.h:38,
from testgem.cc:2:
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/internal/memory.h:275:16: error: conflicting declaration of 'void* ruby_nonempty_memcpy(void*, const void*, size_t)' with 'C' linkage
275 | #define memcpy ruby_nonempty_memcpy
| ^~~~~~~~~~~~~~~~~~~~
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/internal/memory.h:265:1: note: previous declaration with 'C++' linkage
265 | ruby_nonempty_memcpy(void *dest, const void *src, size_t n)
| ^~~~~~~~~~~~~~~~~~~~
```
Code for reproduction:
extconf.rb
```
require 'mkmf'
create_makefile 'testgem'
```
testgem.cc
```
#include <stdio.h>
#include <ruby.h>
#include <iostream>
VALUE says(VALUE _self, VALUE str) {
Check_Type(str, T_STRING);
puts(StringValueCStr(str));
return Qnil;
}
void Init_testgem() {
VALUE mod = rb_define_module("Simon");
const int num_args = 1;
std::cout << "*** testgem initialized ***" << std::endl;
rb_define_module_function(mod, "says", says, num_args);
}
---Files--------------------------------
testgem.cc (394 Bytes)
extconf.rb (41 Bytes)
ruby-ruby_nonempty_memcpy-musl-cxx.patch (370 Bytes)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:103658] [Ruby master Bug#17788] ruby 3.0.0 - compiling c++ extension on alpine fails
2021-04-08 23:03 [ruby-core:103323] [Ruby master Bug#17788] ruby 3.0.0 - compiling c++ extension on alpine fails maia
2021-04-09 0:17 ` [ruby-core:103325] " xtkoba+ruby
2021-04-09 1:37 ` [ruby-core:103327] " shyouhei
@ 2021-04-29 14:28 ` xtkoba+ruby
2022-03-13 6:43 ` [ruby-core:107873] " nagachika (Tomoyuki Chikanaga)
3 siblings, 0 replies; 5+ messages in thread
From: xtkoba+ruby @ 2021-04-29 14:28 UTC (permalink / raw)
To: ruby-core
Issue #17788 has been updated by xtkoba (Tee KOBAYASHI).
PR: https://github.com/ruby/ruby/pull/4429
----------------------------------------
Bug #17788: ruby 3.0.0 - compiling c++ extension on alpine fails
https://bugs.ruby-lang.org/issues/17788#change-91754
* Author: memel (Maia Engeli)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux-musl]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Compiling gem with C++ extension fails on alpine 3xx with Ruby 3.0.0 and Ruby 3.0.1
(does not fail on Ubuntu 18 ¯\\_(ツ)_/¯)
Error:
```
compiling testgem.cc
In file included from /root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/ruby.h:39,
from /root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby.h:38,
from testgem.cc:2:
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/internal/memory.h:275:16: error: conflicting declaration of 'void* ruby_nonempty_memcpy(void*, const void*, size_t)' with 'C' linkage
275 | #define memcpy ruby_nonempty_memcpy
| ^~~~~~~~~~~~~~~~~~~~
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/internal/memory.h:265:1: note: previous declaration with 'C++' linkage
265 | ruby_nonempty_memcpy(void *dest, const void *src, size_t n)
| ^~~~~~~~~~~~~~~~~~~~
```
Code for reproduction:
extconf.rb
```
require 'mkmf'
create_makefile 'testgem'
```
testgem.cc
```
#include <stdio.h>
#include <ruby.h>
#include <iostream>
VALUE says(VALUE _self, VALUE str) {
Check_Type(str, T_STRING);
puts(StringValueCStr(str));
return Qnil;
}
void Init_testgem() {
VALUE mod = rb_define_module("Simon");
const int num_args = 1;
std::cout << "*** testgem initialized ***" << std::endl;
rb_define_module_function(mod, "says", says, num_args);
}
---Files--------------------------------
testgem.cc (394 Bytes)
extconf.rb (41 Bytes)
ruby-ruby_nonempty_memcpy-musl-cxx.patch (370 Bytes)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:107873] [Ruby master Bug#17788] ruby 3.0.0 - compiling c++ extension on alpine fails
2021-04-08 23:03 [ruby-core:103323] [Ruby master Bug#17788] ruby 3.0.0 - compiling c++ extension on alpine fails maia
` (2 preceding siblings ...)
2021-04-29 14:28 ` [ruby-core:103658] " xtkoba+ruby
@ 2022-03-13 6:43 ` nagachika (Tomoyuki Chikanaga)
3 siblings, 0 replies; 5+ messages in thread
From: nagachika (Tomoyuki Chikanaga) @ 2022-03-13 6:43 UTC (permalink / raw)
To: ruby-core
Issue #17788 has been updated by nagachika (Tomoyuki Chikanaga).
Backport changed from 2.6: DONTNEED, 2.7: UNKNOWN, 3.0: REQUIRED to 2.6: DONTNEED, 2.7: UNKNOWN, 3.0: DONE
ruby_3_0 2bb5fa495bf9d366d3c1fefc6b093dc4830f27bf merged revision(s) 29f6f79e7396018962eb25c5f5e409f5fe28a73b.
----------------------------------------
Bug #17788: ruby 3.0.0 - compiling c++ extension on alpine fails
https://bugs.ruby-lang.org/issues/17788#change-96814
* Author: memel (Maia Engeli)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux-musl]
* Backport: 2.6: DONTNEED, 2.7: UNKNOWN, 3.0: DONE
----------------------------------------
Compiling gem with C++ extension fails on alpine 3xx with Ruby 3.0.0 and Ruby 3.0.1
(does not fail on Ubuntu 18 ¯\\_(ツ)_/¯)
Error:
```
compiling testgem.cc
In file included from /root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/ruby.h:39,
from /root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby.h:38,
from testgem.cc:2:
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/internal/memory.h:275:16: error: conflicting declaration of 'void* ruby_nonempty_memcpy(void*, const void*, size_t)' with 'C' linkage
275 | #define memcpy ruby_nonempty_memcpy
| ^~~~~~~~~~~~~~~~~~~~
/root/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/internal/memory.h:265:1: note: previous declaration with 'C++' linkage
265 | ruby_nonempty_memcpy(void *dest, const void *src, size_t n)
| ^~~~~~~~~~~~~~~~~~~~
```
Code for reproduction:
extconf.rb
```
require 'mkmf'
create_makefile 'testgem'
```
testgem.cc
```
#include <stdio.h>
#include <ruby.h>
#include <iostream>
VALUE says(VALUE _self, VALUE str) {
Check_Type(str, T_STRING);
puts(StringValueCStr(str));
return Qnil;
}
void Init_testgem() {
VALUE mod = rb_define_module("Simon");
const int num_args = 1;
std::cout << "*** testgem initialized ***" << std::endl;
rb_define_module_function(mod, "says", says, num_args);
}
---Files--------------------------------
testgem.cc (394 Bytes)
extconf.rb (41 Bytes)
ruby-ruby_nonempty_memcpy-musl-cxx.patch (370 Bytes)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-03-13 6:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 23:03 [ruby-core:103323] [Ruby master Bug#17788] ruby 3.0.0 - compiling c++ extension on alpine fails maia
2021-04-09 0:17 ` [ruby-core:103325] " xtkoba+ruby
2021-04-09 1:37 ` [ruby-core:103327] " shyouhei
2021-04-29 14:28 ` [ruby-core:103658] " xtkoba+ruby
2022-03-13 6:43 ` [ruby-core:107873] " nagachika (Tomoyuki Chikanaga)
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).