OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Neil Waldhauer on June 03, 2019, 07:42:03 pm

Title: Compiling PMMail with GCC 4.9.2
Post by: Neil Waldhauer on June 03, 2019, 07:42:03 pm
I'd like to compile PMMail using GCC 4.9.2. Currently I have GCC 3.3.5 and a bunch of tools working.

I had hoped to just drop in GCC 4.9.2 in place of GCC 4.9.2, but somehow my GCC 4.9.2 setup is wrong.

It compiles PMMail just fine until it hits a va_start() macro. I have the same trouble compiling the attached vatest.c

In file included from k:/programs/gcc/include/machine/stdarg.h:2:0,
                 from k:/programs/gcc/include/stdarg.h:2,
                 from vatest.c:1:
vatest.c: In function 'int sum(int, ...)':
vatest.c:18:4: error: '__builtin_stdarg_start' was not declared in this scope
    va_start(ap, num_args);

Those don't look like the right include files to me. Something is wrong, but what?
Title: Re: Compiling PMMail with GCC 4.9.2
Post by: Dave Yeo on June 03, 2019, 09:18:03 pm
I can't find a reference anywhere to a header containing the __builtin_stdarg_start but attempting to compile here using GCC 4.9.2 results in
Code: [Select]
[Z:\Mozprofiles\Downloads]gcc -Zomf vatest.c

[Z:\Mozprofiles\Downloads]dir vatest*

The volume label in drive Z is mozprofiles.
The Volume Serial Number is E5C3:E5BD.
Directory of Z:\Mozprofiles\Downloads

 6-03-19 12:05p           453      0 a---  vatest.c
 6-03-19 12:13p         4,904      0 a---  vatest.exe
        2 file(s)       5,357 bytes used
                   20,105,801 K bytes free

[Z:\Mozprofiles\Downloads]vatest.exe
Sum of 10, 20 and 30 = 60
Sum of 4, 20, 25 and 30 = 79

Why aren't you installing GCC 4.9.2 with YUM/RPM or ANPM?
Title: Re: Compiling PMMail with GCC 4.9.2
Post by: Gregg Young on June 03, 2019, 11:37:30 pm
Try reinstalling libc-0.1.1-1-devel which is where the header for this is located. The header is "include\386\stdarg.h". It defines va_start.
Title: Re: Compiling PMMail with GCC 4.9.2
Post by: Neil Waldhauer on June 04, 2019, 02:35:38 am

Why aren't you installing GCC 4.9.2 with YUM/RPM or ANPM?

I tried installing gcc with yum/rpm. I can compile the example code with that gcc.

But I can't find the environment. How does that copy of gcc find its header files?

Neil
Title: Re: Compiling PMMail with GCC 4.9.2
Post by: Dave Yeo on June 04, 2019, 05:07:48 am
It's basically hard coded to look in @UNIXROOT/usr/include as well as @UNIXROOT/usr/lib/gcc/i386-pc-os2-emx/4.9.2/include and include-fixed. You can override with set C_INCLUDE_PATH and CPLUS_INCLUDE_PATH.
Title: Re: Compiling PMMail with GCC 4.9.2
Post by: Neil Waldhauer on June 05, 2019, 06:05:53 am
OK, I combined gcc installed by rpm/yum with the rest of the PMMail build environment. It looks promising.

I can supply ilink.exe myself, but is there one in the rpm/yum universe?
Title: Re: Compiling PMMail with GCC 4.9.2
Post by: Dave Yeo on June 05, 2019, 06:56:47 am
Use wlink (wl.exe). Run emxomfld with no parameters to see the environment variables to set to use it. You may have to also use lxlite on the resulting binary as wlink doesn't pack the binary like ilink can do. Package is watcom-wlink-hll.
Title: Re: Compiling PMMail with GCC 4.9.2
Post by: Gregg Young on July 08, 2019, 07:52:44 pm
After building pmmail we discovered an odd issue with the gcc compilers. The popen function is hard coded to use sh as its shell which doesn't play well with path names containing back slashes and of course fails on systems where sh isn't installed.  This problem exists in 4.9.2 (I haven't tried the RPM version) and 8.3.0 (only ones I have tried). Apparently this wasn't true for 3.3.5. I have reported this on Paul's Mantis site.
Title: Re: Compiling PMMail with GCC 4.9.2
Post by: Rich Walsh on July 08, 2019, 11:02:07 pm
After building pmmail we discovered an odd issue with the gcc compilers. The popen function is hard coded to use sh as its shell which doesn't play well with path names containing back slashes and of course fails on systems where sh isn't installed.

I ran into this and got annoyed enough to write my own which doesn't use any shell at all. See the attachment.

While we're on the subject of annoyances... The file's extension should be '.c' but os2world won't allow me to attach something so dangerous, so I had to change it to '.txt'.
Title: Re: Compiling PMMail with GCC 4.9.2
Post by: Paul Smedley on July 09, 2019, 01:58:52 am
After building pmmail we discovered an odd issue with the gcc compilers. The popen function is hard coded to use sh as its shell which doesn't play well with path names containing back slashes and of course fails on systems where sh isn't installed.  This problem exists in 4.9.2 (I haven't tried the RPM version) and 8.3.0 (only ones I have tried). Apparently this wasn't true for 3.3.5. I have reported this on Paul's Mantis site.

umm popen is part of libc, not the compiler......
Title: Re: Compiling PMMail with GCC 4.9.2
Post by: Gregg Young on July 09, 2019, 02:08:33 am
Rich Thanks for the code.

Paul Yes I realize that now sorry for the noise.