Page 1 of 1

64 bit compilation fails for SVN revision 3604 (+quick fix)

Posted: 16 Oct 2011, 19:27
by TBlakely
Heya!

Just recently tried to get the latest SVN version of BCI2000 up and running, SVN Revision 3604. While the VS 2008 project files are generated perfectly and the compile succeeds, the project files generated by the "Visual Studio 2008 win64" batch file fail to link at the last step. Compiling the g.USBampADC project succeeds in the 32 bit version, but fails during the linking stage with the following errors:

Code: Select all

LINK : error LNK2001: unresolved external symbol _SigSrcRegistry
gUSBampADC.obj : error LNK2001: unresolved external symbol _gUSBampADCRegistrar1
[Note: I'm compiling against 64-bit gUSBAmp & 64 bit Qt libraries]

It seems this has to do with the new BCIRegistry.h file that I'm assuming was introduced with the refactoring into BCI2000Framework[Core/SigSrc/SigProc/App]Module libraries. Specifically, the following lines:

Code: Select all

# define RegisterExtension_( x )  \
   extern "C" int ExtensionObjectName_( x ) = (int)EnvironmentExtension::AutoDelete( new x ); \
   __pragma( comment( linker, "/include:_" #x "Instance" )
Attempts to work arounded it included:
- Changing CMAKE versions has no effect (was present in 2.8.6, 2.8.2)
- Visual studio vcproj files are identical when diff'd, save for compiler /machine: type
- Preprocessed files (compile with /P ) for the above line are identical
- Generating the 32 bit project files and switching the linker's machine type from "/MACHINE:X86" to "/MACHINE:X64" generates the same linker error

The only workaround that I've found is commenting out the _pragma line to remove the linker flag "/include:_gUSBAmpADCRegistrar1". I'm guessing that linker flag is there to make sure that a reference to the registrar gets into the exports for the statically compiled libraries (from the export_registry), so this could break things down the line if removed. But it compiles and appears to run correctly.

Is this reproducible? I just checked out a clean version of the SVN 3604 and ran the "Make VS2008 Win64 Project Files.bat" using cmake version 2.8.2 (or 2.8.6).

-Tim

Re: 64 bit compilation fails for SVN revision 3604 (+quick f

Posted: 20 Oct 2011, 09:30
by mellinger
Hi,

thanks a lot for your helpful bug report. I fixed linking under Win64, and added g.USBamp 64-bit support, so you no longer need to modify it in order to get a 64-bit version of that source module.

For more information, see http://www.bci2000.org/tracproj/changeset/3608.

Best regards,
Juergen