9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: okamoto@granite.cias.osakafu-u.ac.jp
To: 9fans@cse.psu.edu
Subject: Re: [9fans] gcc install help needed
Date: Fri, 10 Oct 2003 15:48:28 +0900	[thread overview]
Message-ID: <92f58c1d82b93f0d421ece40ffb0236b@granite.cias.osakafu-u.ac.jp> (raw)
In-Reply-To: <ACCF003CBA3D09458207DB0CB86AD17D124BAD@XMAIL.asuch.cas.cz>

> Could someone lead my hand through the correct install of gcc-3.0 port?
> I obvoiously did something wrong ... I can compile C, but not C++

When I compile hpijs-1.4.1, I had to change some as follows:

1) add the function as suggested by Peter Bosch from bell-labs

to the file which contains main() function,

// Ugly, G++ for Plan 9 needs to be installed correctly.
void
ctors(void)
{
	typedef void (*func_ptr)(void);
	extern func_ptr ___CTOR_LIST__[];

	for (int i = 0; i != (int)___CTOR_LIST__[0]; i++)
		___CTOR_LIST__[i + 1]();
}

and and in the top of the main function call the function:

	ctors();

2) in my case I had to add two functions to vsnprintf() and snprintf() to libc library.
 then, I copied snprintf.c and vsnprintf.c files from /sys/src/ape/lib/ap/stdio to
/sys/src/gnu/ape/libc/stdio.   You may also want to add two lines for those two
functions into /sys/include/gnu/stdio.h like:

extern int snprintf(char *, size_t, const char *, ...);
extern int vsnprintf(char *, size_t, const char *, va_list);

Of course you have to change /sys/src/gnu/ape/libc/stdio/mkfile, too.

3) then, recompile /386/lib/gnu/libc.a.   Don't forget to ranlib to it.
You may want to add some neccessary files which I forgot.   I remember
it was neccessary to recompile the library.

Kenji



  reply	other threads:[~2003-10-10  6:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-09 11:25 cej
2003-10-10  6:48 ` okamoto [this message]
2003-10-10  6:54   ` okamoto

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=92f58c1d82b93f0d421ece40ffb0236b@granite.cias.osakafu-u.ac.jp \
    --to=okamoto@granite.cias.osakafu-u.ac.jp \
    --cc=9fans@cse.psu.edu \
    /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).