9front - general discussion about 9front
 help / color / mirror / Atom feed
From: qwx@sciops.net
To: 9front@9front.org
Subject: Re: [9front] Linking error while porting
Date: Wed, 08 May 2024 16:22:30 +0200	[thread overview]
Message-ID: <94909FDAB9454C00B8D7ECE0602C3978@wopr.sciops.net> (raw)
In-Reply-To: <d173af93-db09-4c20-ae3d-548ea39ae9eb@sirjofri.de>

On Wed May  8 13:23:38 +0200 2024, sirjofri+ml-9front@sirjofri.de wrote:
> Hey all,
> 
> I'm trying to port the simon tatham portable puzzle collection using npe and I get incompatible type signatures while linking the files.
> 
> For npe, I had to #undef PI after #including <libc.h> (in npe.h), because puzzles #defines its own PI. Other than that, I didn't change the source repo or npe.
> 
> My sources are here: http://sirjofri.de/oat/tmp/puzzles/
> 
> repo.url contains the url to the source repo for puzzles. To get started, clone that url to your local filesystem and copy the remaining files into the same directory.
> 
> The other files are an mkfile and plan9.c (for the plan 9 frontend, which is mostly a stub I still have to fill).
> 
> b.rc is a short build script for building the blackbox program. Literally `mk install 6.blackbox`. It's not about that program specifically, it's just the first game in the list.
> 
> The linking errors are all roughly the same, like:
> 
> new_window: incompatible type signatures 71a60b79(blackbox.6) and 846c216a(plan9.6) for thegame
> 
> In this specific case, I double checked the type and the only difference is that one is declared as the struct itself, the other as the typedef'd struct (struct game vs game). I also changed that temporarily, without a difference. The compiler handles typedef's like it should.
> 
> I can't imagine any other reason why it shouldn't work. Thanks to npe, it's the same compiler (6c) for both source files. The compilers/linkers should be up to date (sysupdated yesterday).
> 
> If anyone has any idea what could be wrong, that would be very helpful. Also if I should give you more data, just let me know.
> 
> sirjofri

 From what I saw, some of these structs are actually not defined in the
header but in individual c files.  Putting `#pragma incomplete' for a
few of them in puzzles.h fixes most linking errors:

#pragma incomplete midend
#pragma incomplete drawing
#pragma incomplete frontend
#pragma incomplete random_state

One error still remains for a big and complex struct, you might have
to go through all type declarations and make sure whatever isn't
defined in puzzles.h is marked incomplete.

Cheers,
qwx

  reply	other threads:[~2024-05-08 14:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08 11:20 sirjofri
2024-05-08 14:22 ` qwx [this message]
2024-05-08 21:10   ` sirjofri
2024-05-08 21:40     ` sirjofri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=94909FDAB9454C00B8D7ECE0602C3978@wopr.sciops.net \
    --to=qwx@sciops.net \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).