# Compiling extensions

- Thread: https://externals.io/message/13286
- Original archive: https://news-web.php.net/php.internals/13286
- Started by Jeremy Johnstone on 2004-10-12T19:53:08+00:00
- Messages: 7
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #13286 — Jeremy Johnstone — 2004-10-12T19:53:08+00:00

URL: https://externals.io/message/13286#13286

Forgive me if this sounds like a newbie type question, but hopefully
someone has some advice for me. I am wanting to distribute an
extension I wrote for PHP and was wondering what the best way to
compile it for all platforms would be. I am completely comfortable
compiling the extension under Linux for all versions of PHP, but
looking for the best way to compile for *BSD, Solaris, OSX, and
Windows. Is there a way to do this easily or am I forced to setup a
machine with each platform and compile from it? I thought there was
another way, but not sure, so I thought I would ask.

---

## #13287 — Paul G — 2004-10-12T20:26:25+00:00

URL: https://externals.io/message/13286#13287 · In reply to: #13286

----- Original Message ----- 
From: "Jeremy Johnstone" <phpdev@gmail.com>
To: <internals@lists.php.net>
Sent: Tuesday, October 12, 2004 3:53 PM
Subject: [PHP-DEV] Compiling extensions


> Forgive me if this sounds like a newbie type question, but hopefully
> someone has some advice for me. I am wanting to distribute an
> extension I wrote for PHP and was wondering what the best way to
> compile it for all platforms would be. I am completely comfortable
> compiling the extension under Linux for all versions of PHP, but
> looking for the best way to compile for *BSD, Solaris, OSX, and
> Windows. Is there a way to do this easily or am I forced to setup a
> machine with each platform and compile from it? I thought there was
> another way, but not sure, so I thought I would ask.

well, normally this would be done with autoconf (if you have code that isn't
directly portable), assuming you are distributing it as source. however, to
test you would need access to said platforms.

have you proposed your extension to pecl? pecl-l would probably  be a better
place to ask and i would think folks there would be glad to help with
testing on the platforms you don't have available.

off-topic: you mean you don't have all those in that rack of yours? <g>

paul

---

## #13294 — Jeremy Johnstone — 2004-10-12T22:08:03+00:00

URL: https://externals.io/message/13286#13294 · In reply to: #13287

I have proposed it to PECL a while back (like June I think), not sure
on the status of the proposal though. Because of the nature of why I
am using this extension, I need to precompile it for as many platforms
as possible and use it as a dynamically loaded module (it's basically
a script licensing system). I know this isn't the most idea solution,
but for my needs it is basically the only one available which works
the way I want.

-Jeremy
http://www.jeremyjohnstone.com

P.S. - (off-topic reply) You must know me then I guess. I have
everything but OSX available in my server rack in my house, so yes I
could do it that way. Was just hoping for an easier solution. Guess I
might just have to cave in and buy me an Apple if there is no other
way.



> well, normally this would be done with autoconf (if you have code that isn't
> directly portable), assuming you are distributing it as source. however, to
> test you would need access to said platforms.
> 
> have you proposed your extension to pecl? pecl-l would probably  be a better
> place to ask and i would think folks there would be glad to help with
> testing on the platforms you don't have available.
> 
> off-topic: you mean you don't have all those in that rack of yours? <g>
> 
> paul

---

## #13297 — Wez Furlong — 2004-10-12T22:43:27+00:00

URL: https://externals.io/message/13286#13297 · In reply to: #13294

> I have proposed it to PECL a while back (like June I think), not sure
> on the status of the proposal though.

If you want to get it into PECL, give us a nudge over there to refresh
our collective memories what it is exactly.

> P.S. - (off-topic reply) You must know me then I guess. I have
> everything but OSX available in my server rack in my house, so yes I
> could do it that way. Was just hoping for an easier solution. Guess I
> might just have to cave in and buy me an Apple if there is no other
> way.

Hmm, depends on what you regard as easy ;-)
The most reliable way (which could be considered easiest) is to build
the extension on each platform.

An alternative, that I don't think anyone has tried, is to
cross-compile for the target platforms from the same box.  This is
uncharted territory AFAIK and there is a chance that our build system
might not like it.  If you feel like giving it a go, I'd welcome you
feedback :-)

--Wez.

---

## #13300 — Jeremy Johnstone — 2004-10-12T22:56:45+00:00

URL: https://externals.io/message/13286#13300 · In reply to: #13297

> 
> > […]
> 
> If you want to get it into PECL, give us a nudge over there to refresh
> our collective memories what it is exactly.

Will do last I heard about it you (and others) were wanting me to
extend the extension to include a lot more. Unfortunately I haven't
had the time I wanted to do that.

> 
> > […]
> 
> Hmm, depends on what you regard as easy ;-)
> The most reliable way (which could be considered easiest) is to build
> the extension on each platform.
> 
> An alternative, that I don't think anyone has tried, is to
> cross-compile for the target platforms from the same box.  This is
> uncharted territory AFAIK and there is a chance that our build system
> might not like it.  If you feel like giving it a go, I'd welcome you
> feedback :-)
> 

I think I might give the cross-compile a try for OS X atleast, unless
someone knows where I can pick up a decent Mac w/ OS X for a low
price. Somehow I have my doubts too, but I am willing to be a pioneer
if need be.

Thanks,

-Jeremy
http://www.jeremyjohnstone.com

---

## #13301 — Wez Furlong — 2004-10-12T23:10:36+00:00

URL: https://externals.io/message/13286#13301 · In reply to: #13300

> Will do last I heard about it you (and others) were wanting me to
> extend the extension to include a lot more. Unfortunately I haven't
> had the time I wanted to do that.

Getting the code into PECL could result in other people helping you
out, depending on how much they want those features. :-)
 
> I think I might give the cross-compile a try for OS X atleast, unless
> someone knows where I can pick up a decent Mac w/ OS X for a low
> price. Somehow I have my doubts too, but I am willing to be a pioneer
> if need be.

Of all the platforms, I suspect OS X will the hardest to cross-compile for.
But don't let that stop you ;-)

--Wez.

---

## #13302 — Jeremy Johnstone — 2004-10-12T23:32:43+00:00

URL: https://externals.io/message/13286#13302 · In reply to: #13301

> > […]
> 
> Getting the code into PECL could result in other people helping you
> out, depending on how much they want those features. :-)

Agreed, which is why I originally submitted it to PECL. As it stands
right now, the module just allows you to do functions which allow
access to the MAC address of the network card on the machine. My
future plans were to extend it to support all kinds of information
about the machine the PHP script is running on.

> > […]
> 
> Of all the platforms, I suspect OS X will the hardest to cross-compile for.
> But don't let that stop you ;-)

That sounds like just the motivation I need to actually try it. I
always did have a thing for doing the impossible. ;-)
