Author Topic: Compiling PM app on 2016.  (Read 6740 times)

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 8
  • -Receive: 91
  • Posts: 1176
    • View Profile
Re: Compiling PM app on 2016.
« Reply #15 on: July 14, 2016, 04:36:29 pm »
Our Gnu Make is installed as "yum install kbuild-make" and there is nmake in the toolkit and as an optional install on old Warp.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 255
  • -Receive: 49
  • Posts: 1708
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling PM app on 2016.
« Reply #16 on: July 15, 2016, 02:37:35 pm »
Thanks Dave. I will be trying it today.

I will also check this simple tutorial to see if I can make the .mk file run.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 255
  • -Receive: 49
  • Posts: 1708
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling PM app on 2016.
« Reply #17 on: July 15, 2016, 02:41:13 pm »
Are you trying to compile through the OS/2 port of GCC?....

Yes Rick.

My goal is try to use as much as open source compilers and tools to test the samples of the "OS/2 PM Programming"  book from Charles Petzold.

I will be trying GNU MAKE that is on  "kbuild-make" RPM and the LINK program that is also on the GNU tools ported to OS/2.  If I get stuck I may use something from the OS2Toolkit, but let see if I can pull this samples with open source first.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Andy Willis

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 9
  • Posts: 158
    • View Profile
Re: Compiling PM app on 2016.
« Reply #18 on: July 15, 2016, 04:29:19 pm »
Are you trying to compile through the OS/2 port of GCC?....

Yes Rick.

My goal is try to use as much as open source compilers and tools to test the samples of the "OS/2 PM Programming"  book from Charles Petzold.

I will be trying GNU MAKE that is on  "kbuild-make" RPM and the LINK program that is also on the GNU tools ported to OS/2.  If I get stuck I may use something from the OS2Toolkit, but let see if I can pull this samples with open source first.

Regards

You would probably be better off using wmake from open watcom, and consequently just using OW entirely, than make as wmake has a switch to make it nmake compatible.  wmake will work with gcc if you desire but OW is open source so would fit you desires in that regard.

Rick C. Hodgin

  • Full Member
  • ***
  • Thank You
  • -Given: 17
  • -Receive: 2
  • Posts: 241
    • View Profile
    • Liberty Software Foundation
Re: Compiling PM app on 2016.
« Reply #19 on: July 15, 2016, 06:37:41 pm »
You would probably be better off using wmake from open watcom, and consequently just using OW entirely, than make as wmake has a switch to make it nmake compatible.  wmake will work with gcc if you desire but OW is open source so would fit you desires in that regard.

+1.  /I/ appreciate that information too, Andy.  Thank you.

Best regards,
Rick C. Hodgin

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 255
  • -Receive: 49
  • Posts: 1708
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling PM app on 2016.
« Reply #20 on: July 15, 2016, 10:54:15 pm »
Hi

I have no idea how to use the make command.

For the SYSVALS sample I was guessing it was as simple as:
Code: [Select]
make SYSVALS.MAK

But I get
Quote
make: Nothing to be done for `SYSVALS.MAK'.

I modified SYSVALS.MAK like this:

Code: [Select]
#------------------------
# SYSVALS.MAK make file
#------------------------

PRGCC=gcc
PRGLINK=link


sysvals.exe : sysvals.obj sysvals.def
     $(PRGLINK) sysvals, sysvals, NUL, sysvals

sysvals.obj : sysvals.c sysvals.h
     $(PRGCC) sysvals.c


Any tips?

Regards
« Last Edit: July 15, 2016, 11:11:02 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Rick C. Hodgin

  • Full Member
  • ***
  • Thank You
  • -Given: 17
  • -Receive: 2
  • Posts: 241
    • View Profile
    • Liberty Software Foundation
Re: Compiling PM app on 2016.
« Reply #21 on: July 16, 2016, 02:50:26 am »
Hi

I have no idea how to use the make command.

For the SYSVALS sample I was guessing it was as simple as:
Code: [Select]
make SYSVALS.MAK

But I get
Quote
make: Nothing to be done for `SYSVALS.MAK'.

I modified SYSVALS.MAK like this:

Code: [Select]
#------------------------
# SYSVALS.MAK make file
#------------------------

PRGCC=gcc
PRGLINK=link


sysvals.exe : sysvals.obj sysvals.def
     $(PRGLINK) sysvals, sysvals, NUL, sysvals

sysvals.obj : sysvals.c sysvals.h
     $(PRGCC) sysvals.c


Any tips?

Regards

The make utility is designed to handle the variable compilation of a system by looking at what files have changed, and then only compiling minimally the requirements of the project.  If you have ten .c files which create ten .obj files, and of those ten .c files some of them have dependencies on other .h files, then whenever a .h file is changed, it will recompile anything that will be affected by that change.

In the example you post here, it may be saying that the .obj files are already built, and that the .exe file is already built, and that nothing has changed, so there is nothing to do.

If you load sysvals.c or sysvals.h into a text editor, and simply re-save it, and then run make, it may recompile and rebuild.

Best regards,
Rick C. Hodgni

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 8
  • -Receive: 91
  • Posts: 1176
    • View Profile
Re: Compiling PM app on 2016.
« Reply #22 on: July 16, 2016, 03:50:15 am »
make --help is your friend, Usually make will automatically use a file named makefile. In this case you have to point at the makefile, make -f SYSVALS.MAK.
You should use PRGLINK=gcc and gcc will call the correct linker, ld by default or with the -Zomf flag emxomfld, which, depending on environment variables (run emxomfld with no arguments to see the variables) will invoke wlink, ilink or link386 with the correct arguments.

Gregg Young

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 16
    • View Profile
Re: Compiling PM app on 2016.
« Reply #23 on: July 26, 2016, 05:17:48 am »
Martin

If you are serious about helping to maintain or port software I think you need to install Open Watcom for maintaining OS/2 software and need  GCC for porting. Open Watcom has been forked. There is a 2.0 version of the fork that has an OS/2 version but that version doesn't contain the latest OX/2 code. The unforked version is still at 1.9 which lacks Steve Levine's debug and high memory updates and lacks wipfc. I would recommend you install the unforked 1.9 and highly recommend if you or anyone else is interested I have a build of the latest code which I can provide as a zip file you can unzip over the i1.9 install.

As for GCC, Paul Smedley offers a copy of his build environment for a small donation either by mail on a DVD or via download (note it is huge). This gives you a very complete environment. If you want to stick with what is available from yum. You should also download the open watcom linker (on the netlabs rpm site) and make sure GCC is setup to use it as the linker (it is the most capable and advanced linker that runs on OS/2). Obviously if you get the latest Open Watcom from me you can forgo the download and just use the OW linker (wl) from the OW install.

Andi B.

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 12
  • Posts: 323
    • View Profile
Re: Compiling PM app on 2016.
« Reply #24 on: July 26, 2016, 09:37:29 am »
Quote
The unforked version is still at 1.9 which lacks Steve Levine's debug and high memory updates and lacks wipfc.
Is this still true for the nightly builds from the current perforce repository? I don't think so but I'm not sure.

Frank regularly builds whole package from the official source. Last drop is from May 28, 2016. It is called 2.0 too.

The unofficial fork at sourceforge does have some nasty bugs and is not very well tested. So I don't want to recommend it but the official one build by Frank or by yourself from the perforce repository instead.

Mentore

  • Jr. Member
  • **
  • Thank You
  • -Given: 15
  • -Receive: 1
  • Posts: 55
    • View Profile
Re: Compiling PM app on 2016.
« Reply #25 on: July 26, 2016, 12:46:42 pm »
Martin

If you are serious about helping to maintain or port software I think you need to install Open Watcom for maintaining OS/2 software and need  GCC for porting. Open Watcom has been forked. There is a 2.0 version of the fork that has an OS/2 version but that version doesn't contain the latest OX/2 code. The unforked version is still at 1.9 which lacks Steve Levine's debug and high memory updates and lacks wipfc. I would recommend you install the unforked 1.9 and highly recommend if you or anyone else is interested I have a build of the latest code which I can provide as a zip file you can unzip over the i1.9 install.

Hello Gregg,
I'm interested in your updated 1.9 version. How can I obtain it?

If you need to email me just contact me at mentore dot siesto at alice dot it.

Thanks in advance!
Mentore

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 255
  • -Receive: 49
  • Posts: 1708
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling PM app on 2016.
« Reply #26 on: July 28, 2016, 02:17:30 am »
Hi Gregg, Andi W.

I'm going very slow on this subject. For the moment I only want to learn to compile some samples. On the past my stopper was that it was very elaborated to install the development environment, this is why I'm trying to do it as quick as possible with RPM/YUM this time.

I will try OpenWatcom on the future, but I will go very slow with this.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Lars

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 21
  • Posts: 163
    • View Profile
Re: Compiling PM app on 2016.
« Reply #27 on: July 30, 2016, 07:29:36 pm »
1) use ANPM to install these packages: gcc, gcc-wlink, gcc-wrc. Alternatively you can run "yum install gcc gcc-wlink gcc-wrc" from a commandline.

2) Make sure these lines are in config.sys or add them if they are not. Fix the drive letter to your system and make sure you have the OS/2 toolkit installed (the below setup will use the OS/2 toolkit for all headers instead of what comes in usr/include. The reason is that what comes in usr/include is not complete with regard to what the toolkit offers):
SET GCCOPT=-static-libgcc -DUSE_OS2_TOOLKIT_HEADERS -Zomf
SET C_INCLUDE_PATH=D:/USR/INCLUDE;D:/OS2TK45/H
SET LIBRARY_PATH=D:/USR/LIB
SET EMXOMFLD_RC=wrc.exe
SET EMXOMFLD_RC_TYPE=WRC
SET EMXOMFLD_LINKER=wl.exe
SET EMXOMFLD_TYPE=WLINK

3) this is how you then compile a file:
gcc -c -Wall

4) this is how you link together multiple files (and create a map file) and link to libs lib1 and lib2
gcc -Zmap -o myexe.exe lib1 lib2 foo1.o foo2.o

There are variations to the compiler flags: add -O if you want optimization or -g if you want to debug etc.
You should just know that what is set in GCCOPT appends to what you specify as switches to gcc.exe.
I did it this way because there are things that you always would need to set, for example the -Zomf switch
(for the compilation as well as for the linking stage).

5) change your makefile so that it uses the switches for compiling and linking as given above.

6) instead of using nmake.exe you could also use make:
use ANPM and install kbuild-make or run "yum install kbuild-make" from the commandline
However that means you will need to change the makefile syntax and structure to what make accepts. I recommend some book.
The documentation of nmake.exe however is available in the OS/2 toolkit.

One last thing: the above setup will allow you to source code debug executables built with gcc to operate under the VAC debugger or various other debuggers that use the HLL debug format. This is the standard debug format that any of IBM's debuggers use (VAC debugger, SD386, ICAT, etc.). I would hope that even the Watcom debugger can debug this format but I haven't tried and I am not sure.

Lars

« Last Edit: July 30, 2016, 07:33:50 pm by Lars »

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 8
  • -Receive: 91
  • Posts: 1176
    • View Profile
Re: Compiling PM app on 2016.
« Reply #28 on: July 30, 2016, 10:07:01 pm »
On top of what Lars posted (good advice), I'd also add this to config.sys
Code: [Select]
SET SHELL=sh.exe
SET EMXSHELL=sh.exe
SET CONFIG_SHELL=sh.exe
SET MAKESHELL=sh.exe
SET EXECSHELL=sh.exe
[code]

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 255
  • -Receive: 49
  • Posts: 1708
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling PM app on 2016.
« Reply #29 on: August 13, 2016, 08:56:27 pm »
Thanks for the tips but I'm still stuck on the samples of Chapter 04.

My goal is to make that sample compile with gcc if it is possible.

Since I got stuck with the "make" command, I'm trying to see if it just compiles with a single command line (no idea if it is possible).
I also installed OS2TK45 with RPM YUM and added to the config.sys what Lar's suggested.

I'm trying  "gcc -o sysvals.exe sysvals.c sysvals.def sysvals.h" it gaves me a lot of errors and warnings and I can not capture them all. Maybe it is something very basic to capture the errors but I don't know how to do it. I'm trying "gcc -o sysvals.exe sysvals.c sysvals.def sysvals.h >out.txt" but it generated an empty file.

I also tried "gcc -Zmap -o sysvals.exe sysvals.c sysvals.def sysvals.h" with the same results.

So I'm stuck, any other tip is welcome.

Regards
« Last Edit: August 13, 2016, 09:02:21 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.