Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Compiling SLang program

0 views
Skip to first unread message

Alex Taylor

unread,
Aug 10, 2009, 8:55:02 PM8/10/09
to
I'm trying to build a program which uses the SLang library. Actually,
right now I'm just trying to get the configure script to acknowlege that
SLang is installed. But I can't do it with a standalone program either.

---- sltest.c ------------------------------------------------------
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char SLang_init_tty ();

int
main ()
{
return SLang_init_tty ();
;
return 0;
}
--------------------------------------------------------------------

Relevant environment settings:
LIBRARY_PATH=e:/emx/lib;e:/usr/lib;e:/usr/local/lib
C_INCLUDE_PATH=e:/emx/include;e:/usr/include;e:/usr/local/include;e:/usr/local/
include/ncurses;

slang.h and slcurses.h are in e:\usr\local\include and slang.a and slang.lib
are in e:\usr\local\lib.

However, any time I try to compile:
[F:\programming\c]gcc -lslang sltest.c
(...): Undefined symbol _SLang_init_tty referenced from text segment


Am I missing something stupid here?

Using emx+gcc 0.9d-4.

--
Alex Taylor
Fukushima, Japan
http://www.socis.ca/~ataylo00

Please take off hat when replying.

Dave Yeo

unread,
Aug 10, 2009, 10:03:13 PM8/10/09
to

Try gcc sltest.c -lslang
Should really be gcc -Zmt sltest.c -o sltest.o -lslang
or -o sltest.exe.
It is really important with emx to be consistent with using the
multi-thread library or not so if something is built with -Zmt (or
-Zmtd) you need -Zmt in CFLAGS and LDFLAGS or you will get weird runtime
errors. Only time not to use the multi-thread library is if you want to
run your program under DOS.
Dave

Ilya Zakharevich

unread,
Aug 11, 2009, 12:07:11 AM8/11/09
to
On 2009-08-11, Alex Taylor <mai...@reply.to.address> wrote:
> Relevant environment settings:
> LIBRARY_PATH=e:/emx/lib;e:/usr/lib;e:/usr/local/lib
> C_INCLUDE_PATH=e:/emx/include;e:/usr/include;e:/usr/local/include;e:/usr/local/
> include/ncurses;
>
> slang.h and slcurses.h are in e:\usr\local\include and slang.a and slang.lib
> are in e:\usr\local\lib.
>
> However, any time I try to compile:
> [F:\programming\c]gcc -lslang sltest.c
> (...): Undefined symbol _SLang_init_tty referenced from text segment

> Am I missing something stupid here?
>
> Using emx+gcc 0.9d-4.

There is ABI incompatibility between EMX and K-gcc (different
underscore'ing). Are you sure that slang.a is compiled for EMX?

Check

nm e:\usr\local\lib/slang.a

Yours,
Ilya

Dave Yeo

unread,
Aug 11, 2009, 12:16:04 AM8/11/09
to
On 08/10/09 09:07 pm, Ilya Zakharevich wrote:
> There is ABI incompatibility between EMX and K-gcc (different
> underscore'ing). Are you sure that slang.a is compiled for EMX?
>
> Check
>
> nm e:\usr\local\lib/slang.a
>

I just compiled slang with EMX and checked with nm before answering
Alex's mail. The symbols have an underscore prefix.
As I stated it is just where -lslang appears on the command line.
Dave

Alex Taylor

unread,
Aug 11, 2009, 6:49:01 AM8/11/09
to
On Tue, 11 Aug 2009 04:16:04 UTC, Dave Yeo <dave....@gmail.com> wrote:

> > There is ABI incompatibility between EMX and K-gcc (different
> > underscore'ing). Are you sure that slang.a is compiled for EMX?
>

> I just compiled slang with EMX and checked with nm before answering
> Alex's mail. The symbols have an underscore prefix.
> As I stated it is just where -lslang appears on the command line.

Yeah... I was getting the same error from the autogenerated 'configure'
script though.

In any case, the solution was to both change the position AND add the
-Zmt switch.

Thanks!

(Now I just have to figure out why several object files are kicking up
'Undefined symbol _errno referenced from text segment'.)

Dave Yeo

unread,
Aug 11, 2009, 10:49:52 AM8/11/09
to
On 08/11/09 03:49 am, Alex Taylor wrote:
> On Tue, 11 Aug 2009 04:16:04 UTC, Dave Yeo<dave....@gmail.com> wrote:
>
>>> There is ABI incompatibility between EMX and K-gcc (different
>>> underscore'ing). Are you sure that slang.a is compiled for EMX?
>>
>> I just compiled slang with EMX and checked with nm before answering
>> Alex's mail. The symbols have an underscore prefix.
>> As I stated it is just where -lslang appears on the command line.
>
> Yeah... I was getting the same error from the autogenerated 'configure'
> script though.
>
> In any case, the solution was to both change the position AND add the
> -Zmt switch.

Slightly different then me then. I was also getting errors about main()
being multiply defined before moving the -lslang.

>
> Thanks!
>
> (Now I just have to figure out why several object files are kicking up
> 'Undefined symbol _errno referenced from text segment'.)
>

Try adding -D__ST_MT_ERRNO__ and/or -Zsys-signals to CFLAGS and LDFLAGS.
My CFLAGS, CXXFLAGS and LDFLAGS in config.site contain
CFLAGS='-D__EMX__ -DOS2 -Zmtd -D__ST_MT_ERRNO__ -O2 -fomit-frame-pointer
-Zbin-files -Dstrncasecmp=strnicmp -Dstrcasecmp=stricmp'

Dave

Alex Taylor

unread,
Aug 17, 2009, 6:57:01 AM8/17/09
to
On Tue, 11 Aug 2009 14:49:52 UTC, Dave Yeo <dave....@gmail.com> wrote:

> > (Now I just have to figure out why several object files are kicking up
> > 'Undefined symbol _errno referenced from text segment'.)
>
> Try adding -D__ST_MT_ERRNO__ and/or -Zsys-signals to CFLAGS and LDFLAGS.
> My CFLAGS, CXXFLAGS and LDFLAGS in config.site contain
> CFLAGS='-D__EMX__ -DOS2 -Zmtd -D__ST_MT_ERRNO__ -O2 -fomit-frame-pointer
> -Zbin-files -Dstrncasecmp=strnicmp -Dstrcasecmp=stricmp'

I guess you mean '-Zsysv-signals', although, interestingly, if I specify
that then the program hangs forever on startup without ever displaying
the PM GUI (exactly the same as what happens if I increase the default
stack size, as mentioned in another post).

However, just specifying -D__ST_MT_ERRNO__ does allow the program to build.

...unfortunately, it gives a SYS3175 if I try to start with the SLang
interface. I've just given up for now, since the ncurses interface
works fine.

0 new messages