OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Paul Smedley on December 26, 2012, 09:44:14 am

Title: Have questions about porting software to eCS?
Post by: Paul Smedley on December 26, 2012, 09:44:14 am
Hi All,

Wanting to encourage anyone who has an interest in porting software to eCS from unix, to post their questions in this forum.  I answer a lot of questions on IRC or when I see them in the newsgroups, but this forum is a far more convenient place for those questions (unless the server crashes again :P)

Cheers,

Paul
Title: Re: Have questions about porting software to eCS?
Post by: Martin Iturbide on December 26, 2012, 08:24:02 pm
Hi Paul

I do not have current development skills, I did some programming back in my college days (post 2001) .

What do you think it will be a good exercise on porting some software to OS2-eCS to learn and get used to the tools?
Which tools are basic to start porting software?

Thanks
Martin
Title: Re: Have questions about porting software to eCS?
Post by: Paul Smedley on December 27, 2012, 07:39:55 am
In terms of tools  shameless plug is http://os2ports.smedley.id.au/index.php?page=BuildEnvDVD :)

In the absolute best case scenario, the process is:
1) extract source
2) run configure using something like:
    ash ./configure --prefix=/name_of_app --disable-shared --enable-static 2>&1 | tee configure.log
    --prefix specifies where we want to install the app - default will be /usr or /usr/local
    --disable-shared tells it not to build shared libraries (in most cases the app won't know how to build shared libraries (ie DLL's)
    --enable-static forces static libraries to be built
    2>&1 | tee configure.log puts the output from configure into a file called configure.log for debugging purposes
3) assuming configure completes:
     make 2>&1 | tee build.log
    runs make, with output of the command pipes into build.log
4) If no, errors.
    make install
    output will be put into the directory specified as prefix in 2)

I'd suggest starting with a simple command line app like wget

People seem to want to be ambitious and start with something like virtualbox!
Title: Re: Have questions about porting software to eCS?
Post by: Dave Yeo on December 27, 2012, 09:38:53 am
Recent wget doesn't build cleanly. Might I suggest xz as a starting point. Seems to be very portable, is being used quite a bit, often with tar giving tar.xz archives and at least here DLLs also built fine.
http://tukaani.org/xz
Title: Re: Have questions about porting software to eCS?
Post by: Joop on December 27, 2012, 02:12:30 pm
Want to try to compile Rocrail, but its using Bazaar instead of CVS. How different are those two? Is it hard / difficult to port Bazaar to OS/2-eCS? Paul, you did CVS as far as I know, how difficult was it?
Title: Re: Have questions about porting software to eCS?
Post by: Doug Bissett on December 27, 2012, 05:31:39 pm
I'd suggest starting with a simple command line app like wget

People seem to want to be ambitious and start with something like virtualbox!

I was trying to lead a thread to get wget to build. The latest one wasn't cooperating. Then OS2world ended. I did download an older version, which has been built in the OS/2 environment previously, but I have done nothing with it, other than discover that it won't build either. I am pretty sure that it is just a minor setup problem, but I don't see what it might be, and need some guidance from those who know about these things.

I intend to restart that thread, sometime early next year, unless somebody else wants to start it earlier. Hopefully, it will serve as a guide for others, but it should also serve as a guide to get the build environment to work with a basic project, before a user decides to tackle more complicated things, like virtualbox.   ;D
Title: Re: Have questions about porting software to eCS?
Post by: Paul Smedley on December 28, 2012, 01:34:34 am
Want to try to compile Rocrail, but its using Bazaar instead of CVS. How different are those two? Is it hard / difficult to port Bazaar to OS/2-eCS? Paul, you did CVS as far as I know, how difficult was it?

yeah the build of cvs I use was built by me.  I've never looked at bazaar, but likely it is quite portable, so I will try and take a look at it.

Note Rocrail has source snapshots available too - https://launchpad.net/rocrail/sunrise/2.0/+download/rocrail-4282-sources.tar.gz

Note also, this uses wxwidgets, which doesn't work terribly well on OS/2.
Title: Re: Have questions about porting software to eCS?
Post by: Andy Willis on December 28, 2012, 06:00:13 am
I'd suggest starting with a simple command line app like wget

People seem to want to be ambitious and start with something like virtualbox!

I was trying to lead a thread to get wget to build. The latest one wasn't cooperating. Then OS2world ended. I did download an older version, which has been built in the OS/2 environment previously, but I have done nothing with it, other than discover that it won't build either. I am pretty sure that it is just a minor setup problem, but I don't see what it might be, and need some guidance from those who know about these things.

I intend to restart that thread, sometime early next year, unless somebody else wants to start it earlier. Hopefully, it will serve as a guide for others, but it should also serve as a guide to get the build environment to work with a basic project, before a user decides to tackle more complicated things, like virtualbox.   ;D
wget built very easily with Paul's environment... I had to make one change to the code to make up for the fact that that some struct (sched_param) was getting defined twice in their code.  With my home grown environment I was having problems because it wanted gnutls which in turn wanted libnettles.  There is not a gnutls in the yum repository for that environment so I have the same issue there as I do with my own.
Title: Re: Have questions about porting software to eCS?
Post by: Doug Bissett on December 28, 2012, 07:55:04 am
Quote
wget built very easily with Paul's environment...

I assumed that that was the case, since Paul suggests starting with wget. As I said, I need some guidance, but I also need the time to tackle it again. The main objective, with this project, is to get the build environment to work with a simple project that is known to work, since others have done it. After that, it is easier to move on to more complicated projects.
Title: Re: Have questions about porting software to eCS?
Post by: Joop on December 28, 2012, 10:05:15 am
Want to try to compile Rocrail, but its using Bazaar instead of CVS. How different are those two? Is it hard / difficult to port Bazaar to OS/2-eCS? Paul, you did CVS as far as I know, how difficult was it?

yeah the build of cvs I use was built by me.  I've never looked at bazaar, but likely it is quite portable, so I will try and take a look at it.

Note Rocrail has source snapshots available too - https://launchpad.net/rocrail/sunrise/2.0/+download/rocrail-4282-sources.tar.gz

Note also, this uses wxwidgets, which doesn't work terribly well on OS/2.
Thanks Paul, it needs Bazaar, so you have to start somewhere. Didn't know that wxwidgets doesn't work well with OS/2  :(, its used in many programs which does something with graphics. Get the feeling that graphics is our weak spot.
Title: Re: Have questions about porting software to eCS?
Post by: Paul Smedley on December 28, 2012, 10:09:32 am
Quote
wget built very easily with Paul's environment...

I assumed that that was the case, since Paul suggests starting with wget. As I said, I need some guidance, but I also need the time to tackle it again. The main objective, with this project, is to get the build environment to work with a simple project that is known to work, since others have done it. After that, it is easier to move on to more complicated projects.

FWIW, I downloaded the wget 1.14 source this evening and have run configure.  Will see what's required for me to get it building and post back here
Title: Re: Have questions about porting software to eCS?
Post by: Doug Bissett on December 28, 2012, 08:14:22 pm
Quote
FWIW, I downloaded the wget 1.14 source this evening and have run configure.  Will see what's required for me to get it building and post back here

Don't waste too much time on it. I can't get wget 1.11.1 to build either. There is something in my configuration that is wrong, and I won't have time to try to figure it out, until next year.
Title: Re: Have questions about porting software to eCS?
Post by: Paul Smedley on December 29, 2012, 06:16:18 am
Quote
FWIW, I downloaded the wget 1.14 source this evening and have run configure.  Will see what's required for me to get it building and post back here

Don't waste too much time on it. I can't get wget 1.11.1 to build either. There is something in my configuration that is wrong, and I won't have time to try to figure it out, until next year.

Fairly trivial.

One minor diff:
diff -ur wget-1.14-o/lib/spawn.in.h wget-1.14/lib/spawn.in.h
--- wget-1.14-o/lib/spawn.in.h   2012-12-28 19:05:04.000000000 +1030
+++ wget-1.14/lib/spawn.in.h   2012-12-29 15:36:20.000000000 +1030
@@ -32,7 +32,7 @@
 
 /* Get definitions of 'struct sched_param' and 'sigset_t'.
    But avoid namespace pollution on glibc systems.  */
-#if !(defined __GLIBC__ && !defined __UCLIBC__)
+#if !(defined __GLIBC__ && !defined __UCLIBC__) && !defined __KLIBC__
 # include <sched.h>
 # include <signal.h>
 #endif
Title: Re: Have questions about porting software to eCS?
Post by: Doug Bissett on December 29, 2012, 04:55:34 pm
Quote
Fairly trivial.

For you maybe.  :)

Anyway, now I need to find the time to figure out what you just said, and get this thing to build.

Thanks...
Title: Re: Have questions about porting software to eCS?
Post by: Paul Smedley on December 29, 2012, 08:50:29 pm
Thanks Paul, it needs Bazaar, so you have to start somewhere. Didn't know that wxwidgets doesn't work well with OS/2  :(, its used in many programs which does something with graphics. Get the feeling that graphics is our weak spot.

Re: bazaar - I'd forgotten, but it used python - so if you have python and gcc installed, trying to install it with 'python setup.py install' _may_ work.

Something triggered in my mind last night re: graphical toolkits like xwidgets and even gtk+ that it may be possible to compile them for OS/2 using the odin toolkit and the win32 api.  A lot of work has been done on odin recently - this may be a viable way to get other graphical toolkits than Qt onto OS/2.
I'm not committing _yet_ to take this on, but I am thinking about it.  Debugging apache2/php is starting to annoy me, so I need something fun to distract me :)

If I can compile the GTK+ toolkit using odin, there's a chance of getting an up to date Gimp for OS/2!
Title: Re: Have questions about porting software to eCS?
Post by: Paul Smedley on December 29, 2012, 08:53:09 pm
Quote
Fairly trivial.

For you maybe.  :)

Anyway, now I need to find the time to figure out what you just said, and get this thing to build.

Thanks...

OK, diff format is pretty simple:
diff -ur wget-1.14-o/lib/spawn.in.h wget-1.14/lib/spawn.in.h <== the source files that are being looked at for differences
-#if !(defined __GLIBC__ && !defined __UCLIBC__)     <== the source line that is being taken out (-)
+#if !(defined __GLIBC__ && !defined __UCLIBC__) && !defined __KLIBC__ <== the source line that is replacing the line being taken out (+)

What is the error you are getting when trying to compile wget?
Title: Re: Have questions about porting software to eCS?
Post by: Doug Bissett on December 31, 2012, 05:45:04 am
Thanks to Paul, I updated to his latest build environment, and applied the DIFF to the WGET 1.14 source (not sure that I did it right, but it works), and now I can build WGET 1.11.1 and WGET 1.14.  :-*

Unfortunately, I broke building PMMail when I did the update. I obviously deleted something that was added to something that got replaced.  :(

Oh well, you win some, and you lose some. Now, to sort out the PMMail build problem.
Title: Re: Have questions about porting software to eCS?
Post by: Andi B. on January 01, 2013, 02:40:17 pm
One issue for me is that building from 4os2 prompt does not work/gives different problems as with standard cmd. F.i. 4os2 -
Code: [Select]
{0}[u:\dev\dhcp-3.1-esv-r3] ash ./configure
System Type: os2
make[1]: Entering directory `U:/dev/dhcp-3.1-esv-r3/work.os2'
Making links in common
make[2]: Entering directory `U:/dev/dhcp-3.1-esv-r3/common'
make[2]: *** No rule to make target `links'.  Stop.
make[2]: Leaving directory `U:/dev/dhcp-3.1-esv-r3/common'
make[1]: *** [links] Error 1
make[1]: Leaving directory `U:/dev/dhcp-3.1-esv-r3/work.os2'
make: *** [links] Error 2

while cmd.exe gaves -
Code: [Select]
[U:\dev\dhcp-3.1-esv-r3]ash ./configure
System Type: os2
make[1]: Entering directory `U:/dev/dhcp-3.1-esv-r3/work.os2'
Making links in common
make[2]: Entering directory `U:/dev/dhcp-3.1-esv-r3/work.os2/common'
make[2]: Leaving directory `U:/dev/dhcp-3.1-esv-r3/work.os2/common'
Making links in minires
make[2]: Entering directory `U:/dev/dhcp-3.1-esv-r3/work.os2/minires'
.....

I do not see what problem is with 4os2 in "make[2]: *** No rule to make target `links'.  Stop." If someone else like me ever uses 4os2 you like to test with cmd.exe instead. On the other hand I really want to know why it does not work/work different with 4os2. Any clues?

-------------------------------------------
20130103 EDIT:
Solved above problem. It was the line '@if not defined CDPATH set CDPATH=..;..\..;' in 4start.cmd. Changed to '@if not defined CDPATH set CDPATH=.;..;..\..;' solves the problem (.; in front). As this is also in the sample 4start.cmd.sample I think I better post it here for future reference. No clue who ever have added this to 4start.cmd....
Title: Re: Have questions about porting software to eCS?
Post by: TeLLie on January 01, 2013, 07:36:31 pm
Hi Andy,

First to all the Best wishes for 2013 :)

You have in 4os2.ini this:
UnixPaths = Yes

I often use 4os2 instead of the plain cmd
Title: Re: Have questions about porting software to eCS?
Post by: Andi B. on January 01, 2013, 11:14:43 pm
Elbert, I think it was me who told you that, wasn't it? ;)

Since this day I've it in my 4os2.ini too. But unfortunately dhcp behaves still different with 4os2. Maybe the ` in front of `links' is the problem...
Title: Re: Have questions about porting software to eCS?
Post by: TeLLie on January 01, 2013, 11:51:10 pm
Hihi,

Now you mention it , yes thats true :P
But since i have set that, i don't see problems with 4os2

Title: Re: Have questions about porting software to eCS?
Post by: Andi B. on January 02, 2013, 12:15:42 am
Paul, did you made the dhconf.cmd in dhcp-3.1-esv-r3?
Title: Re: Have questions about porting software to eCS?
Post by: Paul Smedley on January 02, 2013, 02:53:31 am
Paul, did you made the dhconf.cmd in dhcp-3.1-esv-r3?

Pretty sure Allan Holm is (ir)responsible or that :)
Title: Re: Have questions about porting software to eCS?
Post by: Doug Bissett on January 05, 2013, 04:11:55 am
Thanks to Paul, I updated to his latest build environment, and applied the DIFF to the WGET 1.14 source (not sure that I did it right, but it works), and now I can build WGET 1.11.1 and WGET 1.14.  :-*

Unfortunately, I broke building PMMail when I did the update. I obviously deleted something that was added to something that got replaced.  :(

Oh well, you win some, and you lose some. Now, to sort out the PMMail build problem.

Well, it took a lot of time, but I got PMMail to build, and I can build WGET 1.14, using the DIFF described earlier by Paul.

I was going to restart a thread about building WGET 1.14, but it seems that all you need is Paul's latest build package, download the WGET package of choice from:

http://ftp.gnu.org/gnu/wget/ (http://ftp.gnu.org/gnu/wget/)

(I took the 1.14 tar.gz package), unzip it, and follow Paul's instructions.

Once you get that far, you know that the build environment is basically working, so you can then progress to other projects. It is probably best to pick something relatively simple, that has been done before, so it will be easier to get help when something doesn't go as expected, before going on to building more advanced things (like VirtualBox).   ;D

Have fun... ;)