без. Если вы видите ответ, основанный на этом пожаре прочь.

аюсь скомпилировать исполняемый файл (файл ELF), который не использует динамический загрузчик. я использовалCython скомпилировать Python для C:

cython3 -3 test.py --embed

затем

gcc test.c -otest $(pkg-config --libs --cflags python3)

скомпилировать C сгенерированный файл.

Теперь я хотел бы скомпилироватьtest.c в статическом исполняемом файле. Обычно я использую-static флаг, но вот это вернутьcollect2: error: ld returned 1 exit status.

Как я могу сделать?

РЕДАКТИРОВАТЬ 1: Не полный беспорядок, потому что тело ограничено 30000 символов

длинный список предупреждений и ошибок, подобных этим:

...
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o):(.data+0x430): undefined reference to `XML_SetStartCdataSectionHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o):(.data+0x458): undefined reference to `XML_SetEndCdataSectionHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o):(.data+0x480): undefined reference to `XML_SetDefaultHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o):(.data+0x4a8): undefined reference to `XML_SetDefaultHandlerExpand'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o):(.data+0x4d0): undefined reference to `XML_SetNotStandaloneHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o):(.data+0x4f8): undefined reference to `XML_SetExternalEntityRefHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o):(.data+0x520): undefined reference to `XML_SetStartDoctypeDeclHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o):(.data+0x548): undefined reference to `XML_SetEndDoctypeDeclHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o):(.data+0x570): undefined reference to `XML_SetEntityDeclHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o):(.data+0x598): undefined reference to `XML_SetXmlDeclHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o):(.data+0x5c0): undefined reference to `XML_SetElementDeclHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o):(.data+0x5e8): undefined reference to `XML_SetAttlistDeclHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o):(.data+0x610): undefined reference to `XML_SetSkippedEntityHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x6c): undefined reference to `XML_ErrorString'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x9c): undefined reference to `XML_ErrorString'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0xbc): undefined reference to `XML_ErrorString'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x11b): undefined reference to `XML_ErrorString'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x153): undefined reference to `XML_ErrorString'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o):(.text.unlikely+0x173): more undefined references to `XML_ErrorString' follow
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x1c62): undefined reference to `XML_GetErrorCode'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x1c6d): undefined reference to `XML_GetCurrentColumnNumber'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x1c78): undefined reference to `XML_GetCurrentLineNumber'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x1c83): undefined reference to `XML_Parse'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x1c8e): undefined reference to `XML_ParserCreate_MM'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x1c99): undefined reference to `XML_ParserFree'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x1ca4): undefined reference to `XML_SetCharacterDataHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x1caf): undefined reference to `XML_SetCommentHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x1cba): undefined reference to `XML_SetDefaultHandlerExpand'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x1cc5): undefined reference to `XML_SetElementHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x1cd0): undefined reference to `XML_SetNamespaceDeclHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x1cdb): undefined reference to `XML_SetProcessingInstructionHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x1ce6): undefined reference to `XML_SetUnknownEncodingHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x1cf1): undefined reference to `XML_SetUserData'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x1cfc): undefined reference to `XML_SetStartDoctypeDeclHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `PyInit_pyexpat.cold.17':
(.text.unlikely+0x1d07): undefined reference to `XML_SetEncoding'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `xmlparse_getattro.cold.20':
(.text.unlikely+0x267b): undefined reference to `XML_GetCurrentLineNumber'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `xmlparse_getattro.cold.20':
(.text.unlikely+0x26d5): undefined reference to `XML_GetCurrentColumnNumber'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `xmlparse_getattro.cold.20':
(.text.unlikely+0x272a): undefined reference to `XML_GetCurrentByteIndex'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `xmlparse_getattro.cold.20':
(.text.unlikely+0x27ee): undefined reference to `XML_GetCurrentColumnNumber'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `xmlparse_getattro.cold.20':
(.text.unlikely+0x281c): undefined reference to `XML_GetCurrentByteIndex'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `xmlparse_getattro.cold.20':
(.text.unlikely+0x2853): undefined reference to `XML_GetCurrentLineNumber'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `xmlparse_getattro.cold.20':
(.text.unlikely+0x286d): undefined reference to `XML_GetErrorCode'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `pyexpat_xmlparser_Parse.cold.21':
(.text.unlikely+0x28f0): undefined reference to `XML_Parse'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `call_with_frame.isra.7.cold.24':
(.text.unlikely+0x2a9a): undefined reference to `XML_StopParser'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `get_parse_result.cold.27':
(.text.unlikely+0x2b0a): undefined reference to `XML_GetErrorCode'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `call_character_handler.cold.28':
(.text.unlikely+0x2b33): undefined reference to `XML_SetCharacterDataHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `call_character_handler.cold.28':
(.text.unlikely+0x2b95): undefined reference to `XML_SetCharacterDataHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `set_error.isra.8':
(.text.unlikely+0x2e1a): undefined reference to `XML_GetCurrentLineNumber'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `set_error.isra.8':
(.text.unlikely+0x2e25): undefined reference to `XML_GetCurrentColumnNumber'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `set_error.isra.8':
(.text.unlikely+0x2e30): undefined reference to `XML_ErrorString'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `pyexpat_xmlparser_UseForeignDTD':
(.text.unlikely+0x307f): undefined reference to `XML_UseForeignDTD'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `pyexpat_ErrorString':
(.text.unlikely+0x3b4d): undefined reference to `XML_ErrorString'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `pyexpat_xmlparser_GetBase':
(.text.unlikely+0x414e): undefined reference to `XML_GetBase'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `pyexpat_xmlparser_GetInputContext':
(.text.unlikely+0x449b): undefined reference to `XML_GetInputContext'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `flag_error':
(.text.unlikely+0x31e5): undefined reference to `XML_SetExternalEntityRefHandler'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pyexpat.o): In function `my_ElementDeclHandler':
(.text.unlikely+0x3836): undefined reference to `XML_FreeContentModel'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(posixmodule.o): In function `os_openpty':
(.text.unlikely+0x1447): undefined reference to `openpty'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(posixmodule.o): In function `os_forkpty':
(.text.unlikely+0x1e6e): undefined reference to `forkpty'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(faulthandler.o): In function `faulthandler_thread':
(.text.unlikely+0x618): undefined reference to `pthread_sigmask'
/usr/lib/gcc/x86_64-linux-gnu/5/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__register_frame_info.part.4':
(.text+0x1662): undefined reference to `pthread_mutex_lock'
/usr/lib/gcc/x86_64-linux-gnu/5/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__register_frame_info_bases':
(.text+0x16e7): undefined reference to `pthread_mutex_lock'
/usr/lib/gcc/x86_64-linux-gnu/5/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__register_frame_info_table_bases':
(.text+0x17bb): undefined reference to `pthread_mutex_lock'
/usr/lib/gcc/x86_64-linux-gnu/5/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__deregister_frame_info_bases':
(.text+0x185e): undefined reference to `pthread_mutex_lock'
/usr/lib/gcc/x86_64-linux-gnu/5/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__deregister_frame_info_bases':
(.text+0x18e6): undefined reference to `pthread_mutex_unlock'
/usr/lib/gcc/x86_64-linux-gnu/5/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `_Unwind_Find_FDE':
(.text+0x19c6): undefined reference to `pthread_mutex_lock'
/usr/lib/gcc/x86_64-linux-gnu/5/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `_Unwind_Find_FDE':
(.text+0x1a16): undefined reference to `pthread_mutex_unlock'
/usr/lib/gcc/x86_64-linux-gnu/5/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `_Unwind_Find_FDE':
(.text+0x1b00): undefined reference to `pthread_mutex_unlock'
/usr/lib/gcc/x86_64-linux-gnu/5/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__register_frame_info.part.4':
(.text+0x1681): undefined reference to `pthread_mutex_unlock'
/usr/lib/gcc/x86_64-linux-gnu/5/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__register_frame_info_bases':
(.text+0x1706): undefined reference to `pthread_mutex_unlock'
/usr/lib/gcc/x86_64-linux-gnu/5/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__register_frame_info_table_bases':
(.text+0x17da): undefined reference to `pthread_mutex_unlock'
collect2: error: ld returned 1 exit status

РЕДАКТИРОВАТЬ 2: Точная командная строка gcc:

gcc test.c -otest -static $(pkg-config --libs --cflags python3) -lc -lpthread -lexpat -lz -ldl -lutil -lm

РЕДАКТИРОВАТЬ 3: Это результатlocate:

$ locate libexpat.a libc.a libm.a libz.a libpthread.a libdl.a libutil.a libpython3.5m.a | grep x86_64-
linux-gnu
/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/libpython3.5m.a
/usr/lib/x86_64-linux-gnu/libc.a
/usr/lib/x86_64-linux-gnu/libdl.a
/usr/lib/x86_64-linux-gnu/libexpat.a
/usr/lib/x86_64-linux-gnu/libm.a
/usr/lib/x86_64-linux-gnu/libpthread.a
/usr/lib/x86_64-linux-gnu/libpython3.5m.a
/usr/lib/x86_64-linux-gnu/libutil.a
/usr/lib/x86_64-linux-gnu/libz.a

Поэтому у меня должны быть все статические библиотеки, которые мне нужны.

Этоновый ошибка, немногокороче чем первый:

$ gcc pregex.c -otest -static $(pkg-config --libs --cflags python3) -lc -lpthread -lexpat -lz -ldl -lutil -lm
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(posixmodule.o): In function `posix_getgrouplist':
(.text.unlikely+0x3aa6): warning: Using 'getgrouplist' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(posixmodule.o): In function `posix_initgroups':
(.text.unlikely+0x3cc1): warning: Using 'initgroups' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(grpmodule.o): In function `grp_getgrall':
(.text+0x2f5): warning: Using 'getgrent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(grpmodule.o): In function `grp_getgrgid':
(.text+0xe9): warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(grpmodule.o): In function `grp_getgrnam':
(.text+0x266): warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(grpmodule.o): In function `grp_getgrall':
(.text+0x2c9): warning: Using 'setgrent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(grpmodule.o): In function `grp_getgrall.cold.7':
(.text.unlikely+0x15a): warning: Using 'endgrent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pwdmodule.o): In function `pwd_getpwall':
(.text+0x285): warning: Using 'getpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pwdmodule.o): In function `pwd_getpwnam':
(.text+0x1ee): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pwdmodule.o): In function `pwd_getpwuid':
(.text+0x9f): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pwdmodule.o): In function `pwd_getpwall':
(.text+0x259): warning: Using 'setpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(pwdmodule.o): In function `pwd_getpwall.cold.6':
(.text.unlikely+0x14d): warning: Using 'endpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(socketmodule.o): In function `socket_getaddrinfo':
(.text+0x167b): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(spwdmodule.o): In function `spwd_getspall':
(.text.unlikely+0x1a6): warning: Using 'getspent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(spwdmodule.o): In function `spwd_getspnam':
(.text.unlikely+0x27b): warning: Using 'getspnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(spwdmodule.o): In function `spwd_getspall':
(.text.unlikely+0x1a1): warning: Using 'setspent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(spwdmodule.o): In function `spwd_getspall':
(.text.unlikely+0x1f7): warning: Using 'endspent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(socketmodule.o): In function `socket_gethostbyaddr':
(.text+0x2d45): warning: Using 'gethostbyaddr_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(socketmodule.o): In function `socket_gethostbyname_ex':
(.text.unlikely+0x1ae4): warning: Using 'gethostbyname_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(socketmodule.o): In function `socket_getprotobyname':
(.text.unlikely+0x33ff): warning: Using 'getprotobyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(socketmodule.o): In function `socket_getservbyname':
(.text.unlikely+0x2263): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(socketmodule.o): In function `socket_getservbyport':
(.text.unlikely+0x34c3): warning: Using 'getservbyport' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpthread.a(lowlevellock.o): In function `__lll_lock_wait_private':
/build/glibc-Cl5G7W/glibc-2.23/nptl/../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:78: multiple definition of `__lll_lock_wait_private'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libc.a(libc-lowlevellock.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpthread.a(lowlevellock.o): In function `__lll_unlock_wake_private':
/build/glibc-Cl5G7W/glibc-2.23/nptl/../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:328: multiple definition of `__lll_unlock_wake_private'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libc.a(libc-lowlevellock.o):(.text+0x30): first defined here
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(dynload_shlib.o): In function `_PyImport_FindSharedFuncptr':
(.text+0x7c): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
collect2: error: ld returned 1 exit status

РЕДАКТИРОВАТЬ 4:

Хорошо, теперь я могукомпилировать без ошибок с этой командной строкой:

$ gcc -static test.c -otest $(pkg-config --libs --cflags python3) -lm -lutil -ldl -lz -lexpat -lpthread -lc

Я не знаю почему но с-lc в конце его компилируют! Проблема в том, что предупреждения все еще находятся в выходном сообщении:

Много предупреждений, как это:

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpython3.5m.a(dynload_shlib.o): In function `_PyImport_FindSharedFuncptr':
(.text+0x7c): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

Ответы на вопрос(1)

Ваш ответ на вопрос