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

Command-line compiler problems with Tornado 2.1/NT for MIPS

207 views
Skip to first unread message

Digital Man

unread,
Aug 13, 2002, 10:45:47 PM8/13/02
to
If I just try to build a simple "hello world" program with c++mips.exe (as an
example), I get the following error:

$ c++mips test.c
/Tornado/host/x86-win32/mips-wrs-vxworks/bin/ld: cannot find -lm
collect2: ld returned 1 exit status

The only libm.a file in my Tornado (2.1) installation is in the
Tornado/host/x86-win32/i386-pc-mingsw32/lib directory (and it's just an empty
archive anyway). I've tried creating an empty libm.a with armips in the lib
search path, but then I get an access violation in the linker:

$ c++mips test.c
(C:\Tornado\host\x86-win32\mips-wrs-vxworks\bin\ld.exe 1005) Exception:
STATUS_ACCESS_VIOLATION
(C:\Tornado\host\x86-win32\mips-wrs-vxworks\bin\ld.exe 1005) Dumping
stack trace to ld.exe.core
/Tornado/host/x86-win32/mips-wrs-vxworks/bin/nm: a.out: File truncated
collect2:
C:/Tornado/host/x86-win32/bin/../lib/gcc-lib/mips-wrs-vxworks/gcc-
2.96/../../../../mips-wrs-vxworks/bin/nm ret
urned 1 exit status

I can link with --nostdlib, but then of course I get hundreds of unresolved
symbols, so I'd like to avoid specifying every library name by hand if I don't
have to. Do you have any idea why the C++ compiler is requiring libm.a and why
it would not be present in the Tornado MIPS library directories?

Now, just as a test, I used the C compiler (ccmips) and got different results:

$ ccmips test.c
/Tornado/host/x86-win32/mips-wrs-vxworks/bin/ld: cannot find -lgcc
collect2: ld returned 1 exit status

Now, libgcc.a for MIPS I do have, so I just added that library search directory
to the command-line:

$ ccmips test.c
-L/tornado/host/x86-win32/lib/gcc-lib/mips-wrs-vxworks/gcc-2.96/MIPS32sfgnu
/Tornado/host/x86-win32/mips-wrs-vxworks/bin/ld: warning: cannot find entry
symbol _start; defaulting to 000000000040000
0
c:\DOCUME~1\swindell\LOCALS~1\Temp\ccyWaaaa.o: In function `main':
c:\DOCUME~1\swindell\LOCALS~1\Temp\ccyWaaaa.o(.text+0x14): undefined reference
to `printf'
collect2: ld returned 1 exit status

It now finds libgcc.a, but still has some unresolved symbols. Anyway, I *do*
need to use the C++ compiler so that was just a test to see if would have any
more success with the ccmips.exe.

Thanks for any help you can offer,

digital man
--- Synchronet 3.10j-Win32 NewsLink 1.29
* Vertrauen - Fullerton, California - telnet://vert.synchro.net

John

unread,
Aug 14, 2002, 2:40:24 AM8/14/02
to
Hello,

You need to read the VxWorks Programmer's Guide and the Tornado
documentation. You are not using the tools in the correct way at all
for VxWorks development.

Unlike Windoze or unix, VxWorks does not use executables (which is
what c++mips was trying to generate for you since you gave it no
options). Instead, simple .o files are downloaded onto the target
system that is already running the VxWorks kernel. The loader that
performs that step will resolve the unresolved symbols with those
already in the kernel image.

So, the simplest way to compile your source would be:

% ccmips -c test.c

(Note c++mips would be for C++ source, and is usually not necessary
since ccmips will automatically determine when a source file has a
valid C++ extension - for Windoze these are .c++, .cc and I believe
.cpp and .cxx - on Unix there is an additional one: .C - uppercase C).

The output of this is test.o which you then download to the target
system (look up the reference manual entry for ld and the section in
the docs about the WindShell). Once downloaded, you can just call the
entry point of your code and it should run. If when you download the
test.o file you get errors about unresolved symbols, then you will
need to rebuild the VxWorks kernel having adjusted the configAll.h or
config.h file(s) to add the required feature(s) to the kernel. Again,
read the documentation for information about this process.

Another important note: never use main() as your entry point function
name (or any other function for that matter). It has special
significance for the compiler, which will generate special code to
facilitate initialisation and termination of a process - something
that VxWorks does not have.

Finally, I would strongly recommend that you get some training if you
are going to be producing an embedded and/or real-time device with
VxWorks. There are a number of key differences from the programming
environment that you seem to be used to; finding those by trial and
error will be time consuming and very frustrating.

HTH,

John...

"Digital Man" <digit...@remove-cqk-this.vert.synchro.net> wrote in message news:<3D59CBFE.13...@vert.synchro.net>...

Digital Man

unread,
Aug 14, 2002, 6:34:47 PM8/14/02
to
To: john_...@yahoo.com (John)
Re: Re: Command-line compiler problems with Tornado 2.1/NT for MIPS
By: john_...@yahoo.com (John) to comp.os.vxworks on Tue Aug 13 2002 11:40 pm

> You need to read the VxWorks Programmer's Guide and the Tornado
> documentation. You are not using the tools in the correct way at all
> for VxWorks development.
>
> Unlike Windoze or unix, VxWorks does not use executables (which is
> what c++mips was trying to generate for you since you gave it no
> options). Instead, simple .o files are downloaded onto the target
> system that is already running the VxWorks kernel. The loader that
> performs that step will resolve the unresolved symbols with those
> already in the kernel image.

<doh!> Actually, I already knew this and have been using Torando and VxWorks
for quite some time. It's just in converting an existing Linux project to
VxWorks, I simply forgot that the linking stage was unnecessary and is handled
when downloaded to the target. Thanks for the reminder!

0 new messages