hank/dsf2flac

Building for ARM

Closed this issue · 3 comments

I wanted to build this for ARM (Raspberry PI). The fist issue I ran into whas that I had to run ./autogen.sh with ./autogen.sh --with-boost-libdir=/usr/lib/arm-linux-gnueabihf so that the boost filesystem version could be found. I'm not sure if the script could determine the architecture automatically and add this option but would be nice.

Second issue is that there are calls to _mm_malloc method in the dst_init.c source file (I think this is an intel specific method). I commented out the if statement in the MemoryAllocate function and changed the MemoryFree function to use the arm friendly way to free(Array). The compiled file works fine, but I don't know what I may have broken.

Here's a snippet of the dst_init.c code and what I did to get this to make on ARM:

------------------------------------------------------------------

/* General function for allocating memory for array of any type */
static void *MemoryAllocate(int NrOfElements, int SizeOfElement) 
{
  void *Array;

/*  if ((Array = _mm_malloc(NrOfElements * SizeOfElement, 16)) == NULL) 
*  {
*    fprintf(stderr,"ERROR: not enough memory available!\n\n");
*  }
*/
  return Array;
}

static void MemoryFree(void *Array) 
{
/*  _mm_free(Array); */
  free(Array);
}
-------------------------------------------------------------------
hank commented

Cool - thanks for doing that. I'd recommend changing the _mm_malloc call to just malloc in the ARM case, and adding ifdefs for ARM such that the code stays the same on x86 and does malloc and free on ARM.

https://sourceforge.net/p/predef/wiki/Architectures/

If you want to do that and make a pull request, I'd be happy to pull it in!

Shure, I'll give it a shot.

hank commented

Merged, see pull request!