History

tcc.h: Extend search path for include, lib and crt

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'

Detlef Riekenberg committed 4 years ago

Commit 2507c711 parent fa256302 files · +34 −1Browse files

Unified · Split

2 files
  1. config-extra.mak.example +27 −0
  2. tcc.h +7 −1
config-extra.mak.example+27−0
@@ -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
12DEF-i386+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"i386-linux-gnu\" "
13DEF-x86_64+=-UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"x86_64-linux-gnu\" "
14
15# many api/fp combinations are possible for arm
16DEF-arm+=-UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"arm-linux-gnueabihf\" "
17DEF-arm64+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"aarch64-linux-gnu\" "
18
19DEF-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
22DEF-i386-win32+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"i686-w64-mingw32\" "
23DEF-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\" "
tcc.h+7−1
@@ -260,7 +260,9 @@ extern long double strtold (const char *__nptr, char **__endptr); · 259 unmodified lines
260 260
261/* path to find crt1.o, crti.o and crtn.o */261/* path to find crt1.o, crti.o and crtn.o */
262#ifndef CONFIG_TCC_CRTPREFIX262#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#endif266#endif
265 267
266#ifndef CONFIG_USR_INCLUDE268#ifndef CONFIG_USR_INCLUDE
@@ -277,6 +279,8 @@ extern long double strtold (const char *__nptr, char **__endptr); · 10 unmodified lines
277# define CONFIG_TCC_SYSINCLUDEPATHS \279# define CONFIG_TCC_SYSINCLUDEPATHS \
278 "{B}/include" \280 "{B}/include" \
279 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/include") \281 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/include") \
282 ":" USE_TRIPLET(CONFIG_SYSROOT "/usr") "/include" \
283 ":" USE_TRIPLET(CONFIG_SYSROOT "/usr/local") "/include" \
280 ":" ALSO_TRIPLET(CONFIG_SYSROOT CONFIG_USR_INCLUDE)284 ":" ALSO_TRIPLET(CONFIG_SYSROOT CONFIG_USR_INCLUDE)
281# endif285# endif
282#endif286#endif
@@ -289,6 +293,8 @@ extern long double strtold (const char *__nptr, char **__endptr); · 6 unmodified lines
289# define CONFIG_TCC_LIBPATHS \293# define CONFIG_TCC_LIBPATHS \
290 "{B}" \294 "{B}" \
291 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) \295 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) \
296 ":" USE_TRIPLET(CONFIG_SYSROOT "/usr") "/lib" \
297 ":" USE_TRIPLET(CONFIG_SYSROOT "/usr/local") "/lib" \
292 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/" CONFIG_LDDIR) \298 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/" CONFIG_LDDIR) \
293 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/" CONFIG_LDDIR)299 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/" CONFIG_LDDIR)
294# endif300# endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t