Skip to content

Commit 541436f

Browse files
committed
Add pthread to LDFLAGS of Windows cross rubies
Taken from here: oneclick/rubyinstaller2-packages@a547657 It otherwise fails with: 16 127.7 /usr/local/rake-compiler/sources/ruby-3.2.9/process.c:8389:13: error: 'c' undeclared (first use in this function) 16 127.7 8389 | c = CLOCK_REALTIME; 16 127.7 | ^ 16 127.7 /usr/local/rake-compiler/sources/ruby-3.2.9/process.c:8389:13: note: each undeclared identifier is reported only once for each function it appears in 16 127.7 /usr/local/rake-compiler/sources/ruby-3.2.9/process.c:8397:13: error: label 'gettime' used but not defined 16 127.7 8397 | goto gettime; 16 127.7 | ^~~~ 16 127.7 /usr/local/rake-compiler/sources/ruby-3.2.9/process.c: In function 'rb_clock_getres': 16 127.7 /usr/local/rake-compiler/sources/ruby-3.2.9/process.c:8620:13: error: 'c' undeclared (first use in this function) 16 127.7 8620 | c = CLOCK_REALTIME; 16 127.7 | ^ 16 127.7 /usr/local/rake-compiler/sources/ruby-3.2.9/process.c:8628:13: error: label 'getres' used but not defined 16 127.7 8628 | goto getres; 16 127.7 | ^~~~ 16 127.7 make: *** [Makefile:468: process.o] Error 1
1 parent 66f6ed0 commit 541436f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Dockerfile.mri.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,14 @@ else
167167
end
168168

169169
strip = '-s' if platform !~ /darwin|aarch64-mingw/
170+
lpthread = '-lpthread' if platform =~ /mingw/
170171

171172
xrubies_build_plan.each do |xrubies, bootstrap_ruby_version| %>
172173
RUN bash -c " \
173174
rbenv shell <%= bootstrap_ruby_version %> && \
174175
export CPPFLAGS='<%= "-D__USE_MINGW_ANSI_STDIO=1" if platform =~ /x64-mingw-ucrt/ %>' && \
175176
export CFLAGS='-O1 -fno-omit-frame-pointer -fno-fast-math -fstack-protector-strong <%= strip %>' && \
176-
export LDFLAGS='-pipe <%= strip %>' && \
177+
export LDFLAGS='-pipe <%= strip %> <%= lpthread %>' && \
177178
<%= "export LIBS='-l:libssp.a' &&" if platform =~ /mingw/ %> \
178179
<%= "export CC=#{target}-clang &&" if platform =~ /darwin/ %> \
179180
export MAKE='make V=1' && \

0 commit comments

Comments
 (0)