Menu

Compile time issues on linux

awsdert
2023-01-14
2023-05-21
  • awsdert

    awsdert - 2023-01-14

    Here's one of the many errors that popped up when I tried to compile a project with mingw
    /usr/i686-w64-mingw32/include/_mingw.h:586:14: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__debugbreak’

    Since I'm sure the is an option related thing given how many errors popped up, I'm also gonna provide line it was launched with (with a minor edit to irrelevant paths):

    cc -fPIC -D _WIN32 -mabi=ms -m32 -I "/usr/i686-w64-mingw32/include" -L "/usr/i686-w64-mingw32/lib" -D build_shared_libpaw_min -Wall -Wextra -I ".../include" -o "...r/.paw/_/objs/libpaw-min/buffer.c.shared32.o" -c ".../src/libpaw-min/buffer.c"

    Anyone able to clue me in to the source of the problem?
    BTW I plan to compile under ansi c89 and nolibc later to ensure my project can cope with those options later so if anything needs to be set along side those options for mingw to compile properly I would appreciate info on that too

     
  • awsdert

    awsdert - 2023-01-14

    Resolved it by adding the mingw prefix, for other people who had the same problem and came across this thread, here's a little more clarity with the makefile macros I'm using:

    CC?=cc
    CC32?=i686-w64-mingw32-
    CC64?=x86_64-w64-mingw32-
    

    Edit: Here's the usage too

    ~~~
    build_ext_app=$(CC) -fPIC
    build_ext_elf=$(CC) -fPIC
    build_ext_AppImage=$(CC) -fPIC
    build_ext_dylib=$(CC) -fPIC -shared
    build_ext_so=$(CC) -fPIC -shared
    build_ext_a=$(AR) -rcs
    build_ext_o=$(CC) -fPIC

    build_ext_exe:=
    build_ext_dll:=-fPIC -shared

    build_apple=-D _MAC
    build_win16=-D _WIN16 -mabi=ms
    build_win32=-D _WIN32 -mabi=ms -m32
    build_win64=-D _WIN64 -mabi=ms -m64

    build_bin=$$1 -o "$[TDIR$]/$$2" $3 $$(4:%="$[ODIR$]/%") $(LFLAGS)
    build_obj=$$1$$2 -D build_$$3 $(CFLAGS) $(IFLAGS) -o "$[ODIR$]/$$4" -c "$[HERE$]/$$5"

    ...

    all: lib$(NAME).so lib$(NAME).dylib $(NAME)32.dll $(NAME)64.dll

    lib$(NAME).so: $(shared_objs)
    $(call build_bin,$(build_ext_so),$@,,$(shared_objs))

    lib$(NAME).dylib: $(shared_objs:%.o=%-mac.o)
    $(call build_bin,$(build_ext_dylib),$@,,$(shared_objs:%.o=%-mac.o))

    $(NAME)32.dll: $(shared_objs:%.o=%32.o)
    $(call build_bin,$(build_ext_dll),$@,,$(shared_objs:%.o=%32.o))

    $(NAME)64.dll: $(shared_objs:%.o=%64.o)
    $(call build_bin,$(build_ext_dll),$@,,$(shared_objs:%.o=%64.o))

    %.c.shared.o: %.c
    $(call build_obj,,$(build_ext_o),shared_$(DECL),$@,$<)

    %.c.shared-mac.o: %.c
    $(call build_obj,,$(build_ext_o) $(build_apple),shared_$(DECL),$@,$<)

    %.c.shared32.o: %.c
    $(call build_obj,$(CC32),$(build_ext_o) $(build_win32),shared_$(DECL),$@,$<)

    %.c.shared64.o: %.c
    $(call build_obj,$(CC64),$(build_ext_o) $(build_win64),shared_$(DECL),$@,$<)
    ~~~

     

    Last edit: awsdert 2023-01-14

Log in to post a comment.