What I'm confused about is if everyone is just creating their own
OpenSSL source layout and makefiles to work in the normal Wind River BAT
script-style environment or if some other process is used. OpenSSL seems
to be centered around cygwin when building on Windows and relies on
things like symlinks, but VxWorks doesn't build in cygwin (without
changing all the Wind River stuff) and the BAT environment doesn't
support symlinks. I've been hesitant to re-do all the makefiles myself
because OpenSSL includes VxWorks support so I assume I'm just missing
something that will make it work without changes.
Here's the errors I get when trying to execute make (in cygwin):
making all in crypto...
make[1]: Entering directory `/tmp/openssl-0.9.7b/crypto'
ccppc -I. -I.. -I../include -DOPENSSL_SYSNAME_VXWORKS -DOPENSSL_THREADS
-DOPENSSL_NO_KRB5 -g -msoft-float -DCPU=PPC860 -I/target/h -c -o
cryptlib.o cryptlib.c
make[1]: *** [cryptlib.o] Error 255
make[1]: Leaving directory `/tmp/openssl-0.9.7b/crypto'
make: *** [sub_all] Error 1
[snip]
> Here's the errors I get when trying to execute make (in cygwin):
>
> ccppc -I. -I.. -I../include -DOPENSSL_SYSNAME_VXWORKS
> -DOPENSSL_THREADS -DOPENSSL_NO_KRB5 -g -msoft-float -DCPU=PPC860
> -I/target/h -c -o cryptlib.o cryptlib.c
> make[1]: *** [cryptlib.o] Error 255 make[1]: Leaving directory
> `/tmp/openssl-0.9.7b/crypto' make: *** [sub_all] Error 1
Perhaps it is something simple. Did you run "torvars.bat" to setup
the environment to put "ccppc", etc on your path? The include
"-I/target/h" should give you a clue. It should be something like
"-IC:/Tornado/target/h".
I have cross-compiled OpenSSL using mingw and msys for an ARM and it
worked with little tweaking (had to specify ldarm). I suspect that
you are doing something wrong. Search the OpenSSL mailing list... I
am sure there are detailed instructions somewhere on how to get this
to work for a PPC.
fwiw,
Bill Pringlemeir.
--
I find this continuous feedback and interplay between pure mathematics
and theoretical physics most fascinating. - Marco
If you have installed cygwin in your PC, you can setup OpenSSL for
cygwin as well. You can add OpenSSL package using cygwin setup. Please
refer to the following web site: http://cygwin.com/packages/
After installation of OpenSSL, you can compile and execute some sample
codes in cygwin.
You can create OpenSSL libraries for VxWorks and link them while
compiling with the SSL example code ("cli.cpp") in the demos
directory.
For the building of OpenSSL libraries, you should build crypto library
and ssl library. Go to crypto and ssl directory and build each
library. Or you can archive all the necessary object codes into one
OpenSSL library.
Go to DOS environment and compile the necessary codes using ccppc.
Daniel Lee
Bob Bradley <b...@chaoticsoftware.com> wrote in message news:<bob-ECDA32.1...@news.apple.com>...
> Perhaps it is something simple. Did you run "torvars.bat" to setup
> the environment to put "ccppc", etc on your path? The include
> "-I/target/h" should give you a clue. It should be something like
> "-IC:/Tornado/target/h".
Thanks for the help. I initially tried vorVars.bat without
success (cygwin vs normal BAT environment issue...neither
of which I know very much about), but your reply prompted
me to try things a different way and that got me far enough
that I could stumble through the rest.
Here are the steps I took to get OpenSSL building for VxWorks
on Motorola MPC8xx processors using a Window XP host (note
that where code lines are too long, I use "\" to mean it
continues on the next line):
1) Install Tornado. I used Tornado 2.0.2.
2) Install cygwin.
3) Download <http://www.openssl.org/source/openssl-0.9.7b.tar.gz>
4) Copy the downloaded openssl-0.9.7b.tar.gz file to your
cygwin /tmp directory.
5) Run the Windows Command Prompt.
6) Execute your tarVars.bat. For me:
C:\Tornado\host\x86-win32\bin\torVars.bat
7) Run cygwin. For me:
C:\cygwin\cygwin.bat
This put me in the bash shell.
8) Go to cygwin /tmp directory.
cd /tmp
9) Untar OpenSSL archive:
tar -zxf openssl-0.9.7b.tar.gz
10) Re-tar OpenSSL with -h to copy instead of symlink:
tar -hcf tmp.tar
The Tornado 2.0.2 build tools do not appear to be able to
deal with symlinks for include files so I needed to use
copies of the files instead of symlinks. Unix experts may
know how to get tar to do this without the re-tar/untar steps,
but I did not see any options in the tar man page.
11) Delete old openssl-0.9.7b directory:
rm -R -f openssl-0.9.7b
11) Untar new tar file:
tar -xf tmp.tar
This should produce a "openssl-0.9.7b" directory.
12) Open "Configure" file, search for "vxworks" and add the
following line to the other VxWorks lines:
"vxworks-ppc860","ccppc:-g -msoft-float \
-DCPU=PPC860 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
13) Configure OpenSSL:
./Configure vxworks-ppc860 no-rc5 no-idea \
-openssldir=C:\Temp\openssl-vxworks
Note: I disabled RC5 and IDEA for legal reasons, but
I also tried building with them enabled and it
seemed to work fine.
14) Build OpenSSL:
make
This should start actually compiling source code.
Build problem 1:
cversion.c: In function 'SSLeay_version':
cversion.c:84: warning: unknown escape sequence '\T'
cversion.c:86: warning: unknown escape sequence '\T'
This is due to "C:\Tornado" in my CFLAGS. Maybe they should
not try to use CFLAGS in C code?
Build problem 2:
b_sock.c: In function 'BIO_socket_ioctl':
b_sock.c:502: warning: dereferencing 'void *' pointer
b_sock.c:502: invalid use of void expression
Changed VxWorks ioctlsocket macro in e_os.h to this:
#define ioctlsocket(a,b,c) ioctl((a),(b),*(int*)(c))
Somebody (Bill Pringlemeir) on the OpenSSL list had
this problem so I just copied that fix.
Started again at step 14.
Build problem 3:
ca.c:85: strings.h: No such file or directory
make[1]: *** [ca.o] Error 1
make[1]: Leaving directory '/tmp/openssl-0.9.7b/apps'
make: *** [sub_all] Error 1
Added -DNO_STRINGS_H to vxworks-ppc860 line I added to
the Configure file.
Started again at step 13.
Build problem 4:
collect2: ld returned 1 exit status
ccppc.exe: Internal compiler error: program ld got fatal signal 1
make[1]: *** [openssl] Error 1
make[1]: Leaving directory '/tmp/openssl-0.9.7b/apps'
make: *** [sub_all] Error 1
Certain parts of the build process do not appear to handle
Unix-style paths so I changed "openssldir" to
"C:\Temp\openssl-vxworks" (I created this folder myself).
Re-configured with the following Configure line:
./Configure vxworks-ppc860 \
-openssldir=C:\Temp\openssl-vxworks
Started again at step 14.
I noticed some warnings, which I will investigate fixing and
submitting to OpenSSL, but otherwise, the make process
completed (appeared successful).
I skipped "make test" because I am running on an x86 host,
which cannot test ppc860 code.
15) Install OpenSSL:
make install
I noticed a few errors:
installing openssl
cp: cannot stat 'openssl': No such file or directory
chmod: getting attributes of \
'/usr/local/ssl/bin/openssl.new': No such file or directory
mv: cannot stat '/usr/local/ssl/bin/openssl.new': No such \
file or directory
make[1]: *** [install] Error 1
They did not seem to be fatal and the make process completed
(appeared successful).
make install seemed to ignore my -openssldir. It put
everything in the cygwin /usr/local/ssl directory.
The includes ended up in /usr/local/ssl/include.
libcrypto.a and libssl.a end up in /usr/local/ssl/lib.
That's it.
I recently compiled the sources for x86/VxWorks 5.4 running
Tornado 2.0.2 on Win2K and could run at least some of the
test programs. Then that task got swaped out...
Well, I started out to return my efforts to the OpenSSL
project, so there are some notes on the required changes
(see below, just some short notes, but might be inspiring)
-I use a properly setup Tornado environment (torVars.bat).
-I do not use the Tornado IDE (simply type make at the prompt).
-Cygwin Bash and several text/binary utilities are necessary
-Perl is required
-I do _not_ use the cygwin compiler toolchain, but the tools
provided by Windriver
Bye
Thomas Rahn
-------------script to start cygwin bash-------------
rem @echo off
echo cd /cygdrive/d/SSL/openssl-0.9.7b.vx1 >ssl.rc
rem echo alias cfg="./Configure no-asm no-zlib no-dso no-krb5 no-cast
no-idea no-md4 no-rc4 no-rc2 vxworks-pentium-debug" >>ssl.rc
echo alias cfg="./Configure shared no-asm no-zlib no-dso no-krb5
vxworks-pentium-debug" >>ssl.rc
echo alias ll="ls -la" >>ssl.rc
set WIND_BASE=c:/Tornado
set PATH=d:\cygwin\bin;%PATH%
d:\cygwin\bin\bash --rcfile ./ssl.rc -i
-------------------------------------------------------
* Add another build target in ./Configure
"vxworks-pentium-debug", "cc386
-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/:
-O2 -nostdinc -fvolatile -nostdlib -fno-builtin -fno-defer-pop -Wall
-Wno-unused -mpentium -DCPU=PENTIUM -DNO_STRINGS_H -DRW_MULTI_THREAD
-D_REENTRANT -DVXWORKS -I\$(WIND_BASE)/target/h
:::VXWORKS::BN_LLONG ${x86_gcc_des}
${x86_gcc_opts}:${x86_out_asm}::vxworks-loader:: -Wl,-r: .out
::s:ar386",
* Archives libssl.a/libcrypto.a must contain an index.
I could use ranlib386 from T2 toolchain, but this tool removes
access rights
from the library file on Win2K (certainly a bug). Same function is
available
with the "s" option passed to the ar utility. However, I cannot use
ar from
Cygwin, because that tool supports only different bfd types (no
a.out).
I added a configuration option to change the ar utility (requires
changes
./Configure) and removed a space in makefile.org define for $(AR).
Config entry set the "s" option for arflags and "ar386" for ar.
* Compiler Warnings to-be-ignored
- asn1t.h: "const static" should be "static const" (-W option warns
about it)
- similar with "register", etc. in several files
- compare signed/unsigned (due to sizeof/size_t) in several files
- unused params
- "discard const from pointer" with stat() and opendir():
Compiler option -Wno-cast-qual might help to suppress message, but
does not work
with T2 gcc. Re-defining as macro does not work due to include
order (e_os.h comes first).
* Changes in eos.h
- add type cast
#define ioctlsocket(a,b,c) ioctl((a),(b),*(int*)(c))
- "discard const from pointer" in several files (typically io write),
add non-const cast
#define write(a,b,c) write((a),(char *)(b),(c))
#define stat(a,b) stat((char *)(a),(b))
- getservbyname: not implemented by VxWorks, in e_os.h add
#define getservbyname(a,b) NULL
- gethostbyXXX: dubiously implemented by VxWorks, in e_os.h add
#define gethostbyname _gethostbyname
#define gethostbyaddr _gethostbyaddr
* Source code changes reg. getpid():
- crypto/cryptlib.c, line 379: removed underscore from "_getpid"
ret=(unsigned long)getpid();
- crypto/bio/bss_log.c, line 277: removed underscore from "_getpid"
int pid = getpid(); //TRR
- crypto/engine/hw_aep.c: requires #include "e_os.h"
--------------------------------------------------------------------------------
TEST PROGS
* MAIN/EXIT/ASSERT
- ergänze define für main()
#define main MAIN
--------------------------------------------------------------------------------
APPLICATION PROGS
apps/apps.h:
/* VXWORKS doesn't have strcasecmp() */
#ifdef OPENSSL_SYS_VXWORKS
#define strcasecmp(str1,str2) VXW_strcasecmp((str1),(str2))
int VXW_strcasecmp(const char *str1, const char *str2);
#endif
apps/apps.c:
int VXW_strcasecmp(const char *str1, const char *str2);
apps/ca.c:
#include "apps.h"
--------------------------------------------------------------------------------
> #define ioctlsocket(a,b,c) ioctl((a),(b),*(int*)(c))
I think this should be the following (no dereference since it is treated
as a ptr even though VxWorks interfaces define it as an int):
#define ioctlsocket(a,b,c) ioctl((a),(b),(int)(c))
I've fixed this in recent versions of the OpenSSL sources (0.9.7c has
the change). Some of the other changes you described I've also addressed
in recent versions of OpenSSL.
You might want to submit patches for your changes to the openssl-dev
mailing list. I would suggest downloading OpenSSL 0.9.7c (the latest
release) and applying any diffs you might have to that version since
equivalents to some of your changes have already been integrated in the
latest versions of OpenSSL.