View Single Post
Old 03 January 2021, 11:21   #1
Emufr3ak
Registered User
 
Join Date: Mar 2016
Location: Thun / Switzerland
Posts: 57
stdlib amiga gcc

Maybe Some c/c++ gurus can help.



I'm trying to port some C++ code to Amiga. I'm using abyss visual studio code plugin for development.


For some basic c++ functions like the new operator stdlib is required. On linking stage I get errors like this:


.../ld.exe: cannot find crtbegin.o: No such file or directory
.../ld.exe: cannot find -lgcc
.../ld.exe: cannot find -lc



This is my Makefile. It's the default Makefile from abyss. I just removed the flag -nostdlib.



# to generate assembler sources: -Wa,-ahl=$@.s

forward-to-backward = $(subst /,\,$1)

subdirs := $(wildcard */)
VPATH = $(subdirs)
cpp_sources := $(wildcard *.cpp)$(wildcard $(addsuffix *.cpp,$(subdirs)))
cpp_objects := $(addprefix obj/,$(patsubst %.cpp,%.o,$(notdir $(cpp_sources))))
c_sources := $(wildcard *.c)$(wildcard $(addsuffix *.c,$(subdirs)))
c_objects := $(addprefix obj/,$(patsubst %.c,%.o,$(notdir $(c_sources))))
objects := $(cpp_objects)$(c_objects)

# https://stackoverflow.com/questions/...kefile/4038459
# http://www.microhowto.info/howto/aut...endencies.html

OUT = a.mingw
CC = m68k-amiga-elf-gcc

CCFLAGS = -g -MP -MMD -m68000 -Ofast -std=gnu++11 -Wall -Wno-unused-function -Wno-volatile-register-var -fomit-frame-pointer -fno-tree-loop-distribution -flto -fwhole-program -fno-exceptions
ASFLAGS = -Wa,-g
LDFLAGS = -Wl,--emit-relocs,-Ttext=0,-Map=$(OUT).map

all: $(OUT).exe

$(OUT).exe: $(OUT).elf
$(info Elf2Hunk $(OUT).exe)
@elf2hunk $(OUT).elf $(OUT).exe

$(OUT).elf: $(objects) obj/gcc8_a_support.o
$(info Linking a.mingw.elf)
@$(CC)$(CCFLAGS)$(LDFLAGS)$(objects) obj/gcc8_a_support.o -o $@
@m68k-amiga-elf-objdump --disassemble -S $@ >$(OUT).s

obj/gcc8_a_support.o: support/gcc8_a_support.s
$(info Assembling $<)
@$(CC)$(CCFLAGS)$(ASFLAGS) -xassembler-with-cpp -c -o $@$(CURDIR)/$<

clean:
$(info Cleaning...)
@del /q obj $(OUT).* 2>nul || rmdir obj 2>nul || ver>nul

-include$(objects:.o=.d)

$(cpp_objects) : obj/%.o : %.cpp
@if not exist "$(call forward-to-backward,$(dir$@))" mkdir $(call forward-to-backward,$(dir$@))
$(info Compiling $<)
@$(CC)$(CCFLAGS) -c -o $@$(CURDIR)/$<

$(c_objects) : obj/%.o : %.c
@if not exist "$(call forward-to-backward,$(dir$@))" mkdir $(call forward-to-backward,$(dir$@))
$(info Compiling $<)
@$(CC)$(CCFLAGS) -c -o $@$(CURDIR)/$<


Emufr3ak is offline  
 
Page generated in 0.07177 seconds with 11 queries