Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure: Possible conflicting strlcpy definitions on macOS #66

Closed
Neved4 opened this issue Aug 4, 2024 · 3 comments · Fixed by #71
Closed

Build failure: Possible conflicting strlcpy definitions on macOS #66

Neved4 opened this issue Aug 4, 2024 · 3 comments · Fixed by #71

Comments

@Neved4
Copy link

Neved4 commented Aug 4, 2024

awtfdb fails to zig build on macOS.

Errors raised point to system headers and several macros (strlcpy, __darwin_obsz, _USE_FORTIFY_LEVEL) as well as conflicting types:

~/.cache/zig/p/<id>/src/strlcpy.c:31:1: error: expected parameter declarator
  strlcpy(char *dst, const char *src, size_t siz)
  ^

~/.cache/zig/p/<id>/src/strlcpy.c:31:1: error: expected ')'
  strlcpy(char *dst, const char *src, size_t siz)
  ^

~/.cache/zig/p/<id>/src/strlcpy.c:31:1: error: type specifier missing,
defaults to 'int'; ISO C99 and later do not support implicit int
  strlcpy(char *dst, const char *src, size_t siz)
  ^

~/.cache/zig/p/<id>/src/strlcpy.c:31:1: error: conflicting types for '__builtin___strlcpy_chk'
  strlcpy(char *dst, const char *src, size_t siz)
  ^

Build Summary: 3/8 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
├─ install wrapper-awtfdb transitive failure
│  └─ zig build-exe wrapper-awtfdb Debug native transitive failure
│     └─ zig build-lib libmagic Debug native 4 errors
└─ link the utils transitive failure
   └─ zig build-exe wrapper-awtfdb Debug native (+6 more reused dependencies)

System details

  • OS: macOS
  • System version: 14.6
  • Xcode Command Line Tools version: 2408
  • Zig version: 12.1
  • Arch: arm64
  • Awtfdb version: 0.3.0
@lun-4
Copy link
Owner

lun-4 commented Aug 4, 2024

note to self, fails to crosscompile as well with the same looking errors, from running zig build -Dtarget=x86_64-macos-none -Doptimize=ReleaseSafe -Dcpu=x86_64_v2 in my linux host

this is a regression from #1, CI should be added to prevent it in the future, as well as bumping to zig 0.13


/home/luna/.cache/zig/p/12202b523979650f48ed9d6a7ed263a28772f12b6c552cf72011fc6b979fb15e9090/src/strlcpy.c:31:1: error: expected parameter declarator
strlcpy(char *dst, const char *src, size_t siz)
^
/home/luna/.zvm/0.12.0/lib/libc/include/any-macos-any/secure/_string.h:112:47: note: expanded from macro 'strlcpy'
  __builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                              ^
/home/luna/.zvm/0.12.0/lib/libc/include/any-macos-any/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
                                                             ^
/home/luna/.zvm/0.12.0/lib/libc/include/any-macos-any/secure/_common.h:30:32: note: expanded from macro '_USE_FORTIFY_LEVEL'
#    define _USE_FORTIFY_LEVEL 2
                               ^
/home/luna/.cache/zig/p/12202b523979650f48ed9d6a7ed263a28772f12b6c552cf72011fc6b979fb15e9090/src/strlcpy.c:31:1: error: expected ')'
strlcpy(char *dst, const char *src, size_t siz)
^
/home/luna/.zvm/0.12.0/lib/libc/include/any-macos-any/secure/_string.h:112:47: note: expanded from macro 'strlcpy'
  __builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                              ^
/home/luna/.zvm/0.12.0/lib/libc/include/any-macos-any/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
                                                             ^
/home/luna/.zvm/0.12.0/lib/libc/include/any-macos-any/secure/_common.h:30:32: note: expanded from macro '_USE_FORTIFY_LEVEL'
#    define _USE_FORTIFY_LEVEL 2
                               ^
/home/luna/.cache/zig/p/12202b523979650f48ed9d6a7ed263a28772f12b6c552cf72011fc6b979fb15e9090/src/strlcpy.c:31:1: note: to match this '('
strlcpy(char *dst, const char *src, size_t siz)
^
/home/luna/.zvm/0.12.0/lib/libc/include/any-macos-any/secure/_string.h:112:47: note: expanded from macro 'strlcpy'
  __builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                              ^
/home/luna/.zvm/0.12.0/lib/libc/include/any-macos-any/secure/_common.h:39:53: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
                                                    ^
/home/luna/.cache/zig/p/12202b523979650f48ed9d6a7ed263a28772f12b6c552cf72011fc6b979fb15e9090/src/strlcpy.c:31:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int
strlcpy(char *dst, const char *src, size_t siz)
^
/home/luna/.zvm/0.12.0/lib/libc/include/any-macos-any/secure/_string.h:112:47: note: expanded from macro 'strlcpy'
  __builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                              ^
/home/luna/.zvm/0.12.0/lib/libc/include/any-macos-any/secure/_common.h:39:31: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
                              ^
/home/luna/.cache/zig/p/12202b523979650f48ed9d6a7ed263a28772f12b6c552cf72011fc6b979fb15e9090/src/strlcpy.c:31:1: error: conflicting types for '__builtin___strlcpy_chk'
strlcpy(char *dst, const char *src, size_t siz)
^
/home/luna/.zvm/0.12.0/lib/libc/include/any-macos-any/secure/_string.h:112:3: note: expanded from macro 'strlcpy'
  __builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
  ^
/home/luna/.cache/zig/p/12202b523979650f48ed9d6a7ed263a28772f12b6c552cf72011fc6b979fb15e9090/src/strlcpy.c:31:1: note: '__builtin___strlcpy_chk' is a builtin with type 'unsigned long (char *, const char *, unsigned long, unsigned long)'
strlcpy(char *dst, const char *src, size_t siz)
^
/home/luna/.zvm/0.12.0/lib/libc/include/any-macos-any/secure/_string.h:112:3: note: expanded from macro 'strlcpy'
  __builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))

@Neved4 Neved4 changed the title Build failure on macOS, possible conflicting strlcpy definitions Build failure: Possible conflicting strlcpy definitions on macOS Aug 7, 2024
@lun-4 lun-4 closed this as completed in #71 Jan 5, 2025
@lun-4 lun-4 reopened this Jan 5, 2025
@lun-4
Copy link
Owner

lun-4 commented Jan 5, 2025

thanks github. please validate a macos build works by installing gettext: brew install gettext / port install gettext-runtime

@Neved4
Copy link
Author

Neved4 commented Jan 7, 2025

Fixed, thx!

@Neved4 Neved4 closed this as completed Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants