mac  m1 chips
follow
https://github.com/gpac/gpac/wiki/GPAC-Build-Guide-for-OSX#mp4box-only
to build

commit 7edc40feef23efd8c9948292d269eae76fa475af (HEAD -> master, origin/master, origin/HEAD)
Author: jeanlf <jeanlf@gpac.io>
Date:   Thu Oct 12 16:58:53 2023 +0200

    Fixed #2625
    

ld: warning: ignoring duplicate libraries: '-lbz2', '-lcaca', '-lfreetype', '-lnghttp2', '-lpng16', '-lpthread', '-lz'
ld: Undefined symbols:
  _memrchr, referenced from:
      _gf_props_parse_value in libgpac_static.a[234](filter_props.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)


---chatgpt answer---

If you are trying to build on Mac, the function `memrchr` is not available in the macOS libc. This function is a GNU extension and is not present on all systems, including macOS. 

You will need to either conditionally use an alternative function when building on Mac, or provide your own implementation of `memrchr`. 

Here's an example of a simple `memrchr` implementation:

```c
void *memrchr(const void *s, int c, size_t n) {
    const unsigned char *cp;
    if (n != 0) {
        cp = (unsigned char *)s + n;
        do {
            if (*(--cp) == (unsigned char)c)
                return (void *)cp;
        } while (--n != 0);
    }
    return NULL;
}
```

You can include this function in your code when you're building on macOS. Be sure to wrap it with an `#ifdef` check to ensure it's only used when `memrchr` is not available:

```c
#ifndef HAVE_MEMRCHR
void *memrchr(const void *s, int c, size_t n) {
    /* ... function code ... */
}
#endif
```
Then, in your build system, ensure that `HAVE_MEMRCHR` is defined when building on systems that have `memrchr`.

build fail in master brach on mac
This is a GitHub Issue
repo:gpac
owner:gpac
Title : build fail in master brach on mac
Issue date:

--- start body ---
mac  m1 chips
follow
https://github.com/gpac/gpac/wiki/GPAC-Build-Guide-for-OSX#mp4box-only
to build

commit 7edc40feef23efd8c9948292d269eae76fa475af (HEAD -> master, origin/master, origin/HEAD)
Author: jeanlf <jeanlf@gpac.io>
Date:   Thu Oct 12 16:58:53 2023 +0200

    Fixed #2625
    

ld: warning: ignoring duplicate libraries: '-lbz2', '-lcaca', '-lfreetype', '-lnghttp2', '-lpng16', '-lpthread', '-lz'
ld: Undefined symbols:
  _memrchr, referenced from:
      _gf_props_parse_value in libgpac_static.a[234](filter_props.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)


---chatgpt answer---

If you are trying to build on Mac, the function `memrchr` is not available in the macOS libc. This function is a GNU extension and is not present on all systems, including macOS. 

You will need to either conditionally use an alternative function when building on Mac, or provide your own implementation of `memrchr`. 

Here's an example of a simple `memrchr` implementation:

```c
void *memrchr(const void *s, int c, size_t n) {
    const unsigned char *cp;
    if (n != 0) {
        cp = (unsigned char *)s + n;
        do {
            if (*(--cp) == (unsigned char)c)
                return (void *)cp;
        } while (--n != 0);
    }
    return NULL;
}
```

You can include this function in your code when you're building on macOS. Be sure to wrap it with an `#ifdef` check to ensure it's only used when `memrchr` is not available:

```c
#ifndef HAVE_MEMRCHR
void *memrchr(const void *s, int c, size_t n) {
    /* ... function code ... */
}
#endif
```
Then, in your build system, ensure that `HAVE_MEMRCHR` is defined when building on systems that have `memrchr`.

--- end body ---

The issue indicates a build failure due to the absence of the `memrchr` function in macOS's libc, which is a GNU extension. This can lead to undefined symbols during the linking stage. To resolve this, an alternative implementation of `memrchr` should be provided for macOS builds.