Hi,
I am trying to build the libmpeg2 for symbianOS like it is explained on the CVS webpage http://anotherguest.k0.se/...
I have had problems while using the bldmake and abld commands like it is explained in the text file given with the "Symbian SDK project files" for libmpeg2. (As far as I remember it wasn't working because it could not find LINK.EXE, and even after trying to add many link.exe files' repository to my path environment variable, I could not make it work correctly.)
I finally used an IDE to build the two .lib files without the commands and get a correct compilation. But as I was not sure it would work, I tried to build a small test project working with original libmpeg, and to compile it for Symbian OS with your symbian libmpeg.
But it is not working, so I would like to know if it is normal that my test project is not able to find the classes inside the lib files, when I build it with the same IDE I have build the lib? And if it is the case, how can I build it correctly? (for exemple, if somebody knows what this link.exe file is?)
building libmpeg2 for symbianOS
Moderator: ScummVM Team
-
- ScummVM Porter
- Posts: 1423
- Joined: Sun Oct 30, 2005 2:27 pm
- Location: Malmoe, Sweden
1. What SDK are you using?
2. Which target are you building for?
Missing link.exe ..seems like your paths is not in order. Or you dont have the right tools installed. That depends on the SDK you are using (S60/UIQ3, Symbian V7-V9, WINSCW,WINS, GCCE, ARMI, THUMB ).. So there are some thing to pick from.
Not sure if I have built it for anything but S60v1,v2/uiq2 ARMI UREL. So that is what would work then. (Depends on the version of libmpeg2 used also of course, since the build files has n't been updated, and libmpeg2 might have)
2. Which target are you building for?
Missing link.exe ..seems like your paths is not in order. Or you dont have the right tools installed. That depends on the SDK you are using (S60/UIQ3, Symbian V7-V9, WINSCW,WINS, GCCE, ARMI, THUMB ).. So there are some thing to pick from.
Not sure if I have built it for anything but S60v1,v2/uiq2 ARMI UREL. So that is what would work then. (Depends on the version of libmpeg2 used also of course, since the build files has n't been updated, and libmpeg2 might have)
1. UIQ3 SDKAnotherguest wrote:1. What SDK are you using?
2. Which target are you building for?
Missing link.exe ..seems like your paths is not in order. Or you dont have the right tools installed. That depends on the SDK you are using (S60/UIQ3, Symbian V7-V9, WINSCW,WINS, GCCE, ARMI, THUMB ).. So there are some thing to pick from.
Not sure if I have built it for anything but S60v1,v2/uiq2 ARMI UREL. So that is what would work then. (Depends on the version of libmpeg2 used also of course, since the build files has n't been updated, and libmpeg2 might have)
2. A Sony Ericsson w950
I have thought the missing link was a problem of path, but after having tried a lot of options I have not obtained any result (I used some link.exe dirs I have found with a search on my computer and add them to my path with adding sometimes a directory for dll they were using, but none of them has worked. I finally used my IDE to build it and was surprised it worked!)
I have build the lib for either versions of libmpeg2 (the last one, 0.4.1, and the one which had been used at the time, 0.4.0) and the result is the same, so this is unfortunately not the problem... But as my SDK is not in the list you said, maybe it is the problem?
So, my questions are now: if my IDE could build the lib but could not build a test using it, is it because it must be compiled with bldmake/abld (and then I have to focus on solving this link problem); or is it not working anyway for another reason like the UIQ3 SDK I am trying to use wich is not compatible with it (and then I have to try to adapt the source code :/)?
edit: if you think the missing link.exe is a problem of path, could you give me an idea of what should be my environment variables?
By the way, I have just checked everything to be see if running bldmake/abld would make a different .lib than building with my IDE. I have been surprised to find in the Readme.txt file given with the text that it is probably incomplete:
Do you see the problem? No? Look at the numbers then: 1, 2, 5, 6... Looks like there is two steps missing! To be honnest I have found at least one alone and did not realized it could have any importance: it is to copy the inttype.h and config.h and put them into the building dir (for exemple into the vc++ given with the library sources...) But maybe it is missing another one? Of course, it can be an simple number error and there can be no other steps because when building with bldmake/abld it is using these two files. But as I haven't used it and have used an IDE, is having copy and included these two files into the headers files enough or incomplete?======================================================
Short readme on how to compile libmpeg2.lib on Symbian
======================================================
1. extract mpeg2dec-0.4.0 source from
http://libmpeg2.sourceforge.net/
2. copy this 'epoc' dir into it
5. exec in 'epoc' dir:
bldmake bldfiles
abld build
6. You are done! libmpeg2.lib should be compiled &
includes should be copied to epoc32\include\mpeg2dec
======================================================
Enjoy! Greetz from SumthinWicked@users.sourceforge.net
======================================================
In order to solve the link.exe missing error, I have added in my Path environment variable the path to MS Visual Studio link.exe and I could run bldmake without any problem. But now, when I try to run "abld build", I get for each source file the same error: "\epoc32\gcc\bin\gcc.exe was called but it is not supported in this release". The only other guy who had this type of error I could find did not found the solution on http://discussion.forum.nokia.com/forum ... hp?t=94839.
This gcc.exe is not present into the UIQ3 SDK files, but in other version like Symbian 7.0 S80 DP2 SDK... Maybe it is a too old way for UIQ3?
Has anybody got an idea?
This gcc.exe is not present into the UIQ3 SDK files, but in other version like Symbian 7.0 S80 DP2 SDK... Maybe it is a too old way for UIQ3?
Has anybody got an idea?
-
- ScummVM Porter
- Posts: 1423
- Joined: Sun Oct 30, 2005 2:27 pm
- Location: Malmoe, Sweden
Build instructions are for GCC 2.95.3 .. not for GCCE 3.4.3.. which you have n't installed and/or set the right paths to.
It can be found epoc32\tools\distrib here and is called arm-none-symbianelf-2005-q1c.exe.
And remember.. build instructions was n't written for this compiler.. nor was the mmp file, but it will probably work. bld.inf will NOT work..
IDE will generate WINSCW binaries only.. and you want target binaries?
Anyway.. dont expect your phone to be able to render anything in a good framerate without any opts. This lib was just built in order to build to engines, two which does n't run on phone anyway.
So abld build gcce urel for your target..
And .. yes.. this is not something for beginners.. but I hope you make it.
It can be found epoc32\tools\distrib here and is called arm-none-symbianelf-2005-q1c.exe.
And remember.. build instructions was n't written for this compiler.. nor was the mmp file, but it will probably work. bld.inf will NOT work..
IDE will generate WINSCW binaries only.. and you want target binaries?
Anyway.. dont expect your phone to be able to render anything in a good framerate without any opts. This lib was just built in order to build to engines, two which does n't run on phone anyway.
So abld build gcce urel for your target..
And .. yes.. this is not something for beginners.. but I hope you make it.
Thank you for your help.
I could not make bldmake/abld work, but as my IDE is made especially to build for symbian platforms with compilation optimisations for each one, I don't think it is a great problem.
I have found the problem I had with the compiled library: as it is a C library and my program is in C++, they were not really compatible (in C looks like the functions are linked with their name, but in C++ it is with a number, because of the possibility to have various functions with the same name I suppose...)
So I have renamed every .C in a .cpp file, and added at the beginning of every file (.h and new .cpp):
This in order to be able to use the C functions of the lib from every C++ program without worrying about that any more. I obtained good results, looks like the compiler (gcc) is able to find nearly all the functions I am using from the lib, except one: mpeg2_cpu_state_init (in mpeg2_internal.h and cpu_accel.c[pp]). I cannot understand why it is not found, as other functions defined in mpeg2_internal.h are now found and used correctly. My error is the following:
Looks like decode.cpp cannot find functions from cpu_accel.cpp, even if it is compiled after cpu_accel.cpp... (Their functions are both declared in mpeg2_internal.h, maybe it is a problem for my compiler?) I have tried to see the result to change a line in mpeg2_internal.h into:
And I did almost the same into cpu_accel.cpp (without the inline or the ';' of course). I now got a warning occuring when compiling the libmpeg2.lib:
That means my problem is in the building of the lib, obviously. Do you have an idea of how to solve my last problem?
I could not make bldmake/abld work, but as my IDE is made especially to build for symbian platforms with compilation optimisations for each one, I don't think it is a great problem.
I have found the problem I had with the compiled library: as it is a C library and my program is in C++, they were not really compatible (in C looks like the functions are linked with their name, but in C++ it is with a number, because of the possibility to have various functions with the same name I suppose...)
So I have renamed every .C in a .cpp file, and added at the beginning of every file (.h and new .cpp):
Code: Select all
extern "C" {
<code...>
}
Code: Select all
release\UIQ (3.0)\decode.obj: In function `mpeg2_accel':
decode.cpp:(.text+0xd18): undefined reference to `mpeg2_cpu_state_init(unsigned int)'
release\UIQ (3.0)\decode.obj: In function `mpeg2_init':
decode.cpp:(.text+0xfb8): undefined reference to `mpeg2_cpu_state_init(unsigned int)'
Code: Select all
//void mpeg2_cpu_state_init (uint32_t accel); <- previous line
#ifdef __cplusplus
inline void mpeg2_cpu_state_init (unsigned int accel);
#else
void mpeg2_cpu_state_init (uint32_t accel);
#endif
Code: Select all
...
cpu_state.cpp
decode.cpp
mpeg2_internal.h:237: warning: inline function `void mpeg2_cpu_state_init(unsigned int)' used but never defined
...
-
- ScummVM Porter
- Posts: 1423
- Joined: Sun Oct 30, 2005 2:27 pm
- Location: Malmoe, Sweden
Well.... So since this is Scummvm and you are trying to use the lib for something else.. I should really charge you..
Any way.. what is missing is checks for cpp in the header files. Moving the code to Cpp files is the WORST thing you can do.. You are linking against cpp code thats fine.. but the lib it self is still using C.
So each exported H file should have
# ifdef __cplusplus
extern "C" {
# endif
as a start
and
# ifdef __cplusplus
}
# endif
as an end..
This will make all H files you use from cpp code to be linked as C style not cpp style. This should also fix other problems.
So never try to make over C code into CPP unless you want to get serious problems. Instead makesure the H files export the right type of functions. (C style in this case).
Then you link with
staticlibrary in the mmp file
And scummvm is lots of CPP code using just that.. C libs. and it works fine... well most of the time.
Any way.. what is missing is checks for cpp in the header files. Moving the code to Cpp files is the WORST thing you can do.. You are linking against cpp code thats fine.. but the lib it self is still using C.
So each exported H file should have
# ifdef __cplusplus
extern "C" {
# endif
as a start
and
# ifdef __cplusplus
}
# endif
as an end..
This will make all H files you use from cpp code to be linked as C style not cpp style. This should also fix other problems.
So never try to make over C code into CPP unless you want to get serious problems. Instead makesure the H files export the right type of functions. (C style in this case).
Then you link with
staticlibrary in the mmp file
And scummvm is lots of CPP code using just that.. C libs. and it works fine... well most of the time.
