fpmake won't run on alpine linux (libc.musl) during build of FPC

Summary

Dynamically linked executables from FPC 3.3.1 on Alpine Linux are invalid. With FPC 3.2.2 they are valid.

System Information

  • Operating system: Alpine Linux (musl libc based)
  • Processor architecture: x86-64
  • Compiler version: 3.3.1-13856-g0c3f7bb6 (using 3.2.2 as starting compiler)
  • Device: Computer

Steps to reproduce

make all # after clone of FPC 3.3.1

Example Project

Not relevant.

What is the current bug behavior?

fpmake will not run after it has been compiled and linked.

# previous build output omitted
make[3]: Leaving directory '/home/dev/git/fpc_source_main/packages/fpmkunit'
/home/dev/git/fpc_source_main/compiler/ppcx64 fpmake.pp  -Fu/home/dev/git/fpc_source_main/packages/fpmkunit/units_bs/x86_64-linux -Fu/home/dev/git/fpc_source_main/rtl/units/x86_64-linux -Fl/usr/lib/gcc/x86_64-alpine-linux-musl/13.1.1 
Free Pascal Compiler version 3.3.1 [2023/09/09] for x86_64
Copyright (c) 1993-2023 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling fpmake.pp
fpmake.pp(16,3) Note: Local variable "T" is assigned but never used
fpmake.pp(16,3) Note: Local variable "T" is assigned but never used
Linking fpmake
18794 lines compiled, 0.9 sec, 1496880 bytes code, 705256 bytes data
2 note(s) issued
./fpmake compile --localunitdir=.. --os=linux --cpu=x86_64 -o -Ur -o -Xs -o -O2 -o -n -o -Cg -o -Fl/usr/lib/gcc/x86_64-alpine-linux-musl/13.1.1 -o -dx86_64 -o -dRELEASE --compiler=/home/dev/git/fpc_source_main/compiler/ppcx64 -bu -o -XX -o -CX
make[2]: ./fpmake: No such file or directory
make[2]: *** [Makefile:1992: smart] Error 127
make[2]: Leaving directory '/home/dev/git/fpc_source_main/packages'
make[1]: *** [Makefile:3104: packages_smart] Error 2
make[1]: Leaving directory '/home/dev/git/fpc_source_main'
make: *** [Makefile:3258: build-stamp.x86_64-linux] Error 

Further analysis:

$ file /home/dev/git/fpc_source_main/packages/fpmake
/home/dev/git/fpc_source_main/packages/fpmake: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.4.0, stripped

$ ldd /home/dev/git/fpc_source_main/packages/fpmake
        /lib64/ld-linux-x86-64.so.2 (0x7f49a8ad0000)
        libc.musl-x86_64.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7f49a8ad0000)

$ ./home/dev/git/fpc_source_main/packages/fpmake
bash: ./home/dev/git/fpc_source_main/packages/fpmake: No such file or directory

What is the expected (correct) behavior?

Since FPC 3.2.2 works on Alpine, I would assume, barring any musl-libc issues, that the latest 3.3.1 would build and install. This might be related to #36730 (or possibly #39600)

Relevant logs and/or screenshots

See What is the current bug behavior?

Possible fixes

None known.

Edited by bogen85