Skip to content

Commit 173f4bc

Browse files
committed
try to document c_stdlib_version in knowledge base
1 parent 9b6a94d commit 173f4bc

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Diff for: docs/maintainer/knowledge_base.md

+29
Original file line numberDiff line numberDiff line change
@@ -1928,6 +1928,35 @@ os_version:
19281928

19291929
Finally, note that the `aarch64` and `ppc64le` platforms already use CentOS 7.
19301930

1931+
<a id="consequences-of-newer-c-stdlib-version"></a>
1932+
1933+
### Consequences of newer c_stdlib_version
1934+
1935+
If a library links a newer version of `c_stdlib_version`,
1936+
the _runtime_ requirement on `__glibc` is applied
1937+
but it does not mean downstream dependencies will (or should) be built against the same version.
1938+
The default `c_stdlib_version` is still `2.12` on linux-64.
1939+
**A dependency on a newer `c_stdlib_version` does not mean dependents must also use that version**.
1940+
However, to build a package with `c_stdlib_version=2.12` that links a library built with `c_stdlib_version=2.17`,
1941+
the linker flag `-Wl,--allow-shlib-undefined` must be specified.
1942+
Without `--allow-shlib-undefined`, you may see errors like:
1943+
1944+
```
1945+
ld: $PREFIX/lib/libc++abi.so: undefined reference to `memcpy@GLIBC_2.14'
1946+
ld: $PREFIX/lib/libpmix.so.2: undefined reference to `clock_gettime@GLIBC_2.17'
1947+
```
1948+
1949+
This flag is in conda-forge's default $LDFLAGS set by the `{{ compiler("c") }}` package,
1950+
so most recipes should not need to be aware that a dependency has updated to newer `c_stdlib_version`.
1951+
If they do, it means $LDFLAGS is not being handled consistently,
1952+
which is probably something feedstock and/or package maintainers should consider fixing.
1953+
1954+
There is more nuance in runtime compilation in user environments,
1955+
which are also affected by the default version of `sysroot_linux-64` being 2.12.
1956+
The `gcc` package does not set environment variables $CC, $LDFLAGS, etc..
1957+
To set these variables on environment activation, install the `c-compiler` package (or `gcc_linux-64` on linux-64),
1958+
or set them by hand in the environment, or avoid the issue by specifying `sysroot_linux-64>=2.17` in the environment.
1959+
19311960
<a id="cuda"></a>
19321961

19331962
<a id="cuda-builds"></a>

0 commit comments

Comments
 (0)