Open walkero-gr opened 4 years ago
Try adding -D__USE_INLINE__
to your vc command line
Yeah. That did the trick. And I also had to remove the +newlib
from my compiling command.
I tried to compile it for 68k as well with the following command: vc +aos68k -c99 -lamiga -lauto -I/opt/sdk/NDK_3.9/Include/include_h -I/opt/sdk/PosixLib/include -I/opt/sdk/AmiSSL/include -D__USE_INLINE__ https.c -o https
but I am getting a couple of errors
vc frontend for vbcc (c) in 1995-2016 by Volker Barthelmann
vbccm68k -quiet -hunkdebug "https.c" -o= "/tmp/file6BoCQf.asm" -c99 -I/opt/sdk/NDK_3.9/Include/include_h -I/opt/sdk/PosixLib/include -I/opt/sdk/AmiSSL/include -D__USE_INLINE__ -O=1 -I$VBCC/targets/m68k-amigaos/include
>struct timeval {
error 13 in line 30 of "devices/timer.h": redeclaration of struct <timeval>
included from file "/opt/sdk/NDK_3.9/Include/include_h/dos/dosextens.h":26
included from file "/opt/sdk/NDK_3.9/Include/include_h/clib/dos_protos.h":21
included from file "/opt/sdk/NDK_3.9/Include/include_h/pragmas/dos_pragmas.h":30
included from file "/opt/sdk/NDK_3.9/Include/include_h/proto/dos.h":15
included from file "https.c":19
>LONG socket(LONG domain, LONG type, LONG protocol);
warning 68 in line 33 of "clib/socket_protos.h": redeclaration of var <__Psocket> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>LONG bind(LONG s, const struct sockaddr *name, LONG namelen);
warning 68 in line 34 of "clib/socket_protos.h": redeclaration of var <__Pbind> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>LONG listen(LONG s, LONG backlog);
warning 68 in line 35 of "clib/socket_protos.h": redeclaration of var <__Plisten> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>LONG accept(LONG s, struct sockaddr *addr, LONG *addrlen);
warning 68 in line 36 of "clib/socket_protos.h": redeclaration of var <__Paccept> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>LONG connect(LONG s, const struct sockaddr *name, LONG namelen);
warning 68 in line 37 of "clib/socket_protos.h": redeclaration of var <__Pconnect> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>LONG send(LONG s, const UBYTE *msg, LONG len, LONG flags);
warning 68 in line 38 of "clib/socket_protos.h": redeclaration of var <__Psend> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
> const struct sockaddr *to, LONG tolen);
warning 68 in line 40 of "clib/socket_protos.h": redeclaration of var <__Psendto> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>LONG sendmsg(LONG s, struct msghdr * msg, LONG flags);
warning 68 in line 41 of "clib/socket_protos.h": redeclaration of var <__Psendmsg> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>LONG recv(LONG s, UBYTE *buf, LONG len, LONG flags);
warning 68 in line 42 of "clib/socket_protos.h": redeclaration of var <__Precv> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
> struct sockaddr *from, LONG *fromlen);
warning 68 in line 44 of "clib/socket_protos.h": redeclaration of var <__Precvfrom> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>LONG recvmsg(LONG s, struct msghdr * msg, LONG flags);
warning 68 in line 45 of "clib/socket_protos.h": redeclaration of var <__Precvmsg> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>LONG shutdown(LONG s, LONG how);
warning 68 in line 46 of "clib/socket_protos.h": redeclaration of var <__Pshutdown> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
> const void *optval, LONG optlen);
warning 68 in line 48 of "clib/socket_protos.h": redeclaration of var <__Psetsockopt> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
> void *optval, LONG *optlen);
warning 68 in line 50 of "clib/socket_protos.h": redeclaration of var <__Pgetsockopt> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>LONG getsockname(LONG s, struct sockaddr *name, LONG *namelen);
warning 68 in line 51 of "clib/socket_protos.h": redeclaration of var <__Pgetsockname> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>LONG getpeername(LONG s, struct sockaddr *name, LONG *namelen);
warning 68 in line 52 of "clib/socket_protos.h": redeclaration of var <__Pgetpeername> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>ULONG inet_addr(const UBYTE *);
warning 68 in line 79 of "clib/socket_protos.h": redeclaration of var <__Pinet_addr> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>ULONG inet_network(const UBYTE *);
warning 68 in line 80 of "clib/socket_protos.h": redeclaration of var <__Pinet_network> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>struct hostent *gethostbyname(const UBYTE *name);
warning 68 in line 87 of "clib/socket_protos.h": redeclaration of var <__Pgethostbyname> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>struct hostent *gethostbyaddr(const UBYTE *addr, LONG len, LONG type);
warning 68 in line 88 of "clib/socket_protos.h": redeclaration of var <__Pgethostbyaddr> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>struct netent *getnetbyname(const UBYTE *name);
warning 68 in line 89 of "clib/socket_protos.h": redeclaration of var <__Pgetnetbyname> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>struct netent *getnetbyaddr(LONG net, LONG type);
warning 68 in line 90 of "clib/socket_protos.h": redeclaration of var <__Pgetnetbyaddr> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>struct servent *getservbyname(const UBYTE *name, const UBYTE *proto);
warning 68 in line 91 of "clib/socket_protos.h": redeclaration of var <__Pgetservbyname> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>struct servent *getservbyport(LONG port, const UBYTE *proto);
warning 68 in line 92 of "clib/socket_protos.h": redeclaration of var <__Pgetservbyport> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>struct protoent *getprotobyname(const UBYTE *name);
warning 68 in line 93 of "clib/socket_protos.h": redeclaration of var <__Pgetprotobyname> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>struct protoent *getprotobynumber(LONG proto);
warning 68 in line 94 of "clib/socket_protos.h": redeclaration of var <__Pgetprotobynumber> with new type
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":8
included from file "https.c":22
>#define socket(domain, type, protocol) __socket(SocketBase, (domain), (type), (
error 272 in line 9 of "inline/socket_protos.h": macro 'socket' redefined unidentically
included from file "/opt/vbcc/targets/m68k-amigaos/include/proto/socket.h":22
included from file "https.c":22
2 errors found!
vbccm68k -quiet -hunkdebug "https.c" -o= "/tmp/file6BoCQf.asm" -c99 -I/opt/sdk/NDK_3.9/Include/include_h -I/opt/sdk/PosixLib/include -I/opt/sdk/AmiSSL/include -D__USE_INLINE__ -O=1 -I$VBCC/targets/m68k-amigaos/include failed
Thank you for your valuable help. I just want to know that the development environment I am creating has what is needed to compile programs that need AmiSSL.
No problem - if there is anything I can do to improve to SDK, I'll try to do it.
For the first error, you need to add -D__NEW_TIMEVAL_DEFINITION_USED__ - I'm going to modify https.c so these two definitions are added there too, so it is more obvious than having to decipher our Makefile.
For the socket warnings/errors where is your clib/socket_protos.h coming from? I can't seem to find __Psocket, etc, anywhere in the includes that I have. You appear to have two conflicting headers that are defining a socket() macro, for example. For testing with VBCC, I used some ancient AmiTCP includes (that I'm using with SAS/C!) to compile https.c. I can see that Jens is using the Roadshow includes for building the OS3 AmiSSL though.
Unfortunately the -D__NEW_TIMEVAL_DEFINITION_USED__ didn't solve anything.
I am using PosixLib. There is the clib/socket_protos.h. I tried using Roadshow as well, without PosixLib, but I get the following error
>#include <sys/types.h>
error 248 in line 6 of "https.c": file 'sys/types.h' not found
Where can I find that Makefile to have a look?
I was referring to https://github.com/jens-maus/amissl/blob/master/Makefile for AmiSSL, which also builds the https example with GCC for OS3/OS4, so there is not much to learn from that now that I have updated https://github.com/jens-maus/amissl/blob/master/test/https.c - I've removed some unnecessary includes which should help with compiling with VBCC, whilst still compiling ok with GCC.
There may be complications using PosixLib with AmiSSL. Ultimately, at some point you need to pass the low level socket to AmiSSL, maybe with something like SSL_set_fd( ssl, __init_bsdsocket(s) )
if that function is accessible publicly. Certainly, the https.c example code is written with Amiga native networking in mind. It could be adapted to work with PosixLib by replacing the appropriate bsdsocket.library calls and removing #include <proto/socket.h>
(otherwise it clashes with the PosixLib sys/socket.h
).
@Futaura Thank you very much for your help on that. I checked the changed code under VBCC for AmigaOS4 dev environment I create and it compiles just fine.
Unfortunately, under m68k it still has issues. If I compile it without Posix Lib includes I get the following error
root@3d24d07ba300:/opt/code/m68k# vc +aos68k -c99 -lamiga -lauto -I/opt/sdk/NDK_3.9/Include/include_h -I/opt/sdk/Roadshow-SDK/netinclude -I/opt/sdk/AmiSSL/include https.c -o https -v
vc frontend for vbcc (c) in 1995-2016 by Volker Barthelmann
vbccm68k -quiet -hunkdebug "https.c" -o= "/tmp/filehff6hC.asm" -c99 -I/opt/sdk/NDK_3.9/Include/include_h -I/opt/sdk/Roadshow-SDK/netinclude -I/opt/sdk/AmiSSL/include -O=1 -I$VBCC/targets/m68k-amigaos/include
># include <sys/types.h>
error 248 in line 28 of "openssl/buffer.h": file 'sys/types.h' not found
included from file "/opt/sdk/AmiSSL/include/amissl/amissl.h":29
included from file "/opt/sdk/AmiSSL/include/proto/amissl.h":31
included from file "https.c":30
1 error found!
vbccm68k -quiet -hunkdebug "https.c" -o= "/tmp/filehff6hC.asm" -c99 -I/opt/sdk/NDK_3.9/Include/include_h -I/opt/sdk/Roadshow-SDK/netinclude -I/opt/sdk/AmiSSL/include -O=1 -I$VBCC/targets/m68k-amigaos/include failed
with Posix lib includes
root@3d24d07ba300:/opt/code/m68k# vc +aos68k -c99 -lamiga -lauto -I/opt/sdk/NDK_3.9/Include/include_h -I/opt/sdk/Roadshow-SDK/netinclude -I/opt/sdk/PosixLib/include -I/opt/sdk/AmiSSL/include https.c -o https -v
vc frontend for vbcc (c) in 1995-2016 by Volker Barthelmann
vbccm68k -quiet -hunkdebug "https.c" -o= "/tmp/fileHTkKlZ.asm" -c99 -I/opt/sdk/NDK_3.9/Include/include_h -I/opt/sdk/Roadshow-SDK/netinclude -I/opt/sdk/PosixLib/include -I/opt/sdk/AmiSSL/include -O=1 -I$VBCC/targets/m68k-amigaos/include
> #include <inline/bsdsocket_protos.h>
error 248 in line 80 of "proto/bsdsocket.h": file 'inline/bsdsocket_protos.h' not found
included from file "/opt/sdk/Roadshow-SDK/netinclude/proto/socket.h":18
included from file "https.c":32
1 error found!
vbccm68k -quiet -hunkdebug "https.c" -o= "/tmp/fileHTkKlZ.asm" -c99 -I/opt/sdk/NDK_3.9/Include/include_h -I/opt/sdk/Roadshow-SDK/netinclude -I/opt/sdk/PosixLib/include -I/opt/sdk/AmiSSL/include -O=1 -I$VBCC/targets/m68k-amigaos/include failed
The dev environment I am building it is based on docker, and can be found at https://github.com/walkero-gr/docker4AmigaVBCC
Apologies for the delayed reply - things have been going wrong elsewhere, so haven't had time to get back to AmiSSL until now...
As I eluded too, I think making the https.c example compile with PosixLib is out of the question, as that example code is intentionally Amiga-centric. But, in your own code, I think you should be able to use PosixLib without a problem as long as it provides as way to get the real AmigaOS native socket value so that it can be passed to SSL_set_fd()
which expects the raw bsdsocket.library socket, not PosixLib's wrapper.
To compile the example on 68k, you will need to install some other sys/types.h file and use that - I've forgotten what I used on my system, as I have various copies of that file lying around.
Has anyone else managed to resolve this? I've checked out @walkero-gr's code after seeing his AmiWest tutorial but I'm having the same problems. I apologise if this isn't the right place and I should open up an issue with him, but I wanted to see if any work's been done here or if there's another AmiSSL client example that could compile on m68k?
I am trying to compile with vbcc the example code https.c, but I am getting errors. I am using a cross compiling environment, with AmigaOS 4 SDK and latest AmiSSL 4.4 dev files installed.
I am using the following command to compile it:
vc +aosppc +newlib -I/opt/sdk/ppc-amigaos/Include/include_h -I/opt/sdk/ppc-amigaos/Include/netinclude -I/opt/sdk/ppc-amigaos/newlib/include -I/opt/sdk/AmiSSL/include -lauto https.c -o https -v
I get a few errors and a lot of warnings. I think that I am missing something.
I tried to use PosixLib as well, but no luck.
Any idea what I am missing there?