Hey Dave!
...Libraries by default are searched for in @UNIXROOT/usr/lib. You can extend the search by using the full path, the -L compiler option (-Lx:/foo/lib) or the %LIBRARY_PATH% environment variable.
Libraries themselves are added to the command line with the -l (small L) parameter, so for pthreads, -lpthread is what you need to add to your compiler command line.
GCC will look for, (default, other flags can change the search order)
1. libfoo_dll.a
2. foo_dll.a
3. libfoo.a
4. foo.a
5. libfoo_s.a
6. foo_s.a
With .lib suffix instead of .a if using -Zomf. Dropping the lib prefix is an OS/2 thing for better 8.3 name compatibility and is usually dropped in the lib line on all platforms, so is usually -lfoo but could be -lx:/path/to/libfoo.a
The _dll.a is a shared import library and _s.a is a static library and without either _s or _dll, could be either. You can use emxomf.exe to convert a .a to .lib library (happens automatically with -Zomf LDFLAG).
The -l and -L are LDFLAGS along with any other that are meant to be passed to the linker...
Alright...so I left the above part of your post as a lead-in to my next topic, in the meantime however let me start off with something much more basic: how the heck do I get the "officially supported" watcom linker system to work?
So here in short is what I have done so far:
1) installed GCC 4.9.2, that seemed to work OK, I was able to compile code and created an EXE out of it, but that was for really simple stuff, basically your typical "hello world"
2) given that I wanted to do the multi-threading benchmarking stuff next I proceeded to deploy the pthread library but that is where I ran into issues at link time, the library functions were not being recognized
OK, so here you provided some great suggestions, I went back to the docs, read it all, multiple times, including on-line research to the EMX/GCC/Watcom specific stuff.
3) I further deployed the various RPM packages which, by the sounds of it, are deemed to be required to successfully build most of the Unix type stuff on our platform, such as the gcc-wrc, gcc-wlink, watcom-wlink-hll, watcom-wrc2. This now gave me the required wl.exe & wrc.exe in \usr\bin and added the following ot my CONFIG.SYS (which I was already experimenting with to learn about these, so I understand why they are being placed there, no problem there):
SET EMXOMFLD_LINKER=wl.exe
SET EMXOMFLD_TYPE=WLINK
SET EMXOMFLD_RC=wrc.exe
SET EMXOMFLD_RC_TYPE=WRC
I am fine with the Watcom approach here, even though the EMXOMFLD stuff could be configured to use IBMCPP 3.0.8 or 3.6.5, or even the default OS/2 Toolkit stuff. I figured the RPM packages support the Watcom way, so I shall proceed down that path first.
Alright...so what's wrong now?
Well, the simplest compile now fails with the following out of the watcom linker:
** EXPERIMENTAL (HLL) ** Open Watcom Linker Version 2.0beta1 Limited Availability
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
Warning! W1115: file wlink.lnk: line(16): environment name watcom not found
Error! E2093: file wlink.lnk: line(16): cannot open \binw\wlsystem.lnk
...and I'm thinking: OK, what was the point of doing the RPM package installs, getting the experimental versions of wl & wrc on my system if it still appears like I actually need to configure the normal Watcom stuff in the first place?
Heck, I already have Watcom 1.9 installed on my machine, the complete environment, why wouldn't it simply make more sense to use that instead of GCC??? Or IBMCPP 3.6.5 for that case? OK, maybe the answer lies in the IBM stuff being old and un-supported, but the whole process of just trying to get a working GCC environment seems so convoluted that it easily discourages one to pursue it further, and heck, I'm a guy that used to write big-data DBMS stuff (PL/SQL, some Unix scripting, etc) for living at some point in time...LOL, sorry, venting, yeah I know...but my God...!!!
So help me out please, what am I missing?
I will go further down the path of configuring the Watcom linker stuff, but based on the reading I have done so far that will cause the linker to pull the Watcom libraries (because the wlink.lnk & wlsystem.lnk files are configured as such) instead of the preferred GCC libraries, such as the pthread stuff that's sitting in \usr\lib, and that just doesn't make sense to me.