I have the latest official Arduino version 1.8.9 and Teensyduino 1.47 installed, and I'm able to successfully compile and flash my new Teensy 4.0 directly from Arduino.

I'm having trouble trying to compile the example Blink source, using the provided teensy4 Makefile template (i.e., https://github.com/PaulStoffregen/co...ensy4/Makefile).

Using the Arduino IDE compilation output as reference, I've tried updating the Makefile as follows:

Code:
CPUARCH = cortex-m7
DEFS = -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH
SECTIONS = -ffunction-sections -fdata-sections
DBGFLAGS = -g
CPPFLAGS = $(DBGFLAGS) -Wall -O2 $(SECTIONS) -mcpu=$(CPUARCH) -mthumb -mfloat-abi=hard -mfpu=fpv5-d16 -I. $(DEFS)
CXXFLAGS = -std=gnu++14 -felide-constructors -fno-exceptions -fpermissive -fno-threadsafe-statics -fno-rtti -Wno-error=narrowing
LDFLAGS = -Wl,--gc-sections,--relax,--print-memory-usage -Timxrt1062.ld -larm_cortexM7lfsp_math -lm -lstdc++ -nostdlib --specs=nano.specs

C_FILES := $(wildcard *.c)
CPP_FILES := $(wildcard *.cpp)

OBJS := $(C_FILES:.c=.o) $(CPP_FILES:.cpp=.o)

ARDUINOPATH = /home/andrew/.bin/arduino-1.8.9
COMPILERPATH = $(abspath $(ARDUINOPATH)/hardware/tools/arm/bin)
CC = $(COMPILERPATH)/arm-none-eabi-gcc
CXX = $(COMPILERPATH)/arm-none-eabi-g++
OBJCOPY = $(COMPILERPATH)/arm-none-eabi-objcopy
OBJDUMP = $(COMPILERPATH)/arm-none-eabi-objdump
SIZE = $(COMPILERPATH)/arm-none-eabi-size
AR = $(COMPILERPATH)/arm-none-eabi-gcc-ar

all: Blink.elf

Blink.elf: Blink.o core.a
        $(CC) $(CPPFLAGS) $(LDFLAGS) -o $@ $^
        $(OBJDUMP) -d -S -C $@ > Blink.lst
        $(OBJDUMP) -t -C $@ > Blink.sym
        $(OBJCOPY) -O ihex -R .eeprom $@ Blink.hex
        $(SIZE) $@

core.a: $(OBJS)
        $(AR) rcs core.a $(OBJS)

clean:
        rm -f *.o *.d core.a *.elf *.lst *.sym *.hex
The code compiles fine, prints the memory usage table, and then bails when linking the startup stuff:

Code:
...
/home/andrew/.bin/arduino-1.8.9/hardware/tools/arm/bin/arm-none-eabi-gcc-ar rcs core.a usb_serial.o usb_desc.o rtc.o keylayouts.o nonstd.o digital.o pwm.o interrupt.o bootdata.o tempmon.o analog.o delay.o eeprom.o usb.o clockspeed.o startup.o debugprintf.o HardwareSerial6.o Tone.o WString.o DMAChannel.o EventResponder.o HardwareSerial1.o WMath.o HardwareSerial8.o Print.o usb_inst.o IntervalTimer.o HardwareSerial7.o Stream.o IPAddress.o HardwareSerial2.o HardwareSerial4.o new.o AudioStream.o HardwareSerial3.o yield.o HardwareSerial5.o HardwareSerial.o
/home/andrew/.bin/arduino-1.8.9/hardware/tools/arm/bin/arm-none-eabi-gcc -g -Wall -O2 -ffunction-sections -fdata-sections -mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-d16 -I. -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -Wl,--gc-sections,--relax,--print-memory-usage -Timxrt1062.ld -larm_cortexM7lfsp_math -lm -lstdc++ -nostdlib --specs=nano.specs -o Blink.elf Blink.o core.a
Memory region         Used Size  Region Size  %age Used
            ITCM:        5200 B       512 KB      0.99%
            DTCM:       12960 B       512 KB      2.47%
             RAM:          0 GB       512 KB      0.00%
           FLASH:       11744 B      1984 KB      0.58%
core.a(startup.o): In function `ResetHandler':
/home/andrew/.bin/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/startup.c:116: undefined reference to `__libc_init_array'
core.a(usb.o): In function `usb_init':
/home/andrew/.bin/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/usb.c:171: undefined reference to `memset'
core.a(usb.o): In function `usb_endpoint_config':
/home/andrew/.bin/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/usb.c:548: undefined reference to `memset'
/home/andrew/.bin/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/usb.c:548: undefined reference to `memset'
core.a(usb_serial.o): In function `usb_serial_configure':
/home/andrew/.bin/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/usb_serial.c:92: undefined reference to `memset'
/home/andrew/.bin/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/usb_serial.c:95: undefined reference to `memset'
collect2: error: ld returned 1 exit status
Makefile:27: recipe for target 'Blink.elf' failed
make: *** [Blink.elf] Error 1
What else do I need to change?