This allow the tcc cross compilers to work as expected, when tcc was build with '--enable-cross' and a simple config-extra.mak (see the provided config-extra.mak.example). Make sure, that cross development packages for libc are installed Fixes also open bugs in various bug tracker. Example in debian: 940469 tcc: error: library 'c' not found tcc: error: file 'crtn.o' not found tcc: error: undefined symbol 'printf'
Unified · Split
| @@ -0,0 +1,27 @@ | ||
| 1 | +# | |
| 2 | +# during 'make', this file is included from the tcc Makefile | |
| 3 | +# | |
| 4 | +# this is an example, how to help tcc to find | |
| 5 | +# the c library and the startup files for cross compiling. | |
| 6 | +# | |
| 7 | +# we expect here, that the GNU libc is used and that the related development files | |
| 8 | +# are installed in a subdirectory with the target triplet used by gcc | |
| 9 | +# | |
| 10 | + | |
| 11 | +# set CONFIG_TRIPLET for cross compiler targets | |
| 12 | +DEF-i386+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"i386-linux-gnu\" " | |
| 13 | +DEF-x86_64+=-UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"x86_64-linux-gnu\" " | |
| 14 | + | |
| 15 | +# many api/fp combinations are possible for arm | |
| 16 | +DEF-arm+=-UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"arm-linux-gnueabihf\" " | |
| 17 | +DEF-arm64+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"aarch64-linux-gnu\" " | |
| 18 | + | |
| 19 | +DEF-riscv64+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"riscv64-linux-gnu\" " | |
| 20 | +# For win32/win64 targets, we expect mingw 64 | |
| 21 | +# is is for additional packes, as tcc has ist own win32 startfiles | |
| 22 | +DEF-i386-win32+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"i686-w64-mingw32\" " | |
| 23 | +DEF-x86_64-win32+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"x86_64-w64-mingw32\" " | |
| 24 | + | |
| 25 | +# is a free cross compile toolchain for macos available? | |
| 26 | +#DEF-x86_64-osx+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"x86_64-apple-darwin\" " | |
| 27 | +#DEF-arm64-osx+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"aarch64-apple-darwin\" " | |
| @@ -260,7 +260,9 @@ extern long double strtold (const char *__nptr, char **__endptr); · 259 unmodified lines | ||
| 260 | 260 | |
| 261 | 261 | /* path to find crt1.o, crti.o and crtn.o */ |
| 262 | 262 | #ifndef CONFIG_TCC_CRTPREFIX |
| 263 | −# define CONFIG_TCC_CRTPREFIX USE_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) | |
| 263 | +# define CONFIG_TCC_CRTPREFIX \ | |
| 264 | + ALSO_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) \ | |
| 265 | + ":" USE_TRIPLET(CONFIG_SYSROOT "/usr") "/lib" | |
| 264 | 266 | #endif |
| 265 | 267 | |
| 266 | 268 | #ifndef CONFIG_USR_INCLUDE |
| @@ -277,6 +279,8 @@ extern long double strtold (const char *__nptr, char **__endptr); · 10 unmodified lines | ||
| 277 | 279 | # define CONFIG_TCC_SYSINCLUDEPATHS \ |
| 278 | 280 | "{B}/include" \ |
| 279 | 281 | ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/include") \ |
| 282 | + ":" USE_TRIPLET(CONFIG_SYSROOT "/usr") "/include" \ | |
| 283 | + ":" USE_TRIPLET(CONFIG_SYSROOT "/usr/local") "/include" \ | |
| 280 | 284 | ":" ALSO_TRIPLET(CONFIG_SYSROOT CONFIG_USR_INCLUDE) |
| 281 | 285 | # endif |
| 282 | 286 | #endif |
| @@ -289,6 +293,8 @@ extern long double strtold (const char *__nptr, char **__endptr); · 6 unmodified lines | ||
| 289 | 293 | # define CONFIG_TCC_LIBPATHS \ |
| 290 | 294 | "{B}" \ |
| 291 | 295 | ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) \ |
| 296 | + ":" USE_TRIPLET(CONFIG_SYSROOT "/usr") "/lib" \ | |
| 297 | + ":" USE_TRIPLET(CONFIG_SYSROOT "/usr/local") "/lib" \ | |
| 292 | 298 | ":" ALSO_TRIPLET(CONFIG_SYSROOT "/" CONFIG_LDDIR) \ |
| 293 | 299 | ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/" CONFIG_LDDIR) |
| 294 | 300 | # endif |