Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

I made some API function and compiled in visual c++. So I got a .lib file. But I don't know how to insert make option into .mak file.

Thanks advance..

If you want to create lib using ARM compiler, you need to have ADS full version (costs around $5000). In RVCT (costs around $1500) lib creation facility is not available.
ruben

If you want to create lib using ARM compiler, you need to have ADS full version (costs around $5000). In RVCT (costs around $1500) lib creation facility is not available.
ruben

You can link using the -partial option to make a partially linked ELF object. This can act as a static link library.

You can link using the -partial option to make a partially linked ELF object. This can act as a static link library.

What about compiling all the sources code of the api and make one .o, then just link this one with the other objects from your application? I do it this way, works nicely..
/kUfa

What about compiling all the sources code of the api and make one .o, then just link this one with the other objects from your application? I do it this way, works nicely..
/kUfa

Thanks all
tom, how to I use -partial option? where should I put this?
There are too many complex option in mak file...
Could you show me a sample mak file??
help me~
thanx!!

Thanks all
tom, how to I use -partial option? where should I put this?
There are too many complex option in mak file...
Could you show me a sample mak file??
help me~
thanx!!

If you started with the example makefiles given in the BREW SDK as your template (i suggest ExpenseTracker from BREW 2.0 because it handles multiple source files), somewhere in your makefile you have a linking command that looks something like this:
$(TARGET).$(EXETYPE) : $(APP_OBJS)        $(LD) $(LINK_CMD) $(TARGET).$(EXETYPE) $(LFLAGS) $(APP_OBJS) $(LINK_ORDER)
It's using a lot of symbols that were defined elsewhere in the file.
Search around and find where the link symbols are defined:
LINK_CMD = -oROPILINK = -ropiLINK_ORDER = -first AEEMod_LoadLFLAGS = $(ROPILINK) -rwpi
You don't have to edit the linking command, but you do have to change the link symbols. Note that you will have multiple makefiles - one for the library, and at least one other for an app that links to this library - we're talking about the library makefile here. Add the -partial option to LINK_CMD and get rid of the other symbols, which are trying setup the final executable rather than a library, like this:
LINK_CMD = -partial -o#ROPILINK = -ropi#LINK_ORDER = -first AEEMod_Load#LFLAGS = $(ROPILINK) -rwpi
In your other makefile, just add the library to your list of object files (in the example above, it's APP_OBJS).
That's it... if it doesn't work, post the error message you get from the linker. BTW, you should read the ARM docs and learn those linker options. There are other ones... very useful.
--t

If you started with the example makefiles given in the BREW SDK as your template (i suggest ExpenseTracker from BREW 2.0 because it handles multiple source files), somewhere in your makefile you have a linking command that looks something like this:
$(TARGET).$(EXETYPE) : $(APP_OBJS)        $(LD) $(LINK_CMD) $(TARGET).$(EXETYPE) $(LFLAGS) $(APP_OBJS) $(LINK_ORDER)
It's using a lot of symbols that were defined elsewhere in the file.
Search around and find where the link symbols are defined:
LINK_CMD = -oROPILINK = -ropiLINK_ORDER = -first AEEMod_LoadLFLAGS = $(ROPILINK) -rwpi
You don't have to edit the linking command, but you do have to change the link symbols. Note that you will have multiple makefiles - one for the library, and at least one other for an app that links to this library - we're talking about the library makefile here. Add the -partial option to LINK_CMD and get rid of the other symbols, which are trying setup the final executable rather than a library, like this:
LINK_CMD = -partial -o#ROPILINK = -ropi#LINK_ORDER = -first AEEMod_Load#LFLAGS = $(ROPILINK) -rwpi
In your other makefile, just add the library to your list of object files (in the example above, it's APP_OBJS).
That's it... if it doesn't work, post the error message you get from the linker. BTW, you should read the ARM docs and learn those linker options. There are other ones... very useful.
--t

hi, tom, could u give a example of the multi-makefiles?

hi, tom, could u give a example of the multi-makefiles?

You can create your lib with gnude as well... It's called .a rather than .lib, but works exactly the same way...
Basically:
compile all your source code to .o
use arm-elf-ar.exe to archive every .o in a single .a
That's it: you have your lib built.
..
Then, on the programs that use this lib, simply include it on your arm-elf-ld.exe, just as you would with ordinary .o files...
...
Needless to say, but some issues you have to be aware:
- You have to mantain two distinct binary versions of your lib: .lib, for MSVC/Windows, .a for ARM/Device.
- Whenever you change the source of your lib, remember to compile it again for both architectures, as well as recompiling all projects that depends on it.
Sincerely,
Marcus Voltis Bulach

You can create your lib with gnude as well... It's called .a rather than .lib, but works exactly the same way...
Basically:
compile all your source code to .o
use arm-elf-ar.exe to archive every .o in a single .a
That's it: you have your lib built.
..
Then, on the programs that use this lib, simply include it on your arm-elf-ld.exe, just as you would with ordinary .o files...
...
Needless to say, but some issues you have to be aware:
- You have to mantain two distinct binary versions of your lib: .lib, for MSVC/Windows, .a for ARM/Device.
- Whenever you change the source of your lib, remember to compile it again for both architectures, as well as recompiling all projects that depends on it.
Sincerely,
Marcus Voltis Bulach

Quote:Originally posted by xacheng
hi, tom, could u give a example of the multi-makefiles? What exactly are you having a problem with? I can answer your question if you have a particular problem that needs to be solved.
In general:
* One makefile builds the library, as I described. The target is an .elf file.
* The other makefile for your project links with the .elf file. Just put the .elf in the list of the object files that need to be linked together.
Note that I'm using ARM RVCT. I don't know how to get GCC to do this.
--t

Quote:Originally posted by xacheng
hi, tom, could u give a example of the multi-makefiles? What exactly are you having a problem with? I can answer your question if you have a particular problem that needs to be solved.
In general:
* One makefile builds the library, as I described. The target is an .elf file.
* The other makefile for your project links with the .elf file. Just put the .elf in the list of the object files that need to be linked together.
Note that I'm using ARM RVCT. I don't know how to get GCC to do this.
--t

Hi, Now i have done multi-makefile, it compile success. my problem is how to shrink the target file "mod " file's size by optimizing the makefile, it seems no effect now and the makefile is most optimized. so i need try more :mad:

Hi, Now i have done multi-makefile, it compile success. my problem is how to shrink the target file "mod " file's size by optimizing the makefile, it seems no effect now and the makefile is most optimized. so i need try more :mad:

am getting the following error pls help me if u have the sol fo it
Splasher.o(.text+0x1e4): In function `Splasher::Activate()':
: undefined reference to `operator new(unsigned long)'
Splasher.o(.text+0x2e4): In function `Splasher:eactivate()':
: undefined reference to `operator delete(void*)'
Splasher.o(.gnu.linkonce.r._ZTI8Splasher+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
Configuration.o(.text+0x254): In function `CConfiguration::~CConfiguration()':
: undefined reference to `operator delete(void*)'
Configuration.o(.gnu.linkonce.r._ZTI14CConfiguration+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
make: *** [AppMain.elf] Error 1
------------------------------------

am getting the following error pls help me if u have the sol fo it
Splasher.o(.text+0x1e4): In function `Splasher::Activate()':
: undefined reference to `operator new(unsigned long)'
Splasher.o(.text+0x2e4): In function `Splasher:eactivate()':
: undefined reference to `operator delete(void*)'
Splasher.o(.gnu.linkonce.r._ZTI8Splasher+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
Configuration.o(.text+0x254): In function `CConfiguration::~CConfiguration()':
: undefined reference to `operator delete(void*)'
Configuration.o(.gnu.linkonce.r._ZTI14CConfiguration+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
make: *** [AppMain.elf] Error 1
------------------------------------

Tom, as suggested by you, if I remove other flags, for partial linking, then it gives me following linker error,
Error: Q0127E: Cannot translate an ELF Relocatable file (object) into Plain bina
ry format.
If I keep those flags, then elf file and mod file, both are generated.
Next step you told me that in another project I write libray's elf file in objects.
I did this, but it gives error
don't know how to make 'mylibrary.elf'
I had copied mylibrary.elf file in another projects folder.
One more query, do I have to change to lib from dll, in project output, for library project.
I'm compiling with ADS 1.2, BREW SDK 2.0.1

Tom, as suggested by you, if I remove other flags, for partial linking, then it gives me following linker error,
Error: Q0127E: Cannot translate an ELF Relocatable file (object) into Plain bina
ry format.
If I keep those flags, then elf file and mod file, both are generated.
Next step you told me that in another project I write libray's elf file in objects.
I did this, but it gives error
don't know how to make 'mylibrary.elf'
I had copied mylibrary.elf file in another projects folder.
One more query, do I have to change to lib from dll, in project output, for library project.
I'm compiling with ADS 1.2, BREW SDK 2.0.1