Please move: Building problems with SVN and MUNT patch

Developer's Forum for discussion of bugs, code, and other developmental aspects of the Munt Project.

Please move: Building problems with SVN and MUNT patch

Postby marooned_on_mars » 2014-3-20 @ 01:53

Not sure if this is the right place to post but this is what happens when I try to make the latest DosBox SVN (which I've patched with the munt SVN patch) under Debian:

Code: Select all
g++  -g -O2    -o dosbox dosbox.o  cpu/libcpu.a debug/libdebug.a dos/libdos.a fpu/libfpu.a  hardware/libhardware.a gui/libgui.a ints/libints.a misc/libmisc.a shell/libshell.a hardware/serialport/libserial.a libs/gui_tk/libgui_tk.a -lasound -lm -ldl -lpthread -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lSDL -lpng -lz -lX11 -lGL
gui/libgui.a(midi.o): In function `__static_initialization_and_destruction_0':
/dosbox/src/gui/midi.cpp:95: undefined reference to `MidiHandler_mt32::GetInstance()'
collect2: error: ld returned 1 exit status


I've searched for that reference and it points back to the diff file provided on Munt's GitHub.
libmt32emu.a has been previously complied and it's currently under /usr/local/lib/ including all it's headers.
Last edited by marooned_on_mars on 2014-3-21 @ 02:45, edited 1 time in total.
I support Universal Basic Income, and so should you, here's why. Another reason why.
Commonly asked questions about UBI
Spread the word!
User avatar
marooned_on_mars
Member
 
Posts: 361
Joined: 2006-1-23 @ 18:47
Location: MoonBase2

Re: Problem with new SVN DosBox patch

Postby truth_deleted » 2014-3-20 @ 03:41

The patch works correctly in the MinGW environment so the patch is not malformed. I don't believe you should post compiler questions to this subforum, but you should ensure the presence of header files under the gui subdirectory: midi_mt32.h is under /gui; and a header file named the same but having different source code under gui/mt32emu (I used the single threaded version, search among the MUNT directories in the downloaded package). The library for mt32 should be in a path visible to the linker, too. Next, I would verify that the compiler and linker environment are standard and the binaries, such as gcc, are compatible (as in not experimental and too recent). My guess is to solve the issue by ensuring the proper location of the header and library files for mt32 emulation.
truth_deleted
 

Re: Problem with new SVN DosBox patch

Postby marooned_on_mars » 2014-3-20 @ 20:32

truth5678 wrote:The patch works correctly in the MinGW environment so the patch is not malformed. I don't believe you should post compiler questions to this subforum


Sorry about that, I thought the patch might be misbehaving under Debian so that's why I posted here. I thought that if I were to post under DosBox Development subforum I would be sent here in that case. But ofcourse I had the feeling I was doing something wrong :P
Mods can feel free to move this under DosBox Development

truth5678 wrote:but you should ensure the presence of header files under the gui subdirectory: midi_mt32.h is under /gui; and a header file named the same but having different source code under gui/mt32emu (I used the single threaded version, search among the MUNT directories in the downloaded package).


I've copied the midi_mt32.h from under /singleThread/ in the DosBox patch folder, but this hasn't solved it. midi_mt32.h and .cpp are both under /gui as well.

truth5678 wrote:The library for mt32 should be in a path visible to the linker, too. Next, I would verify that the compiler and linker environment are standard and the binaries, such as gcc, are compatible (as in not experimental and too recent). My guess is to solve the issue by ensuring the proper location of the header and library files for mt32 emulation.


Not sure what you mean by "standard" or "experimental". I'd guess you mean I shouldn't get gcc & co from a testing repo?
I support Universal Basic Income, and so should you, here's why. Another reason why.
Commonly asked questions about UBI
Spread the word!
User avatar
marooned_on_mars
Member
 
Posts: 361
Joined: 2006-1-23 @ 18:47
Location: MoonBase2

Re: Problem with new SVN DosBox patch

Postby truth_deleted » 2014-3-20 @ 21:10

I was suggesting that building dosbox with a library is an advanced topic and not an ideal environment to learning the compiler and linker settings. This is because there are different ways to solve errors and it requires knowledge of reading the source code. The above copy of midi_mt32.h and its location is specified in the header file itself. Development of these libraries do not typically offer a guide such as found in dosbox; and dosbox is designed to be built easily. Documentation is a separate task and would require a lot of technical knowledge without reward.

From past experience, the above "linker" error is in a function defined in midi_mt32.h (the one under /gui and it also occurs in the corresponding .c file). This usually means that the linker cannot see that function because the (header or) library files are not visible to the (compiler or) linker. This could be caused by not specifying the directories where these files are located; one solution is to copy these files to the appropriate include/ and library/ directories which are seen by the compiler and linker. If I had the Debian environment, I would work out the steps and then could reproduce the error. But this provides a start for experimenting.

I assume you moved the header files to an /include directory which is visible by the compiler. Also, ensure you built the mt32 library in your own linux environment and copied that library to the appropriate path. I'll verify the ./configure command line and whether it requires additional paths set for the mt32 library, for instance. I wonder whether the linker can find the mt32 library, perhaps first try copying it to a directory of library files which are visible to the linker. Given you are able to build dosbox without mt32, then the SDL library must be visible to the linker, perhaps copy the mt32 library to the directory where the SDL library is located.

The above point about using known working binaries can be illustrated by the newest gcc (4.8.x). It is just another source of possible error because the compilers change their settings between versions. It is better to use a commonly used version instead. However, I don't believe this is the source of the linker error.

This all presumes that you verified that the patch was installed correctly and that you do not have any .rej files from incorrect patching of code into the source files.

I was only offering my opinion about compiler/linker questions because there could be dozens of these for a complex software package. However, I'm sure this opinion is easily refuted. :)

Edit: ensure that there are two different midi_mt32.h files, one under gui/ and the other under gui/mt32emu/.
truth_deleted
 

Re: Problem with new SVN DosBox patch

Postby marooned_on_mars » 2014-3-20 @ 22:44

Thanks for the reply. :)

truth5678 wrote:From past experience, the above "linker" error is in a function defined in midi_mt32.h (the one under /gui and it also occurs in the corresponding .c file). This usually means that the linker cannot see that function because the (header or) library files are not visible to the (compiler or) linker. This could be caused by not specifying the directories where these files are located; one solution is to copy these files to the appropriate include/ and library/ directories which are seen by the compiler and linker. [...] Also, ensure you built the mt32 library in your own linux environment and copied that library to the appropriate path. I'll verify the ./configure command line and whether it requires additional paths set for the mt32 library, for instance. I wonder whether the linker can find the mt32 library, perhaps first try copying it to a directory of library files which are visible to the linker. Given you are able to build dosbox without mt32, then the SDL library must be visible to the linker, perhaps copy the mt32 library to the directory where the SDL library is located.


I have the path set in bash to where the libraries are placed, also tried it through ldconfig, but since munt's library is static (.a) it won't detect the library as it requires a dynamic library (.so)
Yes, I've managed to compile DosBox SVN. Not sure what you mean by "linux environment" but I haven't changed anything since I built the munt library.
libmt32emu.a is in the same folder as the SDL libraries, under /usr/local/lib/


truth5678 wrote:The above point about using known working binaries can be illustrated by the newest gcc (4.8.x). It is just another source of possible error because the compilers change their settings between versions. It is better to use a commonly used version instead. However, I don't believe this is the source of the linker error.


I have both gcc 4.8 and 4.7 installed, and I'm not sure if 4.7 is commonly used but yes, I don't think it's the culprit either.

truth5678 wrote:This all presumes that you verified that the patch was installed correctly and that you do not have any .rej files from incorrect patching of code into the source files.


Nope, no .rej files.
To patch it I did :
Code: Select all
$ patch -p1 < dosbox-SVN-r3858-mt32-patch.diff


truth5678 wrote:Edit: ensure that there are two different midi_mt32.h files, one under gui/ and the other under gui/mt32emu/.


As I mentioned earlier, I have both of those files placed accordingly :P
I support Universal Basic Income, and so should you, here's why. Another reason why.
Commonly asked questions about UBI
Spread the word!
User avatar
marooned_on_mars
Member
 
Posts: 361
Joined: 2006-1-23 @ 18:47
Location: MoonBase2

Re: Problem with new SVN DosBox patch

Postby truth_deleted » 2014-3-20 @ 22:52

Could you list the version of Debian you are working with and possibly a link to the Live DVD/CD? With this newest patch, dosbox-SVN should build fairly easily. There must be a misconfigured path to the mt32emu library, otherwise the error should be different. It's linking fine to SDL. It could also be a simple fix from a switch at the configure command line.
truth_deleted
 

Re: Problem with new SVN DosBox patch

Postby marooned_on_mars » 2014-3-20 @ 23:40

Sure, here you go: http://crunchbang.org/download/
Although I think it wouldn't be very useful if you were to install it, as you would have to fiddle with it a bit to get Debian's testing repository, and that might take some time :)

About the swich when configuring, I tried to look into it and there seems to be the an LIBS env. variable, I tried to issue this command when configuring:

Code: Select all
./configure VAR=LIBS /usr/local/lib/libmt32emu.a


But that didn't seem to be correct.
I support Universal Basic Income, and so should you, here's why. Another reason why.
Commonly asked questions about UBI
Spread the word!
User avatar
marooned_on_mars
Member
 
Posts: 361
Joined: 2006-1-23 @ 18:47
Location: MoonBase2

Re: Problem with new SVN DosBox patch

Postby truth_deleted » 2014-3-21 @ 01:32

I placed libmt32emu.a in the library directory where the SDL libs are located. The mt32emu header files were placed in an include directory (specifically I placed them under /include/mt32emu/, but that would require a line in configure to let the compiler know the non-default location of these header files). Also, make sure midi_mt32.cpp is under /gui.

Also, try placing libmt32emu.a in /usr/lib/ along with its current location; and the mt32emu header files to /usr/include/ or /usr/include/mt32emu/. Write down the list of copied files so you can remove the clutter later.

Here is an example of adding an include path to configure (for my case, I didn't have to specify an additional library path): CPPFLAGS="-I/usr/include" ./configure

Edit: run ./autogen.sh after patching dosbox-svn with the mt32 patch!
truth_deleted
 

Re: Problem with new SVN DosBox patch

Postby marooned_on_mars » 2014-3-21 @ 02:44

truth5678 wrote:Here is an example of adding an include path to configure (for my case, I didn't have to specify an additional library path): CPPFLAGS="-I/usr/include" ./configure


Thanks, that will come in handy when I'll need that.

truth5678 wrote:Edit: run ./autogen.sh after patching dosbox-svn with the mt32 patch!


This seems to have fixed it! Thanks. I forgot about it when I went through the install instructions.
Thanks a lot for your help! :)

Now, where should I place the ROM files?

EDIT: /usr/share/mt-32-data/
I've self answered this one, yay me *sarcastic*
I support Universal Basic Income, and so should you, here's why. Another reason why.
Commonly asked questions about UBI
Spread the word!
User avatar
marooned_on_mars
Member
 
Posts: 361
Joined: 2006-1-23 @ 18:47
Location: MoonBase2

Re: Please move: Building problems with SVN and MUNT patch

Postby truth_deleted » 2014-3-21 @ 03:18

:)
truth_deleted
 


Return to MT-32 Development

Who is online

Users browsing this forum: No registered users and 1 guest