Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #197320

Re: Python recompile

From bart <bc@freeuk.com>
Newsgroups comp.lang.c, comp.lang.c++, comp.lang.python
Subject Re: Python recompile
Date 2025-03-03 19:37 +0000
Organization A noiseless patient Spider
Message-ID <vq50cs$1ev2r$1@dont-email.me> (permalink)
References <vq1qas$j22$1@gallifrey.nk.ca> <vq260p$u8ub$1@paganini.bofh.team> <vq2j3n$v2fk$1@dont-email.me> <vq4ocv$17dal$1@paganini.bofh.team>

Cross-posted to 3 groups.

Show all headers | View raw


On 03/03/2025 17:20, Waldek Hebisch wrote:
> In comp.lang.c James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
>> On 3/2/25 12:54, Waldek Hebisch wrote:
>>> In comp.lang.c The Doctor <doctor@doctor.nl2k.ab.ca> wrote:
>>>> How do I compensate for
>>>>
>>>> ld: error: relocation R_X86_64_32 cannot be used against symbol '_PyRuntime'; recompile with -fPIC
>>>>>>> defined in /usr/local/lib/libpython3.13.a(pylifecycle.o)
>>>>>>> referenced by thread_pthread.h:138 (Python/thread_pthread.h:138)
>>>>>>>                thread.o:(PyThread_init_thread) in archive /usr/local/lib/libpython3.13.a
>>>>
>>>
>>> This is real world question and as such is considered off-topic
>>> in comp.lang.c.  However, you could try '-no-pie' to the compiler.
>>
>> Real world questions about the C programming language are entirely
>> on-topic here. Note, however, that many questions posted here are not
>> about C itself, but about the quirks of particular implementations of C.
>> You can get better answers to such questions by asking in forums
>> specific to the relevant implementation, and helpful people will remind
>> your of that. It's a misunderstanding of those redirections to conclude
>> that c.l.c is not for real world questions.
>>
>> However Python is NOT an implementation of C, not even by the loosest
>> reasonable interpretation, so why should it be discussed here?.
> 
> The question is about C implementation.  Namely, the bible for
> this group, that is C standard requires C implementation to
> produce executables.  And making executable from C sources
> it at core of the OP question.  Fact that compiling this source
> is supposed to produce Python interpreter or maybe some
> supporting shared library is irrelevant here.
> 
> One could call the problem "Linux problem".  Namely, many
> (maybe all) Linux distribution modify(ed) gcc so that creating
> position independent executables is the default and to
> prevent this one need '-no-pie' at final stage.  And to
> generate position independent executable all code has to
> be compiled as position independent code which needs '-fPIC'
> option.  Similarly, if OP is trying to create shared
> library, then on Linux all code inluded in the shared
> librayr must be compiled as position independent code,
> that is using '-fPIC'.
> 
> Dismissing this as linker problem misses important
> points:
> - linking is considerd part of C implementation

C requires independent compilation. It doesn't say how that should be done.

> - '-fPIC' is option for compiler proper
> - '-no-pie' is handled by the compiler driver

Those are compiler- and platform-specific options, nothing to do with 
the language.

My two C compilers don't use a linker.


> And frankly, making executables or shared library from
> C code is real world thing that C programmer want to do
> and non-programmers would not do.

There are a thousand C compilers; I can't imagine that their options and 
various capabilities are all on topic.

gcc is sometimes given a free pass because it is so widely used, but the 
options used with it are more general (eg. -O3 or -s).

> OP uses some build system and fixing his problem presumably
> needs changes to build system.  And reasonably build system
> may be cosidered of topic here.

That's even more off-topic. Build systems use things like CMake and Make 
which have their own syntax, and which are designed to work with 
multiple languages.


> However, fact that compilation
> proper and final linking must use consitent options is
> real world C problem.  I appreciate that many years ago
> comp.lang.c regulars decided that they do not want to answer
> such real world question.  However, do you want to tell OP
> "pretend that your main program is in Fortran and ask your
> question in comp.lang.fortran"?  FYI, similar questions were
> asked and answered in comp.lang.fortran without questioning
> topicality.  So clearly, the only thing which makes such
> question of topic here is past deliberate decision to exclude
> them.


Fortran itself is rather niche; C isn't.

I suggested that Reddit or Stackoverflow could be used, as they're less 
fussed. There would also be a lot more people who could help.

On Reddit, the main C forum has 186K members, and the Fortran one under 
8K. However, the Python subreddit has 1.3M members; that might be worth 
trying too.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Python recompile doctor@doctor.nl2k.ab.ca (The Doctor) - 2025-03-02 14:35 +0000
  Re: Python recompile Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2025-03-02 15:54 +0000
    Re: Python recompile Muttley@dastardlyhq.com - 2025-03-02 16:58 +0000
      Re: Python recompile Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2025-03-02 17:08 +0000
        Re: Python recompile Muttley@DastardlyHQ.org - 2025-03-03 08:14 +0000
      Re: Python recompile James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-03-02 12:30 -0500
        Re: Python recompile scott@slp53.sl.home (Scott Lurndal) - 2025-03-02 18:35 +0000
        Re: Python recompile Muttley@DastardlyHQ.org - 2025-03-03 08:13 +0000
          Re: Python recompile Richard Heathfield <rjh@cpax.org.uk> - 2025-03-03 08:31 +0000
            Re: Python recompile Muttley@DastardlyHQ.org - 2025-03-03 10:44 +0000
              Re: Python recompile bart <bc@freeuk.com> - 2025-03-03 12:20 +0000
                Re: Python recompile Muttley@DastardlyHQ.org - 2025-03-03 15:03 +0000
              Re: Python recompile Richard Heathfield <rjh@cpax.org.uk> - 2025-03-03 12:47 +0000
          Re: Python recompile James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-03-03 10:22 -0500
            Re: Python recompile Muttley@DastardlyHQ.org - 2025-03-03 16:19 +0000
            Re: Python recompile geodandw <geodandw@gmail.com> - 2025-03-03 11:24 -0500
              Re: Python recompile Muttley@DastardlyHQ.org - 2025-03-03 16:26 +0000
              Re: Python recompile James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-03-03 11:39 -0500
                Re: Python recompile Muttley@DastardlyHQ.org - 2025-03-03 16:56 +0000
                Re: Python recompile David Brown <david.brown@hesbynett.no> - 2025-03-03 18:22 +0100
                Re: Python recompile Muttley@DastardlyHQ.org - 2025-03-04 08:31 +0000
                Re: Python recompile Kaz Kylheku <643-408-1753@kylheku.com> - 2025-03-04 17:28 +0000
                Re: Python recompile Richard Heathfield <rjh@cpax.org.uk> - 2025-03-03 17:25 +0000
                Re: Python recompile Muttley@DastardlyHQ.org - 2025-03-04 08:32 +0000
                Re: Python recompile Richard Heathfield <rjh@cpax.org.uk> - 2025-03-04 08:56 +0000
                Re: Python recompile Muttley@DastardlyHQ.org - 2025-03-04 09:23 +0000
                Re: Python recompile Richard Heathfield <rjh@cpax.org.uk> - 2025-03-04 09:57 +0000
                Re: Python recompile Muttley@DastardlyHQ.org - 2025-03-04 10:03 +0000
                Re: Python recompile Richard Heathfield <rjh@cpax.org.uk> - 2025-03-04 10:25 +0000
                Re: Python recompile Muttley@DastardlyHQ.org - 2025-03-04 11:19 +0000
                Re: Python recompile Kaz Kylheku <643-408-1753@kylheku.com> - 2025-03-04 17:42 +0000
                Re: Python recompile bart <bc@freeuk.com> - 2025-03-04 18:16 +0000
                Re: Python recompile Muttley@DastardlyHQ.org - 2025-03-05 09:10 +0000
                Re: Python recompile antispam@fricas.org (Waldek Hebisch) - 2025-03-06 19:21 +0000
                Re: Python recompile Muttley@DastardlyHQ.org - 2025-03-07 09:53 +0000
                Re: Python recompile Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-03-07 21:26 +0000
                Re: Python recompile bart <bc@freeuk.com> - 2025-03-07 21:33 +0000
                Re: Python recompile antispam@fricas.org (Waldek Hebisch) - 2025-03-10 14:39 +0000
                Re: Python recompile Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-03-06 03:16 +0000
                Re: Python recompile James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-03-04 19:12 -0500
                Re: Python recompile gazelle@shell.xmission.com (Kenny McCormack) - 2025-03-03 23:42 +0000
                Re: Python recompile geodandw <geodandw@gmail.com> - 2025-03-03 13:29 -0500
                Re: Python recompile James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-03-03 16:52 -0500
              Re: Python recompile Richard Heathfield <rjh@cpax.org.uk> - 2025-03-03 17:19 +0000
                Re: Python recompile geodandw <geodandw@gmail.com> - 2025-03-03 13:33 -0500
                Re: Python recompile Richard Heathfield <rjh@cpax.org.uk> - 2025-03-03 19:15 +0000
                Re: Python recompile geodandw <geodandw@gmail.com> - 2025-03-03 18:51 -0500
                Re: Python recompile Kaz Kylheku <643-408-1753@kylheku.com> - 2025-03-04 00:49 +0000
                Re: Python recompile Richard Heathfield <rjh@cpax.org.uk> - 2025-03-04 02:29 +0000
                Re: Python recompile David Brown <david.brown@hesbynett.no> - 2025-03-04 09:12 +0100
                Re: Python recompile Richard Heathfield <rjh@cpax.org.uk> - 2025-03-04 11:33 +0000
                Re: Python recompile Muffley@DinkyHQ.org - 2025-03-04 12:00 +0000
                Re: Python recompile Michael S <already5chosen@yahoo.com> - 2025-03-04 15:31 +0200
              Re: Python recompile David Brown <david.brown@hesbynett.no> - 2025-03-03 18:28 +0100
                Re: Python recompile Muttley@DastardlyHQ.org - 2025-03-04 08:33 +0000
                Re: Python recompile Kaz Kylheku <643-408-1753@kylheku.com> - 2025-03-04 18:06 +0000
              Re: Python recompile Stuart Redmann <DerTopper@web.de> - 2025-03-06 07:35 +0100
                Re: Python recompile Richard Heathfield <rjh@cpax.org.uk> - 2025-03-06 07:32 +0000
                Re: Python recompile Muttley@DastardlyHQ.org - 2025-03-06 08:39 +0000
                Re: Python recompile "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-03-06 12:40 -0800
                Re: Python recompile James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-03-07 13:17 -0500
          Re: Python recompile doctor@doctor.nl2k.ab.ca (The Doctor) - 2025-03-03 16:12 +0000
    Re: Python recompile Left Right <olegsivokon@gmail.com> - 2025-03-02 23:26 +0100
  Re: Python recompile antispam@fricas.org (Waldek Hebisch) - 2025-03-02 17:54 +0000
    Re: Python recompile Richard Heathfield <rjh@cpax.org.uk> - 2025-03-02 19:15 +0000
    Re: Python recompile James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-03-02 13:38 -0500
      Re: Python recompile doctor@doctor.nl2k.ab.ca (The Doctor) - 2025-03-03 00:42 +0000
        Re: Python recompile doctor@doctor.nl2k.ab.ca (The Doctor) - 2025-03-03 00:46 +0000
        Re: Python recompile James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-03-02 22:24 -0500
      Re: Python recompile antispam@fricas.org (Waldek Hebisch) - 2025-03-03 17:20 +0000
        Re: Python recompile Richard Heathfield <rjh@cpax.org.uk> - 2025-03-03 17:28 +0000
        Re: Python recompile James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-03-03 12:57 -0500
        Re: Python recompile scott@slp53.sl.home (Scott Lurndal) - 2025-03-03 18:02 +0000
        Re: Python recompile bart <bc@freeuk.com> - 2025-03-03 19:37 +0000
  Re: Python recompile (Posting On Python-List Prohibited) Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-03-04 05:46 +0000

csiph-web