Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

makefile and shareable images

 
SOLVED
Go to solution
T. Uso
Advisor

makefile and shareable images

HP C 7.2-022 on OpenVMS IA64 8.3-1H1
GNV 2.1-2

Is there a way to build an exe with a makefile inside gnv when the link needs shareable images? In other words, how to translate "$link prog.obj, file.opt/option" a la Unix?

Thanks for your help.
11 REPLIES
H.Becker
Honored Contributor
Solution

Re: makefile and shareable images

If you have a main object m.o and a shared library libs.so then you just enter

bash$ cc -o m m.o -L. -ls

It should be easy to adopt that for your prog.obj and to create a symbolic link from libs.so to your shareable image s.exe. The same line should work as an action in your makefile.
T. Uso
Advisor

Re: makefile and shareable images

Using symbolic links does not seem to help.

I create the symbolic link like that:

bash$ ln -s /dka0/sys0/syscommon/syslib/ssl\$\libssl_shr.exe libssl.so

The makefile looks like :

...

LDFLAGS+=-L. -lssl $(DEBUG)
CFLAGS+=-O2 -DVERSION=\"$(VERSION)\" $(DEBUG)

OBJS=mem.o http.o io.o str.o error.o utils.o main.o tcp.o mssl.o res.o

httping: $(OBJS)
$(CC) $(OBJS) $(LDFLAGS) -o httping

...

I get the objects but the link fails :

bash$ make httping

...

cc mem.o http.o io.o str.o error.o utils.o main.o tcp.o mssl.o res.o -L . -lssl -g -o httping
? cc: Warning: library "ssl" not found

...
Hoff
Honored Contributor

Re: makefile and shareable images

AFAIK, libssl usually lives in /usr/lib

Which is usually the [usr.lib] area.

I'd expect gnv to tend to look there, given it's trying to follow how bash and Unix does this.

FWIW. Ignore this as appropriate.
H.Becker
Honored Contributor

Re: makefile and shareable images

I'm sorry, I tested this on ODS2 and expected it to work on ODS5 as well. My simple example no longer works there (GNV 2.1-1, 8.3/I64)

You can use VMS style linker options files in GNV. My example, again:

bash$ cc -o m m.o
%ILINK-E-NUDFSYMS, 2 undefined symbols:
%ILINK-I-UDFSYM, F
%ILINK-I-UDFSYM, I
%ILINK-W-USEUNDEF, undefined symbol F referenced
section: $CODE$
offset: %X0000000000000110 slot: 2
module: M
file: USER5:[beckerh]m.o;1
bash$ cat >gnv\$m.opt
sys$login:s/share
[ Exit ]
bash$ export GNV_OPT_DIR=.
bash$ cc -o m m.o
Adding special opt file ./gnv$m.opt to link
bash$

In words, you have to create an options file with the name gnv$.opt. Then you have to export the environment variable GNV_OPT_DIR pointing to the directory where you created the options file. Then this file is automatically added to your link operation, when started with cc.
H.Becker
Honored Contributor

Re: makefile and shareable images

Something like this should also work and seems more appropriate

bash$ cc -o m m.o -L '/sys$common/syslib/' -l'ssl$libssl_shr'

My initial example was wrong, it worked just by accident. I created the shareable image S.EXE in my default directory and then copied it to libs.so. The effect of '-L. -ls' is to search in the current directory for s.olb, s.a, s.exe and s.so. This is at least incompatible with expected behavior. So I managed to link agains s.exe when I thought I would link agains libs.so.

to make it work as I wanted, I would need '-L. -llibs'. After I found that it though I could apply that to the ssl shareable, as shown above.
H.Becker
Honored Contributor

Re: makefile and shareable images

Something like this should also work and seems more appropriate

bash$ cc -o m m.o -L '/sys$common/syslib/' -l'ssl$libssl_shr'

My initial example was wrong, it worked just by accident. I created the shareable image S.EXE in my default directory and then copied it to libs.so. The effect of '-L. -ls' is to search in the current directory for s.olb, s.a, s.exe and s.so. This is at least incompatible with expected behavior. So I managed to link against s.exe when I thought I would link against libs.so.

To make it work as intended, I would need '-L. -llibs'. After I found that it though I could apply that to the ssl shareable, as shown above.
T. Uso
Advisor

Re: makefile and shareable images

Now my makefile looks like:

...

LDFLAGS+=-L'/sys$$common/syslib/' -l'ssl$$libssl_shr' -l'ssl$$libcrypto_shr' $(DEBUG)
CFLAGS+=-O2 -DVERSION=\"$(VERSION)\" $(DEBUG)

A binary called httping. is built and then:

$ bash
bash$ httping "-V"
HTTPing v1.3.0, (C) 2003-2008 folkert@vanheusden.com
SSL support included
bash$ httping -l -g https://mathrider.dev.java.net/ -c 1
PING mathrider.dev.java.net:443 (https://mathrider.dev.java.net/):
connected to mathrider.dev.java.net:443, seq=0 time=1601.00 ms
--- https://mathrider.dev.java.net/ ping statistics ---
1 connects, 1 ok, 0.00% failed
round-trip min/avg/max = 1601.0/1601.0/1601.0 ms

*BUT*

$ httping :==$dka0:[test.httping-1_3_0]httping.
$ httping "-V"
HTTPing v1.3.0, (C) 2003-2008 folkert@vanheusden.com
SSL support included
$ httping -l -g https://mathrider.dev.java.net/ -c 1
PING mathrider.dev.java.net:443 (https://mathrider.dev.java.net/):
%SYSTEM-F-ACCVIO, ...
%TRACE-F-TRACEBACK, symbolic stack dump follows
image module routine ...
SSL$LIBCRYPTO_SHR ...
...
T. Uso
Advisor

Re: makefile and shareable images

Fiat lux !

The two methods given by H.Becker work but SSL$LIBSSL_SHR32.EXE and SSL$LIBCRYPTO_SHR32.EXE (32 bits) must be used instead of SSL$LIBSSL_SHR.EXE and SSL$LIBCRYPTO_SHR.EXE (64 bits) in the DCL environment.

H.Becker
Honored Contributor

Re: makefile and shareable images

So it looks like the image is working from the bash but not from DCL. Looks like a different problem to me.

Anyway, I can't build HTTPing v1.3.0 from the sources I found on www.vanheusden.com. It wants regex.h and syslog.h whic hI don;t have. There is probably more. What are you using?

T. Uso
Advisor

Re: makefile and shareable images

I use regex.h from gnv and I delete syslog.h (it is not used). I have also made some modifications in the c files (some types are different between Unix and OpenVMS headers).

I will clean up my modifications and I will send you the results.
T. Uso
Advisor

Re: makefile and shareable images

The zip file...