Nim (and nim-lang-server) fail to build on edge from APKBUILD
Package Information
- Package name: nim
- Package version: nim-2.0.8-r0
- Alpine version: WSL edge and installed edge (/etc/alpine-release stuck on 3.17)
- Alpine architecture: x86_64
Summary
Building nim from either the APKBUILD using abuild -r or nim-lang-server using the nimble package manager fails (when building the nimsuggest component) with an incompatible pointer type error.
I had intended to attempt an upgrade to the new Nim 2.2 release but this is with the currently packaged 2.0.8 version.
Steps to reproduce
- Clone aports on edge
- Build nim APKBUILD using abuild -r
Snipped log:
Hint: mm: orc; opt: speed; options: -d:release
169881 lines; 3.449s; 612.895MiB peakmem; proj: /home/ryan/aports/community/nim/src/nim-2.0.8/compiler/nim.nim; out: /home/ryan/aports/community/nim/src/nim-2.0.8/nimcache/r_linux_amd64/nim.json [SuccessX]
compiler/nim1 jsonscript --noNimblePath --nimcache:nimcache/r_linux_amd64 -d:release compiler/nim.nim
Hint: used config file '/home/ryan/aports/community/nim/src/nim-2.0.8/config/nim.cfg' [Conf]
Hint: used config file '/home/ryan/aports/community/nim/src/nim-2.0.8/config/config.nims' [Conf]
Hint: used config file '/home/ryan/aports/community/nim/src/nim-2.0.8/compiler/nim.cfg' [Conf]
executables are equal: SUCCESS!
Building tools...
bin/nim c -o:bin/nimsuggest -d:danger -d:release nimsuggest/nimsuggest.nim
Hint: used config file '/home/ryan/aports/community/nim/src/nim-2.0.8/config/nim.cfg' [Conf]
Hint: used config file '/home/ryan/aports/community/nim/src/nim-2.0.8/config/config.nims' [Conf]
Hint: used config file '/home/ryan/aports/community/nim/src/nim-2.0.8/nimsuggest/config.nims' [Conf]
Hint: used config file '/home/ryan/aports/community/nim/src/nim-2.0.8/nimsuggest/nimsuggest.nim.cfg' [Conf]
....................................................................................................................................................................................................................................................................................................................................
CC: linenoise
CC: ../lib/system/exceptions.nim
CC: ../lib/system/ctypes.nim
CC: ../lib/std/private/threadtypes.nim
CC: ../lib/std/private/digitsutils.nim
CC: ../lib/std/assertions.nim
CC: ../lib/std/private/dragonbox.nim
CC: ../lib/std/private/schubfach.nim
CC: ../lib/std/formatfloat.nim
CC: ../lib/std/objectdollar.nim
CC: ../lib/system/dollars.nim
CC: ../lib/std/typedthreads.nim
CC: ../lib/pure/collections/sharedlist.nim
CC: ../lib/std/syncio.nim
CC: ../lib/system.nim
CC: ../lib/pure/hashes.nim
CC: ../lib/pure/parseutils.nim
CC: ../lib/pure/math.nim
CC: ../lib/pure/algorithm.nim
CC: ../lib/std/enumutils.nim
CC: ../lib/pure/unicode.nim
CC: ../lib/pure/strutils.nim
CC: ../lib/pure/pathnorm.nim
CC: ../lib/std/oserrors.nim
/home/ryan/.cache/nim/nimsuggest_r/@m..@slib@sstd@stypedthreads.nim.c: In function 'createThread__procmonitor_u22':
CC: ../lib/posix/posix.nim
/home/ryan/.cache/nim/nimsuggest_r/@m..@slib@sstd@stypedthreads.nim.c:175:40: error: passing argument 1 of 'pthread_create' from incompatible pointer type [-Wincompatible-pointer-types]
175 | T13_ = pthread_create(((unsigned long*) ((&(*t_p0).sys))), ((pthread_attr_t*) ((&a))), threadProcWrapper__procmonitor_u43, ((void*) (t_p0)));
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| long unsigned int *
In file included from /home/ryan/.cache/nim/nimsuggest_r/@m..@slib@sstd@stypedthreads.nim.c:10:
/usr/include/pthread.h:80:20: note: expected 'struct __pthread ** restrict' but argument is of type 'long unsigned int
'
80 | int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, void *(*)(void *), void *__restrict);
| ^
/home/ryan/.cache/nim/nimsuggest_r/@m..@slib@sstd@stypedthreads.nim.c: In function 'createThread__nimsuggest_u2049':
/home/ryan/.cache/nim/nimsuggest_r/@m..@slib@sstd@stypedthreads.nim.c:236:40: error: passing argument 1 of 'pthread_create' from incompatible pointer type [-Wincompatible-pointer-types]
236 | T13_ = pthread_create(((unsigned long*) ((&(*t_p0).sys))), ((pthread_attr_t*) ((&a))), threadProcWrapper__nimsuggest_u2070, ((void*) (t_p0)));
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| long unsigned int *
/usr/include/pthread.h:80:20: note: expected 'struct __pthread ** restrict' but argument is of type 'long unsigned int
'
80 | int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, void *(*)(void *), void *__restrict);
| ^
CC: ../lib/std/private/oscommon.nim
CC: ../lib/std/private/ospaths2.nim
CC: ../lib/std/private/ossymlinks.nim
CC: ../lib/pure/options.nim
CC: ../lib/pure/times.nim
CC: ../lib/std/private/osfiles.nim
CC: ../lib/std/private/osdirs.nim
CC: ../lib/std/envvars.nim
CC: ../lib/std/private/osappdirs.nim
CC: ../lib/std/cmdline.nim
CC: ../lib/pure/os.nim
CC: ../lib/pure/strtabs.nim
Error: execution of an external compiler program 'gcc -c -w -fmax-errors=3 -pthread -O3 -fno-strict-aliasing -fno-ident -fno-math-errno -I/home/ryan/aports/community/nim/src/nim-2.0.8/lib -I/home/ryan/aports/community/nim/src/nim-2.0.8/nimsuggest -o /home/ryan/.cache/nim/nimsuggest_r/@m..@slib@sstd@stypedthreads.nim.c.o /home/ryan/.cache/nim/nimsuggest_r/@m..@slib@sstd@stypedthreads.nim.c' failed with exit code: 1
FAILURE
>>> ERROR: nim: build failed
>>> nim: Uninstalling dependencies...
(1/14) Purging .makedepends-nim (20241009.072240)
(2/14) Purging libucontext-dev (1.3.2-r0)
(3/14) Purging gcc-gdb (14.2.0-r3)
(4/14) Purging gdb (15.2-r0)
(5/14) Purging musl-dbg (1.2.5-r5)
(6/14) Purging gc-dev (8.2.8-r0)
(7/14) Purging libgc++ (8.2.8-r0)
(8/14) Purging nodejs (20.15.1-r0)
(9/14) Purging ca-certificates (20240705-r0)
Executing ca-certificates-20240705-r0.post-deinstall
(10/14) Purging pcre (8.45-r3)
(11/14) Purging valgrind (3.23.0-r0)
(12/14) Purging ada-libs (2.7.8-r1)
(13/14) Purging gc (8.2.8-r0)
(14/14) Purging libbase64 (0.5.2-r0)
Executing busybox-1.36.1-r32.trigger
OK: 2012 MiB in 549 packages