tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: cross-compiling packages
> On Nov 5, 2020, at 1:00 AM, Roland Illig <roland.illig%gmx.de@localhost> wrote:
>
> 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.
Thanks for the suggestion. This more or less worked after some tweaking; I had to put the tooldir in my path for example.
Here are lines 42 and 43 in snprintf.c:
int
snprintf(char *str, size_t size, const char *format, ...)
Here is what I think is the section of the preprocessed file that it chokes on:
# 42 "snprintf.c"
int
# 43 "snprintf.c" 3 4
__builtin___snprintf_chk(
# 43 "snprintf.c"
char *str
# 43 "snprintf.c" 3 4
,
# 43 "snprintf.c"
size_t size
# 43 "snprintf.c" 3 4
, 0, __builtin_object_size(
# 43 "snprintf.c"
char *str
# 43 "snprintf.c" 3 4
, 2 > 1),
# 43 "snprintf.c"
const char *format, ...
# 43 "snprintf.c" 3 4
)
which translates to (included for my sanity)
int __builtin___snprintf_chk(char *str, size_t size, 0, __builtin_object_size(char *str, 2 > 1), const char *format, ...)
Does this make sense? Why the values instead of types? I have never looked at the magic created by the preprocessor, so please advise.
If this is not correct, what is causing the problem? Where do I start looking?
Thanks a lot for any help.
Cheers,
Brook
Home |
Main Index |
Thread Index |
Old Index