List of Linux compilation issues and workarounds

Forum for software developers to discuss BCI2000 software development
Locked
trevora
Posts: 10
Joined: 29 Apr 2014, 20:13

List of Linux compilation issues and workarounds

Post by trevora » 29 Apr 2014, 21:33

# Compiling Issues in Linux with BCI2000 #

The following is a list of errors found when trying to build BCI2000 using the quickstart instructions in the wiki. For each error I have applied a possible workaround, but it would be best if someone more familiar with the project took a good look. Each of the workarounds fixes the same error across every package that throws it--related packages threw related errors (New Launcher and New Module, for example, are fixed by the same workaround).

Apologies for the non-English locale.

## Environment ##
- Linux kernel 3.8.0-35 generic
- Ubuntu 12.10 'quantal'
- amd64 architecture
- bci2000 source revision: 4720 trunk

## Errors by Target ##

### OperatorLib ###

#### Issue ####

/BCI2000/src/core/Operator/OperatorLib/TelnetServer.cpp: メンバ関数 ‘TelnetServer& TelnetServer::WriteHello()’ 内:
/BCI2000/src/core/Operator/OperatorLib/TelnetServer.cpp:207:3: エラー: ‘::gethostname’ has not been declared

#### Fix ####

As per <http_nospam_sourceforge.net/p/qjackctl/tickets/11/>, add `#include <unistd.h>` to `TelnetServer.h`.


### BCI2000Launcher ###

#### Issue ####

In file included from /BCI2000/build/../src/shared/types/SignalProperties.h:34:0,
from BCI2000/build/../src/shared/types/GenericSignal.h:33,
from BCI2000/src/shared/modules/MessageHandler.cpp:38:
BCI2000/build/../src/shared/types/ValueList.h: In instantiation of ‘std::istream& ValueList<T>::ReadFromStream(std::istream&) [with T = RGBColor; std::istream = std::basic_istream<char>]’:
BCI2000/build/../src/shared/types/Color.h:166:30: required from here
BCI2000/build/../src/shared/types/ValueList.h:58:5: エラー: ‘push_back’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
BCI2000/build/../src/shared/types/ValueList.h:58:5: 備考: declarations in dependent base ‘std::vector<RGBColor, std::allocator<RGBColor> >’ are not found by unqualified lookup
BCI2000/build/../src/shared/types/ValueList.h:58:5: 備考: use ‘this->push_back’ instead

#### Fix ####

As suggested by the above compiler error, prefix `this->` to `push_back` in `ValueList.h`.

### NewBCI2000Module ###

#### Issue ####


BCI2000/build/buildutils/BootstrapCustomProjects/BootstrapCustomProjects.cpp: 関数 ‘std::string GetCWD()’ 内:
BCI2000/build/buildutils/BootstrapCustomProjects/BootstrapCustomProjects.cpp:98:20: エラー: ‘::getcwd’ has not been declared
BCI2000/build/buildutils/BootstrapCustomProjects/BootstrapCustomProjects.cpp: 関数 ‘std::string RealPath(std::string)’ 内:
BCI2000/build/buildutils/BootstrapCustomProjects/BootstrapCustomProjects.cpp:146:12: エラー: ‘::chdir’ has not been declared
BCI2000/build/buildutils/BootstrapCustomProjects/BootstrapCustomProjects.cpp:148:22: エラー: ‘chdir’ was not declared in this scope
make[3]: *** [buildtesting/BootstrapCustomProjects/CMakeFiles/NewBCI2000Module.dir/BootstrapCustomProjects.cpp.o] エラー 1

#### Fix ####

Following the answer given here, <http_nospam_stackoverflow.com/questions/13340270/chdir-not-declared-compilation-error-g> add `#include <unistd.h>` to `BootstrapCustomProjects.h`.

### P300Classifier ###

This one was just a warning, and the project continued to build.

#### Issue ####

[ 78%] Building CXX object core/Tools/P300Classifier/CMakeFiles/P300Classifier.dir/CDataFile.cpp.o
BCI2000/src/core/Tools/P300Classifier/CDataFile.cpp: 関数 ‘void Report(e_DebugLevel, const char*, ...)’ 内:
BCI2000/src/core/Tools/P300Classifier/CDataFile.cpp:828:22: 警告: 書式が文字列リテラルでは無く、かつ書式引数ではありません [-Wformat-security]
[ 78%] Building CXX object core/Tools/P300Classifier/CMakeFiles/P300Classifier.dir/Check_Consistency_Files.cpp.o
BCI2000/src/core/Tools/P300Classifier/Check_Consistency_Files.cpp: 関数 ‘int Check_Consistency_Files(std::vector<std::basic_string<char> >, long long int&, int&)’ 内:
BCI2000/src/core/Tools/P300Classifier/Check_Consistency_Files.cpp:46:35: 警告: 書式が文字列リテラルでは無く、かつ書式引数ではありません [-Wformat-security]

### Load3DS ###

This target also only output warnings without errors.

#### Issue ####

[ 21%] Building CXX object frameworks/AppModuleLib/CMakeFiles/BCI2000FrameworkAppModule.dirBCI2000/src/extlib/3DAPI/Load3DS.cpp.o
BCI2000/src/extlib/3DAPI/Load3DS.cpp: メンバ関数 ‘int CLoad3DS::GetString(char*)’ 内:
BCI2000/src/extlib/3DAPI/Load3DS.cpp:595:37: 警告: warn_unused_result 属性付きで宣言されている ‘size_t fread(void*, size_t, size_t, FILE*)’ の戻り値を無視しています [-Wunused-result]
BCI2000/src/extlib/3DAPI/Load3DS.cpp:601:46: 警告: warn_unused_result 属性付きで宣言されている ‘size_t fread(void*, size_t, size_t, FILE*)’ の戻り値を無視しています [-Wunused-result]

### FieldTripBufferSource ###

Again, warnings only.

#### Issue ####

[ 82%] Building C object contrib/SignalSource/FieldTripBufferSource/CMakeFiles/FieldTripBufferSource.dirBCI2000/src/extlib/fieldtrip/buffer/src/tcprequest.c.o
BCI2000/src/extlib/fieldtrip/buffer/src/tcprequest.c: 関数 ‘tcprequest’ 内:
BCI2000/src/extlib/fieldtrip/buffer/src/tcprequest.c:59:4: 警告: 書式 ‘%d’ は引数の型が ‘int’ であると予期されますが、第 4 引数の型は ‘long unsigned int’ です [-Wformat]
BCI2000/src/extlib/fieldtrip/buffer/src/tcprequest.c:72:3: 警告: 書式 ‘%d’ は引数の型が ‘int’ であると予期されますが、第 4 引数の型は ‘long unsigned int’ です [-Wformat]
[ 82%] Building C object contrib/SignalSource/FieldTripBufferSource/CMakeFiles/FieldTripBufferSource.dirBCI2000/src/extlib/fieldtrip/buffer/src/tcpserver.c.o
BCI2000/src/extlib/fieldtrip/buffer/src/tcpserver.c: 関数 ‘tcpserver’ 内:
BCI2000/src/extlib/fieldtrip/buffer/src/tcpserver.c:244:47: 警告: 異なるサイズの整数からポインタへのキャストです [-Wint-to-pointer-cast]
[ 82%] Building C object contrib/SignalSource/FieldTripBufferSource/CMakeFiles/FieldTripBufferSource.dirBCI2000/src/extlib/fieldtrip/buffer/src/tcpsocket.c.o
BCI2000/src/extlib/fieldtrip/buffer/src/tcpsocket.c: 関数 ‘tcpsocket’ 内:
BCI2000/src/extlib/fieldtrip/buffer/src/tcpsocket.c:70:11: 警告: ポインタから異なるサイズの整数へのキャストです [-Wpointer-to-int-cast]
BCI2000/src/extlib/fieldtrip/buffer/src/tcpsocket.c:123:4: 警告: 書式 ‘%d’ は引数の型が ‘int’ であると予期されますが、第 4 引数の型は ‘long unsigned int’ です [-Wformat]
BCI2000/src/extlib/fieldtrip/buffer/src/tcpsocket.c:189:5: 警告: 書式 ‘%d’ は引数の型が ‘int’ であると予期されますが、第 4 引数の型は ‘long unsigned int’ です [-Wformat]
[ 82%] Building C object contrib/SignalSource/FieldTripBufferSource/CMakeFiles/FieldTripBufferSource.dir BCI2000/src/extlib/fieldtrip/buffer/src/util.c.o

### PyffApplication ###

#### Issue ####


[ 53%] Built target BCI2000FrameworkCore
[ 60%] Built target extract_registry
[100%] Built target BCI2000FrameworkAppModule
Linking CXX executable /BCI2000/prog/PyffApplication
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o: In function `PyffFilter::ConvertLabelIndexToPyList(LabelIndex) const':
PyffFilter.cpp:(.text+0x47f): undefined reference to `PyString_FromString'
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o: In function `PyffFilter::ConvertPyListToLabelIndex(_object*, LabelIndex&) const':
PyffFilter.cpp:(.text+0x517): undefined reference to `PyString_AsString'
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o: In function `PyffFilter::ConvertPhysicalUnitToPyDict(PhysicalUnit) const':
PyffFilter.cpp:(.text+0x614): undefined reference to `PyString_FromString'
PyffFilter.cpp:(.text+0x63b): undefined reference to `PyString_FromString'
PyffFilter.cpp:(.text+0x652): undefined reference to `PyString_FromString'
PyffFilter.cpp:(.text+0x661): undefined reference to `PyString_FromString'
PyffFilter.cpp:(.text+0x688): undefined reference to `PyString_FromString'
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o:PyffFilter.cpp:(.text+0x6af): more undefined references to `PyString_FromString' follow
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o: In function `PyffFilter::ConvertPyDictToPhysicalUnit(_object*, PhysicalUnit&) const':
PyffFilter.cpp:(.text+0x729): undefined reference to `PyString_AsString'
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o: In function `PyffFilter::ConvertPyObjectToProperties(_object*, SignalProperties&) const':
PyffFilter.cpp:(.text+0x80b): undefined reference to `PyString_AsString'
PyffFilter.cpp:(.text+0x87c): undefined reference to `PyString_AsString'
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o: In function `PyffFilter::HandlePythonError(std::string, bool) const':
PyffFilter.cpp:(.text+0x1254): undefined reference to `PyInt_AsLong'
PyffFilter.cpp:(.text+0x12a9): undefined reference to `PyString_AsString'
PyffFilter.cpp:(.text+0x12dc): undefined reference to `PyInt_AsLong'
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o: In function `PyffFilter::CallHook(char const*, _object*, _object*) const':
PyffFilter.cpp:(.text+0x1683): undefined reference to `PyString_FromString'
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o: In function `PyffFilter::CallMethod(char const*, _object*, _object*, _object*) const':
PyffFilter.cpp:(.text+0x1bc0): undefined reference to `PyString_FromString'
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o: In function `PyffFilter::SendStatePrecisionsToPython() const':
PyffFilter.cpp:(.text+0x1d44): undefined reference to `PyInt_FromLong'
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o: In function `PyffFilter::SendStatesToPython() const':
PyffFilter.cpp:(.text+0x1ebc): undefined reference to `PyInt_FromLong'
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o: In function `PyffFilter::ReceiveParametersFromPython()':
PyffFilter.cpp:(.text+0x2c03): undefined reference to `PyString_AsString'
PyffFilter.cpp:(.text+0x2d21): undefined reference to `PyString_AsString'
PyffFilter.cpp:(.text+0x317f): undefined reference to `PyString_AsString'
PyffFilter.cpp:(.text+0x3244): undefined reference to `PyString_Size'
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o: In function `PyffFilter::ConvertPropertiesToPyObject(SignalProperties const&) const':
PyffFilter.cpp:(.text+0x3cd4): undefined reference to `PyString_FromString'
PyffFilter.cpp:(.text+0x3ce3): undefined reference to `PyString_FromString'
PyffFilter.cpp:(.text+0x3d05): undefined reference to `PyString_FromString'
PyffFilter.cpp:(.text+0x3d14): undefined reference to `PyString_FromString'
PyffFilter.cpp:(.text+0x3dd2): undefined reference to `PyString_FromString'
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o:PyffFilter.cpp:(.text+0x3eed): more undefined references to `PyString_FromString' follow
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o: In function `PyffFilter::Preflight(SignalProperties const&, SignalProperties&) const':
PyffFilter.cpp:(.text+0x51c7): undefined reference to `PyString_AsString'
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o: In function `PyffFilter::ReceiveStatesFromPython() const':
PyffFilter.cpp:(.text+0x5469): undefined reference to `PyInt_AsLong'
CMakeFiles/PyffApplication.dir/PyffFilter.cpp.o: In function `PyffFilter::PyffFilter()':
PyffFilter.cpp:(.text+0x7015): undefined reference to `PyString_FromString'
PyffFilter.cpp:(.text+0x7051): undefined reference to `PyString_FromString'
PyffFilter.cpp:(.text+0x7092): undefined reference to `PyString_FromString'
PyffFilter.cpp:(.text+0x70a2): undefined reference to `PyString_FromString'
PyffFilter.cpp:(.text+0x71f0): undefined reference to `PyString_AsString'
PyffFilter.cpp:(.text+0x7313): undefined reference to `PyString_AsString'
collect2: error: ld returned 1 exit status
make[3]: *** [/BCI2000/prog/PyffApplication] Error 1
make[2]: *** [contrib/ExternalLinks/PyffApplication/CMakeFiles/PyffApplication.dir/all] Error 2
make[1]: *** [contrib/ExternalLinks/PyffApplication/CMakeFiles/PyffApplication.dir/rule] Error 2
make: *** [PyffApplication] Error 2

### Fix ###

I am stumped on this one. None of the fixes I found by searching the internet seem to apply.
Last edited by trevora on 30 Apr 2014, 20:54, edited 2 times in total.

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: List of Linux compilation issues and workarounds

Post by boulay » 30 Apr 2014, 10:46

I am not on the core development team, but nevertheless thank you for your report.
Do you mind editing your previous post to include which revision of the source code you were using?

By the way, if you do not plan to use Pyff then you do not need to include it in your build. Do you plan to use it?

trevora
Posts: 10
Joined: 29 Apr 2014, 20:13

Re: List of Linux compilation issues and workarounds

Post by trevora » 30 Apr 2014, 20:48

Revision number added.

At the moment I am only planning to use bci2000 for viewing and converting data (for which I have a possible problem: http://www.bci2000.org/phpbb/viewtopic.php?f=1&t=2422), but I wanted to do a linux audit by building everything since I have the spare CPU time.

If I can get enough feedback, I would like to build everything just to prove it is possible and then document what was needed.

trevora
Posts: 10
Joined: 29 Apr 2014, 20:13

Re: List of Linux compilation issues and workarounds

Post by trevora » 12 Jun 2014, 06:07

More issues found with the same revision, under the following G++ compiler:

Code: Select all

g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2

[  0%] Building CXX object CMakeFiles/frameworks/CoreLib/CMakeFiles/BCI2000FrameworkCore.dir/home/soba/Academic/BCI2000svn/bci2000/src/shared/filters/GenericFilter.cpp.o
In file included from /home/soba/Academic/BCI2000svn/bci2000/src/shared/types/SignalProperties.h:33:0,
                 from /home/soba/Academic/BCI2000svn/bci2000/src/shared/utils/MeasurementUnits.h:30,
                 from /home/soba/Academic/BCI2000svn/bci2000/src/shared/accessors/ParamRef.h:36,
                 from /home/soba/Academic/BCI2000svn/bci2000/src/shared/accessors/Environment.h:41,
                 from /home/soba/Academic/BCI2000svn/bci2000/src/shared/filters/GenericFilter.h:34,
                 from /home/soba/Academic/BCI2000svn/bci2000/src/shared/filters/GenericFilter.cpp:29:
/home/soba/Academic/BCI2000svn/bci2000/src/shared/types/ValueList.h: In member function ‘int ValueList<T>::Size() const’:
/home/soba/Academic/BCI2000svn/bci2000/src/shared/types/ValueList.h:37:54: error: there are no arguments to ‘size’ that depend on a template parameter, so a declaration of ‘size’ must be available [-fpermissive]
     int Size() const { return static_cast<int>( size() ); }
                                                      ^
/home/soba/Academic/BCI2000svn/bci2000/src/shared/types/ValueList.h:37:54: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/home/soba/Academic/BCI2000svn/bci2000/src/shared/types/ValueList.h: In member function ‘bool ValueList<T>::Empty() const’:
/home/soba/Academic/BCI2000svn/bci2000/src/shared/types/ValueList.h:38:39: error: there are no arguments to ‘empty’ that depend on a template parameter, so a declaration of ‘empty’ must be available [-fpermissive]
     bool Empty() const { return empty(); }
The fix for this is to prepend

Code: Select all

this->
to the return values, so that the membership is specifically defined:

Code: Select all

int Size() const { return static_cast<int>( this->size() ); }

trevora
Posts: 10
Joined: 29 Apr 2014, 20:13

Re: List of Linux compilation issues and workarounds

Post by trevora » 12 Jun 2014, 06:19

Typedef confusion:

Code: Select all

In file included from /home/soba/Academic/BCI2000svn/bci2000/src/shared/bcistream/BCIError.h:31:0,
                 from /home/soba/Academic/BCI2000svn/bci2000/src/shared/accessors/Environment.h:45,
                 from /home/soba/Academic/BCI2000svn/bci2000/src/shared/filters/GenericFilter.h:34,
                 from /home/soba/Academic/BCI2000svn/bci2000/src/shared/filters/GenericFilter.cpp:29:
/home/soba/Academic/BCI2000svn/bci2000/src/shared/bcistream/BCIStream.h:229:25: error: declaration of ‘void (* BCIStream::Dispatcher::Action() const)(const string&)’ [-fpermissive]
       { return mAction; }
                         ^
/home/soba/Academic/BCI2000svn/bci2000/src/shared/bcistream/BCIStream.h:86:18: error: changes meaning of ‘Action’ from ‘typedef void (* BCIStream::Action)(const string&)’ [-fpermissive]
   typedef void (*Action)( const std::string& );
According to stackoverflow.com/questions/12187549/typedef-changes-meaning the standard requires that the type be explicitly specified so that the compiler knows which definition to look for, but I haven't been able to make it work.

trevora
Posts: 10
Joined: 29 Apr 2014, 20:13

Re: List of Linux compilation issues and workarounds

Post by trevora » 23 Jul 2014, 02:19

## Environment ##
- Linux kernel 3.13.0-32 generic
- Ubuntu 14.10
- amd64 architecture
- bci2000 source revision: 4731 trunk


Issue: cmake cannot find Qt5 install

CMake Warning at /usr/lib/x86_64-linux-gnu/cmake/Qt5Core/Qt5CoreMacros.cmake:273 (find_package):
Could not find a package configuration file provided by "Qt5GUI" with any
of the following names:

Qt5GUIConfig.cmake
qt5gui-config.cmake

Add the installation prefix of "Qt5GUI" to CMAKE_PREFIX_PATH or set
"Qt5GUI_DIR" to a directory containing one of the above files. If "Qt5GUI"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
cmake/AddTargetMacro.cmake:165 (QT5_USE_MODULES)
cmake/frameworks/AppModuleLib/CMakeLists.txt:80 (BCI2000_ADD_TARGET)

Workaround: set the Qt5GUI_DIR variable *not* to any Qt base directories, but the below equivalent for your Linux flavor:

"/usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/"

This will not work if your Qt5 install has different capitalization (POSIX OSes like Linux/OSX are case sensitive), so you will also need to perform something like the following in that directory:

ln -s Qt5GUIConfig.cmake Qt5GUIConfig.cmake

This applies for all related errors (Qt5Multimedia_DIR, etc.).

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: List of Linux compilation issues and workarounds

Post by boulay » 23 Jul 2014, 07:40

Could you achieve the same result by modifying the BCI2000/build/cmake/FindQT.cmake ??

cdocon
Posts: 8
Joined: 26 Jun 2014, 19:31

Re: List of Linux compilation issues and workarounds

Post by cdocon » 25 Jul 2014, 00:58

#### Environment ####
- Linux kernel 3.13.0-32-generic
- Ubuntu 14.04
- amd64 architecture
- bci2000 source revision: 4736

#### Issue ####

Code: Select all

../../../frameworks/CoreLib/libBCI2000FrameworkCore.a(GenericVisualization.cpp.o): In function `GenericVisualization::Send(GenericSignal const&)':
GenericVisualization.cpp:(.text+0x1c55): undefined reference to `std::ostream& MessageHandler::PutMessage<VisSignal>(std::ostream&, VisSignal const&)'
#### Fix ####

To MessageHandler.cpp, add at the bottom:

Code: Select all

template ostream& MessageHandler::PutMessage( std::ostream&, const VisSignal& );

Locked

Who is online

Users browsing this forum: Bing [Bot] and 1 guest