Created
March 23, 2023 19:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Code: | |
#include <fts.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <limits.h> | |
#if defined __stub_fts_open || defined __stub___fts_open | |
fail fail fail this function is not going to work | |
#endif | |
int main(void) { | |
void *a = (void*) &fts_open; | |
long long b = (long long) a; | |
return (int) b; | |
} | |
Compiler stdout: | |
Compiler stderr: | |
In file included from /home/andy/src/rmw/builddir/meson-private/tmp61m8hu03/testfile.c:1: | |
/usr/include/fts.h:42:2: error: unknown type name 'dev_t' | |
dev_t fts_dev; /* starting device # */ | |
^ | |
/usr/include/fts.h:45:2: error: unknown type name 'size_t' | |
size_t fts_pathlen; /* sizeof(path) */ | |
^ | |
/usr/include/fts.h:73:2: error: unknown type name 'size_t' | |
size_t fts_pathlen; /* strlen(fts_path) */ | |
^ | |
/usr/include/fts.h:74:2: error: unknown type name 'size_t' | |
size_t fts_namelen; /* strlen(fts_name) */ | |
^ | |
/usr/include/fts.h:76:2: error: unknown type name 'ino_t' | |
ino_t fts_ino; /* inode */ | |
^ | |
/usr/include/fts.h:77:2: error: unknown type name 'dev_t' | |
dev_t fts_dev; /* device */ | |
^ | |
/usr/include/fts.h:78:2: error: unknown type name 'nlink_t' | |
nlink_t fts_nlink; /* link count */ | |
^ | |
/usr/include/fts.h:116:1: error: unknown type name '__BEGIN_DECLS' | |
__BEGIN_DECLS | |
^ | |
/usr/include/fts.h:117:7: error: expected ';' after top level declarator | |
FTSENT *fts_children(FTS *, int); | |
^ | |
/usr/include/fts.h:123:1: error: unknown type name '__END_DECLS' | |
__END_DECLS | |
^ | |
10 errors generated. | |
Running compile: | |
Working directory: /home/andy/src/rmw/builddir/meson-private/tmp5gdl2ysm | |
Command line: cc /home/andy/src/rmw/builddir/meson-private/tmp5gdl2ysm/testfile.c -o /home/andy/src/rmw/builddir/meson-private/tmp5gdl2ysm/output.exe -D_FILE_OFFSET_BITS=64 -O0 | |
Code: | |
#include <fts.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
int main(void) { | |
/* With some toolchains (MSYS2/mingw for example) the compiler | |
* provides various builtins which are not really implemented and | |
* fall back to the stdlib where they aren't provided and fail at | |
* build/link time. In case the user provides a header, including | |
* the header didn't lead to the function being defined, and the | |
* function we are checking isn't a builtin itself we assume the | |
* builtin is not functional and we just error out. */ | |
#if !0 && !defined(fts_open) && !0 | |
#error "No definition for __builtin_fts_open found in the prefix" | |
#endif | |
#ifdef __has_builtin | |
#if !__has_builtin(__builtin_fts_open) | |
#error "__builtin_fts_open not found" | |
#endif | |
#elif ! defined(fts_open) | |
__builtin_fts_open; | |
#endif | |
return 0; | |
} | |
Compiler stdout: | |
Compiler stderr: | |
In file included from /home/andy/src/rmw/builddir/meson-private/tmp5gdl2ysm/testfile.c:1: | |
/usr/include/fts.h:42:2: error: unknown type name 'dev_t' | |
dev_t fts_dev; /* starting device # */ | |
^ | |
/usr/include/fts.h:45:2: error: unknown type name 'size_t' | |
size_t fts_pathlen; /* sizeof(path) */ | |
^ | |
/usr/include/fts.h:73:2: error: unknown type name 'size_t' | |
size_t fts_pathlen; /* strlen(fts_path) */ | |
^ | |
/usr/include/fts.h:74:2: error: unknown type name 'size_t' | |
size_t fts_namelen; /* strlen(fts_name) */ | |
^ | |
/usr/include/fts.h:76:2: error: unknown type name 'ino_t' | |
ino_t fts_ino; /* inode */ | |
^ | |
/usr/include/fts.h:77:2: error: unknown type name 'dev_t' | |
dev_t fts_dev; /* device */ | |
^ | |
/usr/include/fts.h:78:2: error: unknown type name 'nlink_t' | |
nlink_t fts_nlink; /* link count */ | |
^ | |
/usr/include/fts.h:116:1: error: unknown type name '__BEGIN_DECLS' | |
__BEGIN_DECLS | |
^ | |
/usr/include/fts.h:117:7: error: expected ';' after top level declarator | |
FTSENT *fts_children(FTS *, int); | |
^ | |
/usr/include/fts.h:123:1: error: unknown type name '__END_DECLS' | |
__END_DECLS | |
^ | |
/home/andy/src/rmw/builddir/meson-private/tmp5gdl2ysm/testfile.c:14:14: error: "No definition for __builtin_fts_open found in the prefix" | |
#error "No definition for __builtin_fts_open found in the prefix" | |
^ | |
/home/andy/src/rmw/builddir/meson-private/tmp5gdl2ysm/testfile.c:19:18: error: "__builtin_fts_open not found" | |
#error "__builtin_fts_open not found" | |
^ | |
12 errors generated. | |
Checking for function "fts_open" : NO | |
Running compile: | |
Working directory: /home/andy/src/rmw/builddir/meson-private/tmp1ty_tjf0 | |
Command line: cc /home/andy/src/rmw/builddir/meson-private/tmp1ty_tjf0/testfile.c -o /home/andy/src/rmw/builddir/meson-private/tmp1ty_tjf0/output.exe -D_FILE_OFFSET_BITS=64 -O0 -Wl,--start-group -lfts -Wl,--end-group -Wl,--allow-shlib-undefined | |
Code: | |
int main(void) { return 0; } | |
Compiler stdout: | |
Compiler stderr: | |
ld: error: unable to find library -lfts | |
cc: error: linker command failed with exit code 1 (use -v to see invocation) | |
src/bsdutils/meson.build:3:4: ERROR: C shared or static library 'fts' not found |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment