tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: cross-compiling packages



On 05.11.2020 05:22, Brook Milligan wrote:
mips64--netbsd-gcc -D_LARGEFILE_SOURCE -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -DDEF_UMASK=0022 -I/path/to/pkgsrc/pkgtools/pkg_install/work.mips64/libfetch -I/path/to/pkgsrc/pkgtools/pkg_install/work.mips64 -DHAVE_NBCOMPAT_H=1 -I/path/to/pkgsrc/pkgtools/pkg_install/work.mips64/libnbcompat -I/usr/include -D__DBINTERFACE_PRIVATE -I. -I.  -O2 -D_FORTIFY_SOURCE=2 -I/usr/include -DHAVE_CONFIG_H -c snprintf.c
In file included from /path/to/src/obj/destdir.evbmips/usr/include/stdio.h:602,
                  from /path/to/pkgsrc/pkgtools/pkg_install/work.mips64/libnbcompat/nbcompat/stdio.h:40,
                  from /path/to/pkgsrc/pkgtools/pkg_install/work.mips64/libnbcompat/nbcompat.h:61,
                  from snprintf.c:28:
snprintf.c:43:1: error: expected declaration specifiers or '...' before numeric constant
    43 | snprintf(char *str, size_t size, const char *format, ...)
       | ^~~~~~~~

This looks like a C preprocessor issue to me.  Did you already have a
look at the preprocessed source?  To make that easy, you can add the
following lines to your mk.conf (taken from the bottom of
usr.bin/make/Makefile):

.SUFFIXES: .cpre .casm
.c.cpre:
	${COMPILE.c:S,^-c$,-E,} ${COPTS.${.IMPSRC}} ${.IMPSRC} -o ${.TARGET}
.c.casm:
	${COMPILE.c:S,^-c$,-S,} ${COPTS.${.IMPSRC}} ${.IMPSRC} -o ${.TARGET}

These allow you to run "make snprintf.cpre" and inspect that file,
passing almost all necessary CFLAGS to the compiler.  In usr.bin/make, I
left out CPUFLAGS.${.IMPSRC} and CPPFLAGS.${.IMPSRC} from the above
since I don't need them, but in general these should be added as well.
I took the basic definition from the .c.o rule in share/mk/bsd.sys.mk.

Roland


Home | Main Index | Thread Index | Old Index