conda-forge / conda-forge/linux-sysroot-feedstock

Undefined reference to `__libc_single_threaded`

Abierto
#61 0 comentarios 0 reacciones 0 asignados Ver en GitHub
question
Lenguaje dominante
Python
Estrellas
5
Forks
18
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### Comment:

Preface: I think this question is suited for this feedstock but feel free to re-direct me to another resource/area that is better suited.

Hi All,

I'm building a program that uses `pthreads` with a host that has GLIBC version of `2.37` but I'm encountering errors when building. Specifically I'm seeing an error that `__libc_single_threaded` is undefined.

Here is the program I'm compiling (simplified to just point to the `__libc_single_threaded` variable that is missing):

File: `a.c`
```
extern char __libc_single_threaded;

int main(void) {
return __libc_single_threaded;
}
```

Conda environment file: `temp-env.yaml`
```
channels:
- conda-forge
- nodefaults
dependencies:
- gcc
- gxx
- sysroot_linux-64
- conda-gcc-specs
- binutils
```

Cmdline (creates failure)
```
g++ a.c -o out
```

Error seen
```
<>/temp-env/bin/../lib/gcc/x86_64-conda-linux-gnu/13.2.0/../../../../x86_64-conda-linux-gnu/bin/ld: /tmp/ccGSVWOR.o: warning: relocation against `__libc_single_threaded' in read-only section `.text'
<>/temp-env/bin/../lib/gcc/x86_64-conda-linux-gnu/13.2.0/../../../../x86_64-conda-linux-gnu/bin/ld: /tmp/ccGSVWOR.o: in function `main':
a.c:(.text+0x7): undefined reference to `__libc_single_threaded'
<>/temp-env/bin/../lib/gcc/x86_64-conda-linux-gnu/13.2.0/../../../../x86_64-conda-linux-gnu/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
```

Running a similar compile with the host compiler works. From my understanding this is because the isolated conda environment `libc` doesn't have the `__libc_single_threaded` variable defined while the host `libc` does? Is this an issue with the sysroot/environment that conda bundles together or do I need to somehow link against the `libc` of the host to get the variable?

Thanks in advance for any help or guidance!

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.