Deutsch   English   Français   Italiano  
<vq4lvs$1cv83$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: bart <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: Python recompile
Date: Mon, 3 Mar 2025 16:39:25 +0000
Organization: A noiseless patient Spider
Lines: 87
Message-ID: <vq4lvs$1cv83$1@dont-email.me>
References: <vq1qas$j22$1@gallifrey.nk.ca> <vq1uvb$qbuq$1@dont-email.me>
 <vq22nc$rvb8$1@dont-email.me> <vq24kd$rg6i$1@dont-email.me>
 <vq3oag$18iv6$1@dont-email.me> <vq3pck$17ol6$1@dont-email.me>
 <vq415o$19a91$1@dont-email.me> <vq46qi$19uq2$1@dont-email.me>
 <vq4gbo$1btr0$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 03 Mar 2025 17:39:25 +0100 (CET)
Injection-Info: dont-email.me; posting-host="71ccf53cfd1901b67d85c65a66d0edd4";
	logging-data="1473795"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/U0dCNhAus68rDECFIIfgX"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Ei/Dkrql0l79tyGHGXT5NIpOMRc=
In-Reply-To: <vq4gbo$1btr0$1@dont-email.me>
Content-Language: en-GB
Bytes: 4339

On 03/03/2025 15:03, Muttley@DastardlyHQ.org wrote:
> On Mon, 3 Mar 2025 12:20:35 +0000
> bart <bc@freeuk.com> wibbled:
>> On 03/03/2025 10:44, Muttley@DastardlyHQ.org wrote:
>>> On Mon, 3 Mar 2025 08:31:16 +0000
>>> Really? So if a compiler gives an error thats not a C problem? Go ask a
>>> group for the specific compiler?
>>
>> The errors reported by the OP were like this:
>>
>> ld: error: relocation R_X86_64_32 cannot be used against symbol
>> '_PyRuntime'; recompile with -fPIC
>>
>> 'ld' is a program that can be used to link programs in any language.
>>
>> The problem appears to be do with generating position independent code
>> since these days linkers like to generate programs that can loaded at an
>> arbitrary address in high memory.
>>
>> I can't see anything to do with C here, other than the source in
>> question may have been written in C.
> 
> Yes, thats kind of the point. You wouldn't get these errors if it was written
> in Java or C#.

Why not? There would be the same issues with position-independent code. 
Maybe they just come up elsewhere, or maybe the problem is taken care of 
inside the tool.

Take this example:

   c:\mx>mm -obj hello
   Compiling hello.m to hello.obj

   c:\mx>ld hello.obj
   hello.obj:hello.obj:(.text+0x4e05): relocation truncated to fit: 
IMAGE_REL_AMD64_ADDR32 against `.data'

It's a similar kind of linker issue. But the language here isn't C. I 
can make it C:

   c:\cx>bcc -c hello.c
   Compiling hello.c to hello.obj

   c:\cx>ld hello.obj
   hello.obj:hello.obj:(.text+0x7): relocation truncated to fit: 
IMAGE_REL_AMD64_ADDR32 against `.data'

Exactly the same error, one for language C, and one for language 'M'.

So you still think it's to do with the C language only?

Here, I tweaked both compilers to disable the high-loading flag when 
generating object files, in order to force the error, because normally 
it knows to set it for those file types.

So it's to do with the compiler backend, but such backends tend to be 
used for multiple languages: gcc can be used for multiple front-end 
languages, as can LLVM used by clang.

And the solution will likely be to do with the build system: you don't 
build CPython by manually invoking gcc with your own options. It's a 
quite elaborate process.

Presumably the official build system works, so the OP is doing something 
different.

I very much doubt that whatever it is can be fixed by modifying the C 
sources.

> [snip]
> 
>> On usenet? That is pretty much dead.
> 
> Not dead but certainly not buzzing yet

It was buzzing in the 1990s but has been gradually dying. This group is 
an oasis; the rest of it is either a wasteland or a cesspit, or has been 
taken over by nutters.

> I presume thats how you like it given
> you don't want any "everyday development issues" relating to C mentioned here.
> 
> Or are you another one who thinks usenet should be for the exclusive discussion
> of high brow issues only of interest to you?

I'm pointing out why this is probably not on topic. Personally I don't care.