Topic: libmusicbrainz5 and Visual Studio 2010

Bottom line?  It's a nightmare.

I'm pretty familiar with both Linux/gcc and with Windows/VS10 development, and the statement on the home page that 'the library supports *Windows*, Linux and Mac OS X' led me to the assumption that windows support was, actually available.

After nearly twelve hours of pain, I can most assuredly state that it is not.

First, there is no INSTALL instructions for windows; at least none that clearly indicates it's for windows -- plenty of LINUX stuff; certainly nothing for Visual Studio 2010.

I finally got CMake to work (sort of) and created a VS2010 '.sln' file -- I was pretty stoked about that actually -- but then, of course, VS utterly fails to successfully build it because it 'Cannot open include file: 'musicbrainz5/mb5_c.h'.  I *believe* this is because I don't have pkg-config, but after five hours of Google searches and attempts to get pkg-config to work, I determined that it appears to simply not be available, or at least to have a deadly-embrace relationship with MinGW: each require the other to successfully work.

Come on, guys.  Would it kill you to make a 64-bit DLL available for Windows?  They are transportable, you know.

Please advise how one would actually use libmusicbrainz on Windows.

Re: libmusicbrainz5 and Visual Studio 2010

Hi Steve,

You're quite correct, Windows support for libmb is currently lacking. I don't really build stuff like this under Windows, so it had never been tested.

There is a branch on GitHub that is supposed to add Windows support. I'm trying to find time to test this and integrate it.

If you'd like to take a look, it's here:

https://github.com/Seltzer/libmusicbrainz

Let me know how you get on. Email is probably the best means of communication or a post to the mb-devel mailing list. I don't get on here much.

Andy

Re: libmusicbrainz5 and Visual Studio 2010

After downloading your branch and spending another half-day trying to get the library to compile on a standard, 64-bit Vista platform, and failing utterly, I am unable to waste more time trying to get this to work; I have a project I need to complete.  I guess it will only run on Linux.

In my opinion, until there is a clearly-defined installation document that describes how to compile libmusicbrainz5 under Windows, or until a binary DLL is provided for both 32 and 64-bit systems, support for this platform should be expunged from the front page; it's simply not true.

If it will only compile under MinGW, then a script for accomplishing this must be posted.  My problem has been getting CMake to work at all, and specifically how to get a version of pkg-config to work on my platform.

Re: libmusicbrainz5 and Visual Studio 2010

I'm sorry you're not having any luck. As I say, support for Windows is still something we're working on. I'll try to liase with the guy who was doing the work and see if he can help out.

Can you give me any further information on exactly what problems you were seeing? I seem to remember the instructions added to the README were fairly comprehensive (although I haven't had chance to try them myself yet).

Thanks

Andy

Re: libmusicbrainz5 and Visual Studio 2010

Hi Steve,

Having run through the README on a fresh system today (my work computer with VS2010 Ultimate), I encountered only one problem, which I fixed using the workaround described here:
http://connect.microsoft.com/VisualStud … or-msb6001

Hopefully this will fix your problem. If it does, I'll add it to the README.

Re: libmusicbrainz5 and Visual Studio 2010

Steve, can you please try the workaround as posted above? I'm going to do the same myself, but it may resolve your issue.

Moving forward, it might be sensible to provide pre-built versions for Windows. I'll check what the MusicBrainz policy is for doing that.

Andy

Re: libmusicbrainz5 and Visual Studio 2010

Wow. Trying to stay level-headed here...

Okay, once again, as I said in my initial post; the problem isn't with VS 2010.  The problem is with CMake.  And it's not the README file that contains the installation 'documentation', its the 'INSTALL.txt' file, and the entire 'Building' section of this file consists of a whopping three lines of description:

    cmake .
    make
    make install

Problem is... it doesn't work when you start from scratch.  And further, 'make' doesn't work on a VS2010 system, so the last two lines are invalid from the start.  I suppose if you tried it on a machine that's already configured with MinGW and has the 64-bit GTK libraries, and has a proper installation of cmake, has a working version of pkg-config, and has the PATH variable properly updated to point to all the right places, 'cmake' might actually produce a valid VS .sln file, but to tacitly assume all of this, without specifically indicating there may be problems, does a huge disservice to those of us trying to get MB to work under windows.

Over the weekend, I *finally* was able, after a week of work, to get pkg-config to execute without throwing numerous errors (there are also numerous 32/64-bit inconsistencies that need to be resolved).  I basically had to set up a complete MinGW/GTK development environment in order to do so.  Bottom line is: CMake works fine, as long as you have a fully configured, Linux-like dev environment -- something not many VS users will possess.

The right way to support VS isn't CMake, it's to provide pre-built '.sln' files.

Oh well... hopefully today I'll be able to actually create a VS solution file.  If i can get there, I'm reasonably certain MB will compile.

Re: libmusicbrainz5 and Visual Studio 2010

Update: Wrestling with neon this morning.  Discovered that the 'libneon.lib' I thought was good, wasn't.  Now I'm trying to resolve dependencies and trying to get a valid neon compiled on my machine in 64-bit  VS 2010.

Re: libmusicbrainz5 and Visual Studio 2010

Okay, I *think* I got a valid 'libneon.lib' file -- at least the 'nmake' seemed to succeed.  If I do as the MB 'INSTALL.txt' file says, and go to the MB directory and enter 'cmake .' (after installing cmake and properly updating the PATH variable to point to it), I get:

------------------------
...\libmusicbrainz-5.0.1>cmake .
-- checking for module 'neon'
--   package 'neon' not found
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (MESSAGE)
:
  Could NOT find Neon (missing: NEON_LIBRARIES NEON_INCLUDE_DIR)
Call Stack (most recent call first):
  C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:288 (_FPHSA_FAILURE_MESSA
GE)
  cmake/modules/FindNeon.cmake:19 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:22 (FIND_PACKAGE)


-- Configuring incomplete, errors occurred!
------------------------

And of course, at this point, I have zero idea where to define 'NEON_LIBRARIES' and 'NEON_INCLUDE_PATH', since there is no doc's about the structure of the MB 'cmake' files.

10 (edited by adhawkins 2012-09-24 18:11:35)

Re: libmusicbrainz5 and Visual Studio 2010

Steve

Did you follow the new instructions here?

https://github.com/Seltzer/libmusicbrainz

There is a new section in README.md titled 'Generating the libmusicbrainz5 Visual Studio solution using CMake GUI'. I think these should more correctly be in the INSTALL.txt file, I'll suggest to Nathan that he move them there.

I followed this and got a .sln file very quickly. I then stumbled a little in getting it to compile, but Nathan has pointed a pointer to a workaround, which I'm going to try this evening.

Andy

Re: libmusicbrainz5 and Visual Studio 2010

Okay, after doing some research and learning how CMake works, I determined that the ‘<MB Install Directory>/cmake/modules/FindNeon.cmake’ file contains the environment variable references. 

I tried adding the paths to the neon include directory and libraries directly into the file – didn’t work.

I tried defining the ‘PKG_NEON_INCLUDE_DIRS’ and ‘PKG_NEON_LIBRARY_DIRS’ system variables directly in the command window – didn’t work.

I tried moving the neon directory into the root path of my drive, eliminating any paths with spaces and appropriately updating my environment variables – didn’t work

I tried using ‘NEON_LIBRARIES’ and ‘NEON_INCLUDE_DIRECTORY’ instead of the ‘PKG_...’ versions of the variables – did not work

I’m now sitting, staring at the monitor, trying to guess what I should try next.

Are you getting the picture, guys?  This is a nightmare.

12 (edited by adhawkins 2012-09-24 18:28:03)

Re: libmusicbrainz5 and Visual Studio 2010

Ok, I can confirm that using VS C++ 2010 and Steve's workaround with the instructions in README.md, I have successfully build musicbrainz5.dll and its associated examples.

cdlookup is working for me.

Can you please try the instructions mentioned using the source from the git repository above?

Thanks

Andy

Re: libmusicbrainz5 and Visual Studio 2010

adhawkins wrote:

Steve

Did you follow the new instructions here?

https://github.com/Seltzer/libmusicbrainz

There is a new section in README.md titled 'Generating the libmusicbrainz5 Visual Studio solution using CMake GUI'. I think these should more correctly be in the INSTALL.txt file, I'll suggest to Nathan that he move them there.

I followed this and got a .sln file very quickly. I then stumbled a little in getting it to compile, but Nathan has pointed a pointer to a workaround, which I'm going to try this evening.

Andy

No, I'm using the official release.  I will go download that and get back to you.

Re: libmusicbrainz5 and Visual Studio 2010

Followed the steps closely in the 'Seltzer' branch README file.  9 of the projects failed.  Here's a couple of examples of the command-window output in VS 2010:

8>------ Build started: Project: search_c, Configuration: Debug x64 ------
8>  Building Custom Rule D:/Booth Creative/MM3 Stuff/Seltzer-libmusicbrainz-d9042b7/examples/CMakeLists.txt
8>  search_c.c
8>D:\Booth Creative\MM3 Stuff\Seltzer-libmusicbrainz-d9042b7\examples\search_c.c(29): fatal error C1083: Cannot open include file: 'musicbrainz5/mb5_c.h': No such file or directory



10>------ Build started: Project: cdlookup_c, Configuration: Debug x64 ------
10>  Building Custom Rule D:/Booth Creative/MM3 Stuff/Seltzer-libmusicbrainz-d9042b7/examples/CMakeLists.txt
10>  CMake does not need to re-run because D:\Booth Creative\MM3 Stuff\Seltzer-libmusicbrainz-d9042b7\examples\CMakeFiles\generate.stamp is up-to-date.
10>  cdlookup_c.c
10>D:\Booth Creative\MM3 Stuff\Seltzer-libmusicbrainz-d9042b7\examples\cdlookup_c.c(29): fatal error C1083: Cannot open include file: 'musicbrainz5/mb5_c.h':

11>------ Build started: Project: ctest, Configuration: Debug x64 ------
11>  Building Custom Rule D:/Booth Creative/MM3 Stuff/Seltzer-libmusicbrainz-d9042b7/tests/CMakeLists.txt
11>  CMake does not need to re-run because D:\Booth Creative\MM3 Stuff\Seltzer-libmusicbrainz-d9042b7\tests\CMakeFiles\generate.stamp is up-to-date.
11>  ctest.c
11>D:\Booth Creative\MM3 Stuff\Seltzer-libmusicbrainz-d9042b7\tests\ctest.c(29): fatal error C1083: Cannot open include file: 'musicbrainz5/mb5_c.h': No such file or directory

Re: libmusicbrainz5 and Visual Studio 2010

I don't understand why you're seeing those failures. I've just run though them with VS C++ 10 Express and it all compiled just fine.

Perhaps Seltzer can shed further light on this?

Andy

16 (edited by steve 2012-09-24 19:08:09)

Re: libmusicbrainz5 and Visual Studio 2010

These. 'mb5_c.h' errors?  ... I've been getting them since the very start.

And... no, they really don't exist anywhere.  My assumption has always been that it's a problem with CMake not 'making' them right.

17 (edited by steve 2012-09-24 19:12:47)

Re: libmusicbrainz5 and Visual Studio 2010

And another thing... Here's the contents of the output window in CMake GUI v2.8.8:

--------------------------------
checking for module 'neon'
  package 'neon' not found
Found Neon: D:/neon-0.29.6/libneon.lib 
Configuring done
Generating done
--------------------------------

How can 'neon' be not found and found at the same time?

Oh.. and the generator I'm using is 'Visual Studio 10 Win64'.

Re: libmusicbrainz5 and Visual Studio 2010

I suspect neon is being searched for and not found, then it's using the variable you defined in the GUI to tell it where you have neon installed?

mb5_c.h is auto generated. Perhaps you need to run the build target that generates it manually first? I assumed all the dependencies were set correctly (they worked fine for me).

Have you tried Seltzers repo from a completely clean checkout?

Andy

Re: libmusicbrainz5 and Visual Studio 2010

**** EXTREMELY CRITICAL NOTE ****

After implementing the Microsoft bug-fix, described above, and starting from a completely fresh 'Seltser' distro, I was able to partially build the package.

Here is the extremely important, critical rule:

DO NOT BUILD THE SOLUTION 'libmusicbrainz5'!!

To get a successful build, YOU MUST BUILD THE 'ALL_BUILD' Project. 

If you just tell VS to build the solution (which most VS developers will do by habit and default), the needed .h files WILL NOT BE GENERATED and the build will fail.  the 'ALL_BUILD' project absolutely must be built instead, and that will, in turn, fork builds for all 'child' projects.  This is fundamentally different from the normal Microsoft build standard, and will cause most VS people to crash and burn.

I still didn't get an actual 'lib' file though... further research indicates the 'INSTALL' project tries to write to C:/Program Files -- an extremely dangerous and ill-advised procedure.  I'm going back to CMake-land.

Some progress, however.

Re: libmusicbrainz5 and Visual Studio 2010

I just selected 'Build solution' from the Build menu.

That generated everything for me.

I'm tempted to try to record a video of my doing this, perhaps that will help identify what we're doing differently?

Andy

Re: libmusicbrainz5 and Visual Studio 2010

That's not the normal way I build solutions; I right-click on the solution in the Solution Explorer, and choose 'Build'.  That most definitely does not work.  Using your Build-Menu technique, however, does. At least... it compiles.  I still cant find the actual 'lib' file because I *think* it tries to write directly to the 'C' drive Program Files folder, which violates major Microsoft rules.  The build needs to write to a 'lib' or 'bin' folder in the project hierarchy.

Re: libmusicbrainz5 and Visual Studio 2010

Alright, let me just ask this question straight-out.  When I run CMake(GUI), the 'BIN_INSTALL_DIR' is set to 'C:/Program Files/libmusicbrainz5/bin'.  The 'EXEC_INSTALL PREFIX' is set to 'C:/Program Files/libmusicbrainz5'.

How do I change those to point to somewhere else?  I can't find where in the Seltzer distro they are defined.

Re: libmusicbrainz5 and Visual Studio 2010

I didn't change them at all. They're only used if you run the 'INSTALL' step. I don't think this runs automatically.

I found the files here (all paths relative to the 'build' directory you specify in CMake GUI)

src\Debug\musicbrainz5.dll
src\Debug\musicbrainz5.lib
examples\Debug\cdlookup.exe

If you copy musicbrainz5.dll into examples\Debug, you can then run

cdlookup WtKVvRf0LgeYqI9eTWZzjQoCslk-

And it will lookup that discid and report the results.

Andy

24 (edited by steve 2012-09-24 20:38:45)

Re: libmusicbrainz5 and Visual Studio 2010

Ha! okay.. in a different place for me, but okay... further testing...

Re: libmusicbrainz5 and Visual Studio 2010

Okay, placing the executable in the 'src' directory is, again, non-standard, but yes, this does appear to have created the libmusicbrainz.dll, and the 'cdlookup' seems now to work -- success at last.

Now.. on to figuring out how to get cover art ;p