Author Topic: Compiling a PM sample with GCC (2023)  (Read 87885 times)

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #15 on: April 26, 2023, 06:32:39 am »
Hi Dave

[L:\]fc-match fixed
HELV.PFB: "Helvetica" "Regular"

fc-cache -r seems to have fixed the problem.


Thanks

Pete

Bad cache. fc-cache -r really forces all fontconfig caches to be rebuilt. fc-cache or fc-cache -f might have been good enough.
Edit: Helvetica isn't really a good choice for fixed, but must be the best that fontconfig can find.
« Last Edit: April 26, 2023, 06:35:25 am by Dave Yeo »

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #16 on: April 26, 2023, 05:21:14 pm »
OK, it looks like you fixed a few warnings and you're tree works here. Previous didn't show any of the different text's, just a blank window.
Edit: Seems that your changing a couple of USHORT's to ULONG's in VECTFONT.C fixed it.


Thanks Dave. I didn't notice that ULONG change will benefit the program in that way.

I need some help to try to get out the warnings, What do you suggest me with this " CHAR * {aka char *}" warning?
I had try to change the declaration to "unsigned char" but it generates more warning.

Quote
vf00.c: In function 'QueryStartPointInTextBox':
vf00.c:90:36: warning: pointer targets in passing argument 3 of 'GpiQueryTextBox' differ in signedness [-Wpointer-sign]
   90 |      GpiQueryTextBox (hps, cbText, szText, TXTBOX_COUNT, aptl) ;
      |                                    ^~~~~~
      |                                    |
      |                                    CHAR * {aka char *}
In file included from C:/usr/include/os2.h:39,
                 from vf00.c:7:
C:/usr/include/os2emx.h:9211:59: note: expected 'PCH' {aka 'unsigned char *'} but argument is of type 'CHAR *' {aka 'char *'}
 9211 | BOOL APIENTRY GpiQueryTextBox (HPS hps, LONG lCount1, PCH pchString, LONG lCount2,
      |                                                       ~~~~^~~~~~~~~

My goal is to leave this sample as good as possible to compile with GCC and the .h that we have on the RPM.

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

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #17 on: April 26, 2023, 06:54:09 pm »
Hi
I had reduced the number of warnings of  "szText".
I just have 9 warnings left, but I'm stuck there.

Regards
« Last Edit: April 26, 2023, 11:17:31 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #18 on: April 27, 2023, 06:59:24 am »
Try this one. Did some casts and added a bunch of curly brackets.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #19 on: April 27, 2023, 04:51:10 pm »
Thank you Dave for the casting lesson. It compiles beautifully now without any warnings.

I will prepare the file with a readme and upload it to github.

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

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #20 on: April 27, 2023, 04:58:54 pm »
Here it goes.

And uploaded to github: https://github.com/OS2World/DEV-SAMPLES-PM-VectFont
« Last Edit: April 27, 2023, 11:01:45 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #21 on: April 27, 2023, 11:32:31 pm »
Hi

Moving to the next one:
https://github.com/OS2World/DEV-SAMPLES-PM-Slider

This is an older sample, I recreated the makefile, since it looked in a format I don't know about.
I think I solved the warnings.

I'm still not sure how it looks, I'm getting this issue with the wrc.

Code: [Select]
[C:\DEV\DEV-SAMPLES-PM-SLIDER]make   2>&1  | tee make.out
gcc -Wall -Zomf -c -O2 slider.c -o slider.obj
wrc -r slider.rc
Open Watcom Windows and OS/2 Resource Compiler Version 2.0beta1 LA
Portions Copyright (c) 1993-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
slider.rc(30): Error! E049: Syntax error near "0x00000100L "
make: *** [slider.res] Error 8


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

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #22 on: April 28, 2023, 02:37:48 am »
Trying with rc instead of wrc, I get
Code: [Select]
Creating binary resource file slider.RES
RC:  RCPP -E -D RC_INVOKED -W4 -f slider.rc -ef W:\OS2\RCPP.ERR -I W:\usr\include\os2tk45\inc -I W:\usr\include\os2tk45\gl -I W:\usr\include\os2tk45
slider.rc(36) : fatal error C1004: unexpected EOF
make: *** [makefile:17: slider.res] Error 3

Fixed by adding an EOL (blank line) at the end of the rc file. Wrc stll fails.
Was there a reason that you named the binary vectfont.exe? Seems it should be slider.exe.
Now the error is
Code: [Select]
Creating binary resource file slider.RES
RC:  RCPP -E -D RC_INVOKED -W4 -f slider.rc -ef W:\OS2\RCPP.ERR -I W:\usr\includ
e\os2tk45\inc -I W:\usr\include\os2tk45\gl -I W:\usr\include\os2tk45

slider.rc
gcc -Zomf slider.obj slider.res slider.obj slider.def -o slider.exe
weakld: H:\tmp\DEV-SAMPLES-PM-Slider\slider.obj - error: Duplicate symbol '_main' ('_main').
weakld: H:\tmp\DEV-SAMPLES-PM-Slider\slider.obj - error: Symbol previosly defined in this module.
weakld: info: fFlags new 0x0001  fFlags old 0x0001 (PUBLIC).
weakld: info: The symbol is referenced by:
    W:\usr\lib\crt0.obj
emxomfld: weak prelinker failed. (rc=-1)
make: *** [makefile:10: slider.exe] Error 1


Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #23 on: April 28, 2023, 02:44:12 am »
Hi Dave

vectfont.exe was my mistake on the makefile. I fixed it, includes the EOL on the rc file and now I get this.

Code: [Select]
gcc -Wall -Zomf -c -O2 slider.c -o slider.obj
wrc -r slider.rc
Open Watcom Windows and OS/2 Resource Compiler Version 2.0beta1 LA
Portions Copyright (c) 1993-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
slider.rc(30): Error! E049: Syntax error near "0x00000100L "
make: *** [slider.res] Error 8

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

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #24 on: April 28, 2023, 02:55:19 am »
Yes, I'm still using rc.exe for now until I research.
You had two slider.obj in the linker line in the makefile causing the duplicate main() error.
Then need to remove the export in the DEF file to get rid of
Code: [Select]
weakld: error: Unresolved symbol (UNDEF) 'ClientWndProc
Then slider.exe works.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #25 on: April 28, 2023, 03:08:53 am »
The rc file is missing a | after SLS_READONLY on line 30. Strange that rc is fine with that but not wrc.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #26 on: April 28, 2023, 03:49:41 am »
Hi Dave

If I remove .DEF from the make file, and add the | after SLS_READONLY, it will compile. But my slider.exe just loads and quit without working.

I get this message now with RC:

Quote

[C:\DEV\DEV-SAMPLES-PM-SLIDER]make   2>&1  | tee make.out
gcc -Wall -Zomf -c -O2 slider.c -o slider.obj
gcc -Zomf slider.obj slider.res -o slider.exe
Compile ending.
RC is reading the binary resource file C:\dev\DEV-SAMPLES-PM-Slider\slider.res.

RC :Warning 3014: RC found a resource type equal to zero.
RC :Error 1003:RC had an I/O error with file .

make: *** [slider.exe] Error 1
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #27 on: April 28, 2023, 03:56:42 am »
Try this one.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #28 on: April 28, 2023, 04:38:38 am »
Hi

slider.exe compiles.

Code: [Select]
[C:\DEV\DEV-SAMPLES-PM-SLIDER]make   2>&1  | tee make.out
gcc -Wall -Zomf -O2 -c slider.c -o slider.obj
gcc -Zomf slider.obj slider.res slider.def -o slider.exe
Compile ending.
RC is reading the binary resource file C:\dev\DEV-SAMPLES-PM-Slider\slider.res.

RC :Warning 3014: RC found a resource type equal to zero.
RC :Error 1003:RC had an I/O error with file .

make: *** [slider.exe] Error 1


When I run it it crash and gives this POPUPLOG.
Code: [Select]

04-27-2023  16:26:24  SYS3171  PID 111d  TID 0001  Slot 00a7
C:\HOME\DESKTOP\SLIDER.EXE
c0000005
1fa0f452
P1=00000002  P2=0004fffc  P3=XXXXXXXX  P4=XXXXXXXX 
EAX=000500a8  EBX=1b914ff8  ECX=5f1dc7d0  EDX=19e31bba
ESI=00000000  EDI=000503cc 
DS=0053  DSACC=d0f3  DSLIM=5fffffff 
ES=0053  ESACC=d0f3  ESLIM=5fffffff 
FS=150b  FSACC=00f3  FSLIM=00000030
GS=0000  GSACC=****  GSLIM=********
CS:EIP=005b:1fa0f452  CSACC=d0df  CSLIM=5fffffff
SS:ESP=0053:00050000  SSACC=d0f3  SSLIM=5fffffff
EBP=000500a8  FLG=00010202

SOFTDRAW.DLL 0001:0007f452

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

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #29 on: April 28, 2023, 05:54:28 am »
Are you mixing rc.exe and wrc.exe? I used rc.exe to troubleshoot and then reverted to wrc, have to keep the environmental variables in sync with the makefile.
Here's the same package without doing make clean, slider.exe works here.