3

During the past week, I've been building a massive static library (>1000 C files) with files that have been generated by an independent third-party.

Currently, I'm programming an app that will have some intense computations and it appears that i need to add the CLAPACK library. I believe the Acceleration framework is the way to go, but i just can't seem to get it to behave:

without the framework I have a bunch of linker errors telling me I'm missing, among other, cblas_zgemm and dgetrf (there are over a dozen in total spread over some 30 files).

after I add the framework to the project and without changing my code one iota, the cblas_zgemm linker error disappears, but dgetrf remains (despite belonging to the framework).

If I add #include (or #import) <Accelerate/Accelerate.h>, I get well over 1000 linker errors, telling me I'm redeclaring a bunch of enumerators (e.g. CblasTrans) and that there are conflicting types for xyz... The error messages seem to be repeating themselves, meanwhile dgetrf remains undefined.

What I'm doing wrong/ what am I missing?

thanks

edit: the full error messages after I add the are:

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h:12: error: redeclaration of enumerator 'CblasLower'


/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h:182: error: conflicting types for 'cblas_sgemv'

edit 2: the original linker errors after I added the framework:

"_dgetrf", referenced from:
      _aaConditionNumber in libccodeLab.a(condNumber.o)
      _aaInvMatrixLUDri in libccodeLab.a(invMtrxLUDri.o)
      _aaLUFactorEx in libccodeLab.a(LU.o)
  "_dgetri", referenced from:
      _aaConditionNumber in libccodeLab.a(condNumber.o)
      _aaInvMatrixLUDri in libccodeLab.a(invMtrxLUDri.o)
      _aaLUInvMatrix in libccodeLab.a(LUInvMtrx.o)
  "_zgesdd", referenced from:
      _aaCxSVD in libccodeLab.a(cxSVD.o)
  "_dgeev", referenced from:
      _aaGenEigenValueVector in libccodeLab.a(eigenV.o)
  "_dpotrf", referenced from:
      _aaInvMatrixChoDri in libccodeLab.a(invMtrxChoDri.o)
  "_dpotri", referenced from:
      _aaInvMatrixChoDri in libccodeLab.a(invMtrxChoDri.o)
  "_dtrtri", referenced from:
      _aaInvMatrixTriDri in libccodeLab.a(invMtrxTriDri.o)
  "_dgelqf", referenced from:
      _aaQRWithoutPivot in libccodeLab.a(QRWithoutPivot.o)
  "_dorglq", referenced from:
      _aaQRWithoutPivot in libccodeLab.a(QRWithoutPivot.o)
  "_dgesdd", referenced from:
      _aaSVDS in libccodeLab.a(SVDS.o)
      _aaSVD in libccodeLab.a(SVD.o)
  "_dsyevd", referenced from:
      _aaSymEigenValueVector in libccodeLab.a(symEigenV.o)
Rasman
  • 5,349
  • 1
  • 25
  • 38
  • can you paste the error messages in your question – Robin May 06 '11 at 04:53
  • 1
    You need to add the Accelerate framework and you need to `#import` the corresponding (umbrella) header file. Since you’ve done that and you’re getting redeclaration/conflicting types errors, it looks like your source files are also including header files of another (C)LAPACK implementation. See if you can spot those, and remove them (don’t forget to backup your project first, or use a version control system). –  May 06 '11 at 04:57
  • @Bavarious: some more code perusing and I've discovered a header file referencing mkl_lapack.h and mkl_cblas.h. The code seems to be intertwined with this method. Anyway I can lie to the compiler and make it believe Apple's Lapack is just as good? – Rasman May 06 '11 at 13:59
  • alternatively, can I simply just include clapack.h (although how do i directly reference it?) or something more precise? – Rasman May 06 '11 at 14:16

1 Answers1

3

so after reading through some of the documentations i don't need to add an include statement: simply having the framework in the project is sufficient.

The problem is that Apple's LAPACK doesn't recognize _dgetrf, rather it's looking for dgetrf_. Also everything must be passed by reference.

the documentation can be found here: Vector Libraries

Clay
  • 319
  • 2
  • 15
Rasman
  • 5,349
  • 1
  • 25
  • 38