Skip to content

Segmentation Faults during build on NetBSD configuring with --enable-profiling #126099

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

Open
furkanonder opened this issue Oct 29, 2024 · 1 comment
Labels
3.12 only security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes build The build process and cross-build OS-netbsd type-bug An unexpected behavior, bug, or error

Comments

@furkanonder
Copy link
Contributor

furkanonder commented Oct 29, 2024

Bug report

Bug description:

Configuration:

./configure --with-pydebug -enable-profiling --disable-ipv6 && make -j5

Output: full.txt

--- Programs/_freeze_module ---
gcc -pthread -pg    -o Programs/_freeze_module Programs/_freeze_module.o Modules/getpath_noop.o Modules/getbuildinfo.o  Parser/token.o Parser/pegen.o  Parser/pegen_errors.o  Parser/action_helpers.o  Parser/parser.o  Parser/string_parser.o  Parser/peg_api.o Parser/lexer/buffer.o  Parser/lexer/lexer.o  Parser/lexer/state.o  Parser/tokenizer/file_tokenizer.o  Parser/tokenizer/readline_tokenizer.o  Parser/tokenizer/string_tokenizer.o  Parser/tokenizer/utf8_tokenizer.o  Parser/tokenizer/helpers.o Parser/myreadline.o  Objects/abstract.o  Objects/boolobject.o  Objects/bytes_methods.o  Objects/bytearrayobject.o  Objects/bytesobject.o  Objects/call.o  Objects/capsule.o  Objects/cellobject.o  Objects/classobject.o  Objects/codeobject.o  Objects/complexobject.o  Objects/descrobject.o  Objects/enumobject.o  Objects/exceptions.o  Objects/genericaliasobject.o  Objects/genobject.o  Objects/fileobject.o  Objects/floatobject.o  Objects/frameobject.o  Objects/funcobject.o  Objects/iterobject.o  Objects/listobject.o  Objects/longobject.o  Objects/dictobject.o  Objects/odictobject.o  Objects/memoryobject.o  Objects/methodobject.o  Objects/moduleobject.o  Objects/namespaceobject.o  Objects/object.o  Objects/obmalloc.o  Objects/picklebufobject.o  Objects/rangeobject.o  Objects/setobject.o  Objects/sliceobject.o  Objects/structseq.o  Objects/tupleobject.o  Objects/typeobject.o  Objects/typevarobject.o  Objects/unicodeobject.o  Objects/unicodectype.o  Objects/unionobject.o  Objects/weakrefobject.o  Python/_warnings.o  Python/Python-ast.o  Python/Python-tokenize.o  Python/asdl.o  Python/assemble.o  Python/ast.o  Python/ast_opt.o  Python/ast_unparse.o  Python/bltinmodule.o  Python/brc.o  Python/ceval.o  Python/codecs.o  Python/codegen.o  Python/compile.o  Python/context.o  Python/critical_section.o  Python/crossinterp.o  Python/dynamic_annotations.o  Python/errors.o  Python/flowgraph.o  Python/frame.o  Python/frozenmain.o  Python/future.o  Python/gc.o  Python/gc_free_threading.o  Python/gc_gil.o  Python/getargs.o  Python/getcompiler.o  Python/getcopyright.o  Python/getplatform.o  Python/getversion.o  Python/ceval_gil.o  Python/hamt.o  Python/hashtable.o  Python/import.o  Python/importdl.o  Python/initconfig.o  Python/interpconfig.o  Python/instrumentation.o  Python/instruction_sequence.o  Python/intrinsics.o  Python/jit.o  Python/legacy_tracing.o  Python/lock.o  Python/marshal.o  Python/modsupport.o  Python/mysnprintf.o  Python/mystrtoul.o  Python/object_stack.o  Python/optimizer.o  Python/optimizer_analysis.o  Python/optimizer_symbols.o  Python/parking_lot.o  Python/pathconfig.o  Python/preconfig.o  Python/pyarena.o  Python/pyctype.o  Python/pyfpe.o  Python/pyhash.o  Python/pylifecycle.o  Python/pymath.o  Python/pystate.o  Python/pythonrun.o  Python/pytime.o  Python/qsbr.o  Python/bootstrap_hash.o  Python/specialize.o  Python/structmember.o  Python/symtable.o  Python/sysmodule.o  Python/thread.o  Python/traceback.o  Python/tracemalloc.o  Python/uniqueid.o  Python/getopt.o  Python/pystrcmp.o  Python/pystrtod.o  Python/pystrhex.o  Python/dtoa.o  Python/formatter_unicode.o  Python/fileutils.o  Python/suggestions.o  Python/perf_trampoline.o  Python/perf_jit_trampoline.o  Python/dynload_shlib.o        Modules/config.o  Modules/main.o  Modules/gcmodule.o  Modules/atexitmodule.o  Modules/faulthandler.o  Modules/posixmodule.o  Modules/signalmodule.o  Modules/_tracemalloc.o  Modules/_suggestions.o  Modules/_codecsmodule.o  Modules/_collectionsmodule.o  Modules/errnomodule.o  Modules/_io/_iomodule.o Modules/_io/iobase.o Modules/_io/fileio.o Modules/_io/bytesio.o Modules/_io/bufferedio.o Modules/_io/textio.o Modules/_io/stringio.o  Modules/itertoolsmodule.o  Modules/_sre/sre.o  Modules/_sysconfig.o  Modules/_threadmodule.o  Modules/timemodule.o  Modules/_typingmodule.o  Modules/_weakref.o  Modules/_abc.o  Modules/_functoolsmodule.o  Modules/_localemodule.o  Modules/_opcode.o  Modules/_operator.o  Modules/_stat.o  Modules/symtablemodule.o  Modules/pwdmodule.o -lintl -lpthread  -lutil                           -lm
ld: /usr/lib/libc.so.12: warning: warning: this program uses xdr_peername(), which is deprecated and buggy.
ld: /usr/lib/libc.so.12: warning: warning: this program uses xdr_domainname(), which is deprecated and buggy.
ld: /usr/lib/libc.so.12: warning: warning: this program uses xdr_mapname(), which is deprecated and buggy.
ld: /usr/lib/libc.so.12: warning: warning: __findenv is an internal obsolete function.
--- Modules/pyexpat.cpython-314d.so ---
gcc -pthread -shared -pg     Modules/pyexpat.o -lm Modules/expat/libexpat.a  -o Modules/pyexpat.cpython-314d.so
ld: /lib/libc.so.12: warning: warning: __findenv is an internal obsolete function.
--- Python/frozen_modules/getpath.h ---
--- Python/frozen_modules/importlib._bootstrap.h ---
--- Python/frozen_modules/importlib._bootstrap_external.h ---
--- Python/frozen_modules/getpath.h ---
./Programs/_freeze_module getpath ./Modules/getpath.py Python/frozen_modules/getpath.h
--- Python/frozen_modules/importlib._bootstrap.h ---
./Programs/_freeze_module importlib._bootstrap ./Lib/importlib/_bootstrap.py Python/frozen_modules/importlib._bootstrap.h
--- Python/frozen_modules/importlib._bootstrap_external.h ---
./Programs/_freeze_module importlib._bootstrap_external ./Lib/importlib/_bootstrap_external.py Python/frozen_modules/importlib._bootstrap_external.h
--- Python/frozen_modules/getpath.h ---
[1]   Segmentation fault (core dumped) ./Programs/_freeze_module getpath ./Modules/ge...
*** [Python/frozen_modules/getpath.h] Error code 139

make: stopped in /home/blue/cpython
--- Python/frozen_modules/importlib._bootstrap.h ---
[1]   Segmentation fault (core dumped) ./Programs/_freeze_module importlib._bootstrap...
*** [Python/frozen_modules/importlib._bootstrap.h] Error code 139

make: stopped in /home/blue/cpython
--- Python/frozen_modules/importlib._bootstrap_external.h ---
[1]   Segmentation fault (core dumped) ./Programs/_freeze_module importlib._bootstrap...
*** [Python/frozen_modules/importlib._bootstrap_external.h] Error code 139

make: stopped in /home/blue/cpython
3 errors

make: stopped in /home/blue/cpython

OS: NetBSD 10.0 amd64

CPython versions tested on:

CPython main branch

Operating systems tested on:

Other

@furkanonder furkanonder added type-bug An unexpected behavior, bug, or error build The build process and cross-build 3.12 only security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes labels Oct 29, 2024
@furkanonder
Copy link
Contributor Author

I believe there is an issue with -pg flag when used with phtreads on NetBSD.

Small Example to Reproduce

#include <pthread.h>
#include <stdio.h>

void* run(void* arg) {
    printf("Thread %ld is running.\n", (long)arg);
    return NULL;
}

int main(void) {
    for (long i = 0; i < 8; i++) {
        pthread_t tid;
        pthread_create(&tid, NULL, run, (void*)i);
        pthread_detach(tid);
    }
    pthread_exit(NULL);
}

Output:

~ gcc -pg test.c -lpthread -o test
ld: /lib/libc.so.12: warning: warning: this program uses xdr_peername(), which is deprecated and buggy.
ld: /lib/libc.so.12: warning: warning: this program uses xdr_domainname(), which is deprecated and buggy.
ld: /lib/libc.so.12: warning: warning: this program uses xdr_mapname(), which is deprecated and buggy.
ld: /lib/libc.so.12: warning: warning: __findenv is an internal obsolete function.
➜  ~ ./test
[1]    11968 segmentation fault (core dumped)  ./test

Expected Output:

Thread 0 is running.
Thread 1 is running.
Thread 2 is running.
Thread 3 is running.
Thread 4 is running.
Thread 5 is running.
Thread 6 is running.
Thread 7 is running.

I have also opened a bug report with NetBSD regarding this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 only security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes build The build process and cross-build OS-netbsd type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants