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

Undefined reference to `__libc_single_threaded`

Offen
#61 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
question
Vorherrschende Sprache
Python
Sterne
5
Forks
18
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### 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!

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.