Build BCI2000 in Visual Studio 2010

Forum for software developers to discuss BCI2000 software development
krutanen
Posts: 14
Joined: 01 May 2013, 08:18

Build BCI2000 in Visual Studio 2010

Post by krutanen » 06 May 2013, 11:25

Hi,

I've been trying to build BCI2000 using Visual Studio 2010 but am facing difficulties. Can someone tell me where I am going wrong? Here's what I am doing now.

* Install Visual Studio 2010 (2012 seems not to be supported in BCI2000 at the moment)
* Install Visual Studio 2010 Service Pack 1

Without installing SP1 you will have
"LINK : fatal error LNK1123: failure during conversion to COFF"

* Install TortoiseSVN
* Checkout the SVN repository at http://www.bci2000.org/svn/trunk
* Open build/cmake/UseQt4.cmake

and replace

SET ( QT_LIBRARIES "" )

with

SET(QT_LIBRARIES
"Ws2_32.lib"
"Imm32.lib"
"comsuppw.lib"
"winmm.lib")

Without these you will get a lot of unresolved external symbol errors
in Qt libraries.

* Open src/contrib/SignalSource/Enobio/Enobio3G/CMakeLists.txt

and remove the line ENOBIO.cpp if it is present. This file does not exist
on the source tree; perhaps it has been forgotten to remove from the build system?.

* Open src/extlib/3DAPI/Demo/CMakeLists.txt

and replace the line

SET( HDR_FRAMEWÓRK

with

SET( HDR_FRAMEWORK

Perhaps this is a typo in the build system?

* In the repository root directory, delete

CMakeCache.txt

* Run "Make VS10 Project Files.bat" to generate Visual Studio 2010 solution file.

* Open the generated BCI2000.sln with Visual Studio 2010.

* Build all.

* TODO:

LINK : error LNK2001: unresolved external symbol SigSrcRegistry
LINK : error LNK2001: unresolved external symbol SigProcRegistry
LINK : error LNK2001: unresolved external symbol AppRegistry

These symbols are brought in explicitly by the /include linker flag
in Visual Studio. This is done in FORCE_INCLUDE_OBJECT CMake-macro
in build\cmake\AddRegistryMacro.cmake. The documentation for /include
is here:

http_nospam_msdn.microsoft.com/en-us/library/2s3hwbhs(v=vs.100).aspx

What to do about the last unresolved symbols?

Kalle Rutanen

krutanen
Posts: 14
Joined: 01 May 2013, 08:18

Re: Build BCI2000 in Visual Studio 2010

Post by krutanen » 08 May 2013, 15:08

Hi,

Just to add that the problems with Qt can be solved, instead of modifying the UseQt4.cmake file, by installing Qt from

http_nospam_qt-project.org/downloads

and then in /build/cmake/FindQt.cmake

replacing the line

SET( USE_STD_QT FALSE )

with

SET( USE_STD_QT TRUE )

But we are still unable to get rid of the linker problems with *Registry symbols.

mellinger
Posts: 1163
Joined: 12 Feb 2003, 11:06

Re: Build BCI2000 in Visual Studio 2010

Post by mellinger » 14 May 2013, 15:08

Hi,

thank you for reporting these problems. VS2010 compilation has been fixed.

Regards,
Juergen

krutanen
Posts: 14
Joined: 01 May 2013, 08:18

Re: Build BCI2000 in Visual Studio 2010

Post by krutanen » 15 May 2013, 07:10

Hi,

I updated to the newest version of BCI2000 source in the SVN repository. Unfortunately the unresolved external symbols, e.g. SigProcRegistry, still occur. Can this be because we are using the Express version of Visual Studio 2010?

Kalle

mellinger
Posts: 1163
Joined: 12 Feb 2003, 11:06

Re: Build BCI2000 in Visual Studio 2010

Post by mellinger » 15 May 2013, 08:47

Hi,

I'm working with the Express version of VS2010 as well, without getting linker errors.
Such linker errors may occur if CMake is run for a 64-bit configuration, and projects created that way are then compiled for a 32-bit target.

AFAIK, VS2010 Express only provides a 32-bit compiler. Could it be that it automatically converted project files originally created for a 64-bit target?

Regards,
Juergen

krutanen
Posts: 14
Joined: 01 May 2013, 08:18

Re: Build BCI2000 in Visual Studio 2010

Post by krutanen » 15 May 2013, 09:42

Hi,

I tried VS2010 Professional as well, but had the same errors. The Express and Professional are both with Service Pack 1; do you also have Service Pack 1 installed? What I do is to first delete CMakeCache.txt, and then run "Make VS10 project files.bat". In the questions I answer all with "y", except the last one with "n" if I am using Express. After CMake has generated the project files, I open BCI2000.sln, and then choose to build that. I am using Windows 7, so a 64-bit operating system. Could CMake run differently based on the OS it is run on (so that the native choice is made => 64-bit)? Which operating system are you using?

Kalle

mellinger
Posts: 1163
Joined: 12 Feb 2003, 11:06

Re: Build BCI2000 in Visual Studio 2010

Post by mellinger » 15 May 2013, 09:53

Hi,

you should make sure to revert all your changes to the BCI2000 source code, update to the latest SVN version, and delete all CMake-generated directories from your BCI2000/build directory, in addition to deleting CMakeCache.txt, before trying again.

It might be easier to do a fresh checkout of BCI2000 into an empty directory.

Regards,
Juergen

krutanen
Posts: 14
Joined: 01 May 2013, 08:18

Re: Build BCI2000 in Visual Studio 2010

Post by krutanen » 15 May 2013, 11:04

Hi,

I did a checkout to an empty new directory. Everything now builds ok, except for one project. But even this project builds after using an external Qt library. It builds in both debug and release modes. So problem solved:) Thank you.

Now to diagnose the cause of the linker errors, if you will. The source-code revisions in the working build-tree and the broken build-tree are exactly the same (I have no modifications in the broken build-tree source). So this got me suspecting that the problem has something to do with caching at some level of the build system, either in CMake, or in Visual Studio. To test this, I deleted the CMakeFiles/ directory and the CMakeCache.txt in the broken build-tree. After running CMake, the build succeeds on the generated Visual Studio solution. Perhaps this helps you to diagnose the problem further, if it occurs in the future.

Kalle

krutanen
Posts: 14
Joined: 01 May 2013, 08:18

Re: Build BCI2000 in Visual Studio 2010

Post by krutanen » 15 May 2013, 11:11

Hi,

I should also mention that choosing "Clean solution" or "Rebuild solution" in Visual Studio did not fix the problem. This may simplify the diagnosis a bit.

Kalle

mellinger
Posts: 1163
Joined: 12 Feb 2003, 11:06

Re: Build BCI2000 in Visual Studio 2010

Post by mellinger » 15 May 2013, 11:19

Thanks for giving the details. It seems that CMake stores compiler information in the build/CMakeFiles directory, and does not re-create that when CMakeCache.txt is deleted.

So the general advice is to always delete build/CMakeFiles together with build/CMakeCache.txt, unless one is absolutely sure that the compiler has not changed (e.g. by installing an update).

--Juergen

krutanen
Posts: 14
Joined: 01 May 2013, 08:18

Re: Build BCI2000 in Visual Studio 2010

Post by krutanen » 15 May 2013, 12:50

I agree; that might be the possible cause. I first built it with Visual Studio 2010 Express without the SP1, so CMake created some information about the compiler at this point. After seeing errors which are related to that update, I updated the compiler to SP1, and tried to build again. And here I had the unresolved external symbols. Perhaps I'll test this theory tomorrow by reinstalling Visual Studio.

krutanen
Posts: 14
Joined: 01 May 2013, 08:18

Re: Build BCI2000 in Visual Studio 2010

Post by krutanen » 16 May 2013, 09:44

I went ahead to uninstall Visual Studio 2010, and the SP1, and then reinstall it. Unfortunately, this triggered an installation bug in Visual Studio 2010, which almost ruined everything (it prevents Visual Studio 2010 and 2012 from compiling anything):

http_nospam_stackoverflow.com/questions/12460307/installation-of-visual-studio-2010-any-edition-installs-only-2-files-in-the-c

Fortunately, I was able to solve this problem; the solution is at the bottom of the above link. Anyway, because of fighting with this bug I was demotivated enough to not try to reproduce the problem with CMake. But perhaps I'll now concentrate to be happy with a working build of BCI2000. Thanks again for your help.

mellinger
Posts: 1163
Joined: 12 Feb 2003, 11:06

Re: Build BCI2000 in Visual Studio 2010

Post by mellinger » 16 May 2013, 11:55

Sure, but thanks for trying anyway!

--Juergen

gerardo_c_
Posts: 2
Joined: 04 Jul 2013, 00:12

Re: Build BCI2000 in Visual Studio 2010

Post by gerardo_c_ » 04 Jul 2013, 00:32

Hi. I am trying to build BCI2000 with MinGw but i have a lot of error in CMake. I have installed Qt but it seem that cmake can't find some Qt libraries. I tryied to follow some of your recomendations but:

My file /build/cmake/FindQt.cmake doesn't have the command SET( USE_STD_QT FALSE ), thus i can't replace it for
SET( USE_STD_QT TRUE )

In build/cmake/UseQt4.cmake, i have replaced SET ( QT_LIBRARIES "" ) with SET(QT_LIBRARIES
"Ws2_32.lib"
"Imm32.lib"
"comsuppw.lib"
"winmm.lib")

Cmake shows this errors:

The C compiler identification is GNU 4.8.0
The CXX compiler identification is GNU 4.8.0
Check for working C compiler: C:/Qt/Qt5.1.0/Tools/mingw48_32/bin/gcc.exe
Check for working C compiler: C:/Qt/Qt5.1.0/Tools/mingw48_32/bin/gcc.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler: C:/Qt/Qt5.1.0/Tools/mingw48_32/bin/g++.exe
Check for working CXX compiler: C:/Qt/Qt5.1.0/Tools/mingw48_32/bin/g++.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
CMake Warning at C:/Archivos de programa/CMake 2.8/share/cmake-2.8/Modules/FindQt4.cmake:657 (message):
C:/Qt/Qt5.1.0/5.1.0/mingw48_32/bin/qmake.exe reported QT_INSTALL_LIBS as
"C:/Qt/Qt5.1.0//5.1.0/mingw48_32/lib" but QtCore could not be found there.
Qt is NOT installed correctly for the target build environment.
Call Stack (most recent call first):
cmake/FindQt.cmake:150 (FIND_PACKAGE)
cmake/Utils.cmake:88 (INCLUDE)
CMakeLists.txt:22 (UTILS_INCLUDE)


CMake Error at C:/Archivos de programa/CMake 2.8/share/cmake-2.8/Modules/FindQt4.cmake:1032 (set_property):
set_property could not find TARGET Qt4::QtCore. Perhaps it has not yet
been created.
Call Stack (most recent call first):
cmake/FindQt.cmake:150 (FIND_PACKAGE)
cmake/Utils.cmake:88 (INCLUDE)
CMakeLists.txt:22 (UTILS_INCLUDE)


CMake Error at C:/Archivos de programa/CMake 2.8/share/cmake-2.8/Modules/FindQt4.cmake:1037 (set_property):
set_property could not find TARGET Qt4::QtCore. Perhaps it has not yet
been created.
Call Stack (most recent call first):
cmake/FindQt.cmake:150 (FIND_PACKAGE)
cmake/Utils.cmake:88 (INCLUDE)
CMakeLists.txt:22 (UTILS_INCLUDE)


CMake Error at C:/Archivos de programa/CMake 2.8/share/cmake-2.8/Modules/FindQt4.cmake:1040 (set_property):
set_property could not find TARGET Qt4::QtCore. Perhaps it has not yet
been created.
Call Stack (most recent call first):
cmake/FindQt.cmake:150 (FIND_PACKAGE)
cmake/Utils.cmake:88 (INCLUDE)
CMakeLists.txt:22 (UTILS_INCLUDE)


CMake Error at C:/Archivos de programa/CMake 2.8/share/cmake-2.8/Modules/FindQt4.cmake:1121 (set_property):
set_property could not find TARGET Qt4::QtCore. Perhaps it has not yet
been created.
Call Stack (most recent call first):
cmake/FindQt.cmake:150 (FIND_PACKAGE)
cmake/Utils.cmake:88 (INCLUDE)
CMakeLists.txt:22 (UTILS_INCLUDE)


Found unsuitable Qt version "5.1.0" from C:/Qt/Qt5.1.0/5.1.0/mingw48_32/bin/qmake.exe
Your gcc version is 4.8.0
Configuring project BCI2000 Version 3.05
Including custom extension DataGloveLogger ---- (to disable, set EXTENSIONS_DATAGLOVELOGGER to OFF)
Including custom extension WebcamLogger ---- (to disable, set EXTENSIONS_WEBCAMLOGGER to OFF)
Including custom extension EyetrackerLogger ---- (to disable, set EXTENSIONS_EYETRACKERLOGGER to OFF)
Including custom extension WiimoteLogger ---- (to disable, set EXTENSIONS_WIIMOTELOGGER to OFF)
**** WiimoteLogger failed: hid and setupapi libraries are not found for this platform/compiler
Including custom extension GazeMonitorFilter ---- (to disable, set EXTENSIONS_GAZEMONITORFILTER to OFF)
Including custom extension AudioExtension ---- (to disable, set EXTENSIONS_AUDIOEXTENSION to OFF)
CMake Error at cmake/Utils.cmake:156 (UTILS_IS_INCLUDED):
UTILS_IS_INCLUDED Function invoked with incorrect arguments for function
named: UTILS_IS_INCLUDED
Call Stack (most recent call first):
cmake/AddTargetMacro.cmake:82 (UTILS_AUTOMOC)
cmake/frameworks/CoreLib/CMakeLists.txt:22 (BCI2000_ADD_TARGET)


Target #1: BCI2000FrameworkCore (Framework library, STATIC_LIBRARY)
CMake Error at cmake/Utils.cmake:156 (UTILS_IS_INCLUDED):
UTILS_IS_INCLUDED Function invoked with incorrect arguments for function
named: UTILS_IS_INCLUDED
Call Stack (most recent call first):
cmake/AddTargetMacro.cmake:82 (UTILS_AUTOMOC)
cmake/frameworks/SigSrcModuleLib/CMakeLists.txt:51 (BCI2000_ADD_TARGET)


Target #2: BCI2000FrameworkSigSrcModule (Framework library, STATIC_LIBRARY)
CMake Error at cmake/Utils.cmake:156 (UTILS_IS_INCLUDED):
UTILS_IS_INCLUDED Function invoked with incorrect arguments for function
named: UTILS_IS_INCLUDED
Call Stack (most recent call first):
cmake/AddTargetMacro.cmake:82 (UTILS_AUTOMOC)
cmake/frameworks/SigProcModuleLib/CMakeLists.txt:43 (BCI2000_ADD_TARGET)


Target #3: BCI2000FrameworkSigProcModule (Framework library, STATIC_LIBRARY)
Qt QTOPENGL library not found.
Qt QTGUI library not found.
Qt QTCORE library not found.
Qt QTOPENGL library not found.
Qt QTGUI library not found.
Qt QTCORE library not found.
Qt QTOPENGL library not found.
Qt QTGUI library not found.
Qt QTCORE library not found.
CMake Error at cmake/Utils.cmake:156 (UTILS_IS_INCLUDED):
UTILS_IS_INCLUDED Function invoked with incorrect arguments for function
named: UTILS_IS_INCLUDED
Call Stack (most recent call first):
cmake/AddTargetMacro.cmake:82 (UTILS_AUTOMOC)
cmake/frameworks/AppModuleLib/CMakeLists.txt:80 (BCI2000_ADD_TARGET)


Qt QTOPENGL library not found.
Qt QTGUI library not found.
Qt QTCORE library not found.
Target #4: BCI2000FrameworkAppModule (Framework library, STATIC_LIBRARY)
CMake Error at cmake/Utils.cmake:156 (UTILS_IS_INCLUDED):
UTILS_IS_INCLUDED Function invoked with incorrect arguments for function
named: UTILS_IS_INCLUDED
Call Stack (most recent call first):
cmake/AddTargetMacro.cmake:82 (UTILS_AUTOMOC)
buildutils/BootstrapCustomProjects/CMakeLists.txt:14 (BCI2000_ADD_TARGET)


Target #5: NewBCI2000Module (Custom bootstrapping tool, EXECUTABLE)
CMake Error at cmake/Utils.cmake:156 (UTILS_IS_INCLUDED):
UTILS_IS_INCLUDED Function invoked with incorrect arguments for function
named: UTILS_IS_INCLUDED
Call Stack (most recent call first):
cmake/AddTargetMacro.cmake:82 (UTILS_AUTOMOC)
buildutils/BootstrapCustomProjects/CMakeLists.txt:14 (BCI2000_ADD_TARGET)


Target #6: NewBCI2000Filter (Custom bootstrapping tool, EXECUTABLE)
CMake Error at cmake/Utils.cmake:156 (UTILS_IS_INCLUDED):
UTILS_IS_INCLUDED Function invoked with incorrect arguments for function
named: UTILS_IS_INCLUDED
Call Stack (most recent call first):
cmake/AddTargetMacro.cmake:82 (UTILS_AUTOMOC)
buildutils/BootstrapCustomProjects/CMakeLists.txt:14 (BCI2000_ADD_TARGET)


Target #7: NewBCI2000FilterTool (Custom bootstrapping tool, EXECUTABLE)
CMake Error at cmake/Utils.cmake:156 (UTILS_IS_INCLUDED):
UTILS_IS_INCLUDED Function invoked with incorrect arguments for function
named: UTILS_IS_INCLUDED
Call Stack (most recent call first):
cmake/AddTargetMacro.cmake:82 (UTILS_AUTOMOC)
buildutils/CMakeLists.txt:17 (BCI2000_ADD_TARGET)


...

I only want to compile BCI2000 in order to have the new ENOBIO3G working, because i am working with 20 channels and the binary supported by BCI2000 webpage desn't provide this executable. Please, can you help me to set up the Enobio (20 channels) in BCI2000? i want to work in Windows 7 (64 bits), but i am trying first in windows xp.

Gerardo

mellinger
Posts: 1163
Joined: 12 Feb 2003, 11:06

Re: Build BCI2000 in Visual Studio 2010

Post by mellinger » 04 Jul 2013, 07:41

Hi,

there have been some changes to the CMake system in the meantime. There is no USE_STD_QT any more -- instead, cmake will try to detect whether there is a BCI2000-precompiled version of Qt available for your platform/compiler, and will try to detect an external installation of Qt if this is not the case.
CMake Warning at C:/Archivos de programa/CMake 2.8/share/cmake-2.8/Modules/FindQt4.cmake:657 (message):
C:/Qt/Qt5.1.0/5.1.0/mingw48_32/bin/qmake.exe reported QT_INSTALL_LIBS as
"C:/Qt/Qt5.1.0//5.1.0/mingw48_32/lib" but QtCore could not be found there.
Qt is NOT installed correctly for the target build environment.
This suggests that you have the Qt source code installed on your machine, but not built Qt yet, or something is wrong with your Qt installation.

Regards,
Juergen

Locked

Who is online

Users browsing this forum: No registered users and 2 guests