Package Details: m68k-elf-gcc 14.1.0-1

Git Clone URL: https://aur.archlinux.org/m68k-elf-gcc.git (read-only, click to copy)
Package Base: m68k-elf-gcc
Description: The GNU Compiler Collection (m68k-elf)
Upstream URL: http://gcc.gnu.org
Licenses: GPL, custom, LGPL, FDL
Conflicts: m68k-elf-gcc-bootstrap
Replaces: m68k-elf-gcc-bootstrap
Submitter: doragasu
Maintainer: doragasu
Last Packager: doragasu
Votes: 8
Popularity: 0.065651
First Submitted: 2017-10-27 17:31 (UTC)
Last Updated: 2024-07-11 20:44 (UTC)

Latest Comments

doragasu commented on 2021-01-09 22:14 (UTC)

@Un1Gfn: Thanks for the feedback. I think I should be able to remove the m68k-elf-gcc-bootstrap if I move the m68k-elf-gcc-bootstrap in newlib to the build dependencies. Otherwise, if I do not touch the newlib PKGBUILD but remove the bootstrap provide from m68k-elf-gcc, you will be able to build it, but installation will fail (because newlib depends on m68k-elf-gcc-bootstrap and m68k-elf-gcc replaces it (and wants to uninstall it).

zkm2fw commented on 2021-01-09 02:42 (UTC) (edited on 2021-01-09 02:50 (UTC) by zkm2fw)

@doragasu Oops I didn't know it was for baremetal. I've switched to buildroot(uClibc) now. Thanks.

BTW: m68k-elf-gcc-bootstrap provides m68k-elf-gcc. But maybe m68k-elf-gcc should not provide m68k-elf-gcc-bootstrap the other way around.

doragasu commented on 2021-01-08 16:20 (UTC) (edited on 2021-01-08 16:23 (UTC) by doragasu)

@Un1Gfn: This compiler is for bare metal targets, and it uses newlib instead of glibc. Most of the C standard library functions are usable without any additional requirements. But some of them like e.g. malloc() or printf() require you to implement some syscalls like the ones you are seeing in your error tailored for your specific target. For example where do you intend printf() to output the characters? On a bare metal target it could be an UART, an embedded screen with a framebuffer device, a memory region...

For more information read newlib documentation, specifically syscalls are documented here: https://sourceware.org/newlib/libc.html#Stubs

zkm2fw commented on 2021-01-08 09:19 (UTC)

test.c

#include <stdio.h>
void _start() {
  printf("abc\n");
}

build w/ m68k-elf-gcc -std=c99 -o test.out test.c

/usr/lib/gcc/m68k-elf/10.1.0/../../../../m68k-elf/bin/ld: /usr/lib/gcc/m68k-elf/10.1.0/../../../../m68k-elf/lib/libc.a(lib_a-sbrkr.o): in function `_sbrk_r':
/home/darren/.cache/yay/m68k-elf-newlib/src/newlib-build/m68k-elf/newlib/libc/reent/../../../../../newlib-3.3.0/newlib/libc/reent/sbrkr.c:51: undefined reference to `sbrk'
/usr/lib/gcc/m68k-elf/10.1.0/../../../../m68k-elf/bin/ld: /usr/lib/gcc/m68k-elf/10.1.0/../../../../m68k-elf/lib/libc.a(lib_a-writer.o): in function `_write_r':
/home/darren/.cache/yay/m68k-elf-newlib/src/newlib-build/m68k-elf/newlib/libc/reent/../../../../../newlib-3.3.0/newlib/libc/reent/writer.c:49: undefined reference to `write'
/usr/lib/gcc/m68k-elf/10.1.0/../../../../m68k-elf/bin/ld: /usr/lib/gcc/m68k-elf/10.1.0/../../../../m68k-elf/lib/libc.a(lib_a-closer.o): in function `_close_r':
/home/darren/.cache/yay/m68k-elf-newlib/src/newlib-build/m68k-elf/newlib/libc/reent/../../../../../newlib-3.3.0/newlib/libc/reent/closer.c:47: undefined reference to `close'
/usr/lib/gcc/m68k-elf/10.1.0/../../../../m68k-elf/bin/ld: /usr/lib/gcc/m68k-elf/10.1.0/../../../../m68k-elf/lib/libc.a(lib_a-lseekr.o): in function `_lseek_r':
/home/darren/.cache/yay/m68k-elf-newlib/src/newlib-build/m68k-elf/newlib/libc/reent/../../../../../newlib-3.3.0/newlib/libc/reent/lseekr.c:49: undefined reference to `lseek'
/usr/lib/gcc/m68k-elf/10.1.0/../../../../m68k-elf/bin/ld: /usr/lib/gcc/m68k-elf/10.1.0/../../../../m68k-elf/lib/libc.a(lib_a-readr.o): in function `_read_r':
/home/darren/.cache/yay/m68k-elf-newlib/src/newlib-build/m68k-elf/newlib/libc/reent/../../../../../newlib-3.3.0/newlib/libc/reent/readr.c:49: undefined reference to `read'
/usr/lib/gcc/m68k-elf/10.1.0/../../../../m68k-elf/bin/ld: /usr/lib/gcc/m68k-elf/10.1.0/../../../../m68k-elf/lib/libc.a(lib_a-fstatr.o): in function `_fstat_r':
/home/darren/.cache/yay/m68k-elf-newlib/src/newlib-build/m68k-elf/newlib/libc/reent/../../../../../newlib-3.3.0/newlib/libc/reent/fstatr.c:55: undefined reference to `fstat'
/usr/lib/gcc/m68k-elf/10.1.0/../../../../m68k-elf/bin/ld: /usr/lib/gcc/m68k-elf/10.1.0/../../../../m68k-elf/lib/libc.a(lib_a-isattyr.o): in function `_isatty_r':
/home/darren/.cache/yay/m68k-elf-newlib/src/newlib-build/m68k-elf/newlib/libc/reent/../../../../../newlib-3.3.0/newlib/libc/reent/isattyr.c:52: undefined reference to `isatty'
collect2: error: ld returned 1 exit status

fail

doragasu commented on 2020-05-24 18:57 (UTC)

Makes sense, added to both makedepends and optdepends. Thanks for the suggestion!

BTW I have never user freestanding mode. I have built things without using standard libraries, linking with -nostdlib. But never used -ffreestanding before.

rouhannb commented on 2020-05-24 15:41 (UTC)

Then perhaps you should add newlib as both a makedepend and an optdepend?

(Also, I’m not sure if you know this or not, but you can build executables without a library by using freestanding mode.)

doragasu commented on 2020-05-23 19:13 (UTC)

I'm sure the puzzle I am doing with the bootstrap package can be improved. But I don't think putting newlib in the makedepends is a good idea, since if you remove the library after building the compiler, resulting compiler will fail to build executables.

rouhannb commented on 2020-05-18 17:23 (UTC)

Should m68k-elf-newlib be added as a makedepend?