GCC 4.8/OS X: need -flax-vector-conversions

323 views
Skip to first unread message

Tim Smith

unread,
Jun 15, 2014, 12:55:34 PM6/15/14
to plink...@googlegroups.com
Compiling plink2 against Accelerate on OS X with gcc 4.8 with the provided Makefile fails, generating errors like:

/System/Library/Frameworks/vecLib.framework/Headers/vBasicOps.h: In function 'vUInt16 vU16HalfMultiply(vUInt16, vUInt16)':

/System/Library/Frameworks/vecLib.framework/Headers/vBasicOps.h:352:84: note: use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts

   vUInt16   __vbasicops_vB) { return _mm_mullo_epi16(__vbasicops_vA, __vbasicops_vB); }

                                                                                    ^

/System/Library/Frameworks/vecLib.framework/Headers/vBasicOps.h:352:84: error: cannot convert 'vUInt16 {aka __vector(8) short unsigned int}' to '__m128i {aka __vector(2) long long int}' for argument '1' to '__m128i _mm_mullo_epi16(__m128i, __m128i)'

/System/Library/Frameworks/vecLib.framework/Headers/vBasicOps.h: In function 'vSInt16 vS16HalfMultiply(vSInt16, vSInt16)':

/System/Library/Frameworks/vecLib.framework/Headers/vBasicOps.h:377:84: error: cannot convert 'vSInt16 {aka __vector(8) short int}' to '__m128i {aka __vector(2) long long int}' for argument '1' to '__m128i _mm_mullo_epi16(__m128i, __m128i)'

   vSInt16   __vbasicops_vB) { return _mm_mullo_epi16(__vbasicops_vA, __vbasicops_vB); }


Taking gcc's advice and adding -flax-vector-conversions to CFLAGS in the Makefile allows the build to finish.

Thanks,
Tim

Christopher Chang

unread,
Jun 15, 2014, 1:49:09 PM6/15/14
to plink...@googlegroups.com
Try adding "#define __ACCELERATE__" immediately under "#include <Accelerate/Accelerate.h>" on line 10 of plink_matrix.h .  (http://permalink.gmane.org/gmane.comp.lang.r.mac/8269 implies that something like this might work.  If it does fix the problem, I'll add it to the main codebase.)
Message has been deleted

Christopher Chang

unread,
Jun 15, 2014, 2:23:58 PM6/15/14
to plink...@googlegroups.com, chrch...@gmail.com
Hmm.  Is this a 64-bit Intel Mac?

On Monday, June 16, 2014 2:19:42 AM UTC+8, Tim Smith wrote:
I saw the same thread and tried that both by adding -D__ACCELERATE__ to CFLAGS and just now by adding the #define in plink_matrix.h as you suggested; neither had any effect for me.

Tim Smith

unread,
Jun 15, 2014, 2:53:34 PM6/15/14
to plink...@googlegroups.com, chrch...@gmail.com
Yes, it is. I'm using Homebrew's gcc package.

Christopher Chang

unread,
Jun 15, 2014, 10:11:20 PM6/15/14
to plink...@googlegroups.com, chrch...@gmail.com
If there's some Homebrew + OS X 10.8+ detection logic you can suggest for the Makefile, and your testing suggests the -flax-vector-conversions plink2 build doesn't have any problems, I can update the Makefile accordingly.  I can't justify adding that flag for all Mac builds, though.

Tim Smith

unread,
Jun 15, 2014, 11:37:34 PM6/15/14
to plink...@googlegroups.com, chrch...@gmail.com


On Sunday, June 15, 2014 7:11:20 PM UTC-7, Christopher Chang wrote:
If there's some Homebrew + OS X 10.8+ detection logic you can suggest for the Makefile, and your testing suggests the -flax-vector-conversions plink2 build doesn't have any problems, I can update the Makefile accordingly.  I can't justify adding that flag for all Mac builds, though.

Roger that. What compiler are you using to generate the Mac builds now? The flag appeared in gcc 4.3 [1] and enables the default behavior from 4.2. I was kind of hoping this hadn't been seen yet because you were building with 4.2. If that's not the case, there's probably deeper magic involved and I'm much less sanguine about this solution.

Thanks,
Tim

Christopher Chang

unread,
Jun 16, 2014, 12:41:41 AM6/16/14
to plink...@googlegroups.com, chrch...@gmail.com
I have a fairly standard Xcode setup, thus I'm building with 4.2 due to well-known Apple licensing issues.  So, okay, I'll go ahead and add Mac gcc version detection logic along the lines of http://stackoverflow.com/questions/5188267/checking-the-gcc-version-in-a-makefile .
Reply all
Reply to author
Forward
0 new messages