I am developing a Qt application on Ubuntu 17.04. I was previously using the latest Qt version (Qt 5.12.2) but I had to go back a few versions to Qt 5.8.
I was able to compile with using Qt 5.12 with no issues but with Qt 5.8 I get the following errors all related to std::chrono:
In file included from /opt/Qt5.8.0/5.8/gcc_64/include/QtCore>/qmutex.h:48:0,
from /opt/Qt5.8.0/5.8/gcc_64/include/QtCore/QMutex:1,
...
/usr/include/c++/6/chrono:221:6: error: macro "max" requires 2 arguments, but only 1 given
max()
^
^
/usr/include/c++/6/chrono:225:6: error: macro "min" requires 2 arguments, but only 1 given
min()
^
^~~~~~
/usr/include/c++/6/chrono:222:4: error: expected ‘}’ before ‘return’
/usr/include/c++/6/chrono:222:4: error: function definition does not declare parameters
/usr/include/c++/6/chrono:224:2: error: a storage class can only be specified for objects and functions
static constexpr _Rep
^~~~~~
/usr/include/c++/6/chrono:224:19: error: expected ‘;’ before ‘_Rep’
static constexpr _Rep
^~~~
etc
Any ideas on how to resolve this issue.
Is this a g++ version or a libstdc++ version issue?
Here is my g++ version:
$ g++ --version
g++ (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If so, if any advice on what to purge/remove and apt-get install would be helpful.
Related
I'm having this error when trying to install ggiraph in R (RStudio Server on an linux based AWS instance, new RStudio and R versions).
Can't find any advice anywhere for linux systems (only for OS X).
Did anybody encounter the same problem and how did you solve it?
Thank you!
Error message:
dsvg.cpp: In function ‘std::string compile_css(const string&, const char*, const string&, const char*, const char*, const char*)’:
dsvg.cpp:725:46: error: no matching function for call to ‘regex_replace(const char*&, std::regex&, std::string&)’
return std::regex_replace(css, pattern, cls);
^
dsvg.cpp:725:46: note: candidates are:
In file included from /usr/include/c++/4.8.2/regex:62:0,
from dsvg.cpp:16:
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note: template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
^
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note: template argument deduction/substitution failed:
dsvg.cpp:725:46: note: deduced conflicting types for parameter ‘_Bi_iter’ (‘std::basic_regex<char>’ and ‘std::basic_string<char>’)
return std::regex_replace(css, pattern, cls);
^
In file included from /usr/include/c++/4.8.2/regex:62:0,
from dsvg.cpp:16:
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note: template<class _Rx_traits, class _Ch_type> std::basic_string<_Ch_type> std::regex_replace(const std::basic_string<_Ch_type>&, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
regex_replace(const basic_string<_Ch_type>& __s,
^
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note: template argument deduction/substitution failed:
dsvg.cpp:725:46: note: mismatched types ‘const std::basic_string<_Ch_type>’ and ‘const char*’
return std::regex_replace(css, pattern, cls);
^
dsvg.cpp:726:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
...
^
make: *** [dsvg.o] Error 1
ERROR: compilation failed for package ‘ggiraph’
removing ‘/home/sandbox/R/x86_64-redhat-linux-gnu-library/3.6/ggiraph’
restoring previous ‘/home/sandbox/R/x86_64-redhat-linux-gnu-library/3.6/ggiraph’
Error: Failed to install 'ggiraph' from GitHub:
(converted from warning) installation of package ‘/tmp/RtmpU8zekV/file485f57d349a8/ggiraph_0.7.9.tar.gz’ had non-zero exit status
In my case for this problem, my solution is update the linux GCC version.
Type the script on your terminal to update GCC.
gcc -v ## to check your gcc version(original centos 7 seems 2.5.4)
and refer to this article to update the developer tool 8 https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/
On CentOS, install package centos-release-scl available in CentOS repository:
sudo yum install centos-release-scl
On RHEL, enable RHSCL repository for you system:
sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
Install the collection:
sudo yum install devtoolset-8
Start using software collections:
scl enable devtoolset-8 bash
Check your GCC version is latest:
gcc -v #### Now GCC version should be 8.3.1 20190311
Into the R to install ggiraph on terminal:
sudo R
Install the ggiraph package:
install.packages('ggiraph', repos='http://cran.us.r-project.org')
Quit the terminal R
q() # type "n" to not save workspace image
And switch to rstudio console, library the ggiraph package
library(ggiraph)
All ggiraph function are able to work now! :D
I'm trying to compile Qscintilla 2.9.2 on Ubuntu 16.04 64bit using Qt 5.7 got the following error message:
-L/home/mwambi/Qt5.7.0/5.7/gcc_64/lib -lQt5PrintSupport -L/usr/lib64 -lQt5Widgets -lQt5Gui -lQt5Core -lpthread -lGL
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
Makefile:979: recipe for target 'libqscintilla2.so.12.0.1' failed
make: *** [libqscintilla2.so.12.0.1] Error 1
I do not know what the library GL is and where to find it. How can I solve this?
In my experience, this troubleshooting procedure is enough to solve about 90% of missing library issues during compilation:
"-l[name]" implies there's a "lib[name].so"
Search your system for "lib[name]" (use locate or find).
If you find it on your system, check paths ($LB_LIBRARY_PATH and the build system's -L flags) and verify that the architecture matches (x86+64 vs. i686).
Do a repository search for "lib[name]" (use apt, yum, synaptic, &c.).
Install it if it's missing.
Type "lib[name].so" into google or a dedicated package-search site (like RPMFind or packages.ubuntu.com) and see what package names come up, then search for as in #2-3.
In this case, libGL is an implementation of OpenGL. You can install Mesa or find an alternative implementation (I've only ever used Qt with Mesa). Here's a list of packages that provide libGL; if you already have one of these installed on your system, try fetching the dev versions of whichever ones you already have.
I've downloaded the source for QT 5.6.0 and I'm attempting to compile/install it on a Cygwin installation for Windows.
The Cygwin build already has Qt4 and Qt3 libraries installed. Trying to upgrade so I can install the latest QtCreator suite.
Here is my Cygwin version via uname -a:
CYGWIN_NT-10.0 J_Mick-Windoze 2.5.1(0.297/5/3) 2016-04-21 22:14 x86_64 Cygwin
When I try to compile QT 5.6.1 via running ./configure -platform cygwin-g++ -prefix $PWD/qtbase -opensource -nomake tests I get the following error:
Running configuration tests (phase 1)...
Done running configuration tests.
Creating qmake...
.In file included from /home/JasonMick/Install_Stuff/qt-everywhere-opensource-src-5.6.0/qtbase/include/QtCore/5.6.0/QtCore/private/qcore_unix_p.h:1:0,
from /home/JasonMick/Install_Stuff/qt-everywhere-opensource-src-5.6.0/qtbase/src/corelib/global/qglobal.cpp:90:
/home/JasonMick/Install_Stuff/qt-everywhere-opensource-src-5.6.0/qtbase/src/corelib/kernel/qcore_unix_p.h: In function ‘key_t qt_safe_ftok(const QByteArray&, int)’:
/home/JasonMick/Install_Stuff/qt-everywhere-opensource-src-5.6.0/qtbase/src/corelib/kernel/qcore_unix_p.h:333:12: error: ‘::ftok’ has not been declared
return ::ftok(filename.constData(), qHash(filename, proj_id));
^
make: *** [qglobal.o] Error 1
Now clearly there is support for cygwin in the QT project as grepping inside configure I see the platform:
PLATFORM=cygwin-g++
...is defined. Doing some reading I read that ftok is a part of the IPC group of shared memory functions. One link regarding a similar error with a different app suggested linking in -lcygwin. I successfully added this to the L_FLAGS variable in the configure file, but it's still giving the same error, even when I specify the Cygwin as the platform via the -platform flag.
I would appreciate any advice as to how to get rid of this issue -- which I believe is attributable to some sort of missing IPC library error.
I'm trying in vain to compile the armadillo linear algebra library for windows. Using the armadillo-4.200.0 source, I have Rtools-3.1 installed and in the path, msys from MinGW installed.
Because my ultimate goal is to use Rcpp and RcppArmadillo, my thought is that I need to use the same compiler for making armadillo as will be used to compile my Rcpp/RcppArmadillo files. Unfortunately, when trying to compile armadillo:
$ ./configure
[...snip...]
-- The CXX compiler identification is unknown
-- Check for working CXX compiler: cl
CMake Warning at CMakeLists.txt:3 (PROJECT):
To use the NMake generator, cmake must be run from a shell that can use the
compiler cl from the command line. This environment does not contain
INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to
work.
CMake Error: your CXX compiler: "cl" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
[...snip...]
(I tried setting CMAKE_CXX_COMPILER to my Rtools gcc.exe with no luck.)
I believe that it is looking for the visual C compiler, though the docs imply that it can be done solely with the mingw or cygwin compiler environments.
Either:
Is there a problem with compiling the armadillo library and subsequent Rcpp code with different versions of the compiler? (Rtools-3.1 has gcc version 4.6.3, MinGW has gcc version 4.8.1.)
Is there a clean method for compiling armadillo with just the Rtools collection?
(Win7 x64, R-3.1.0, cygwin gcc 4.8.2, rtools 3.1 with gcc 4.6.3.)
RcppArmadillo ships its own copy of Armadillo to avoid exactly this problem. As RcppArmadillpo is used from R, it can rely on R (and R's configuration) to get LAPACK, BLAS, etc pp. We don't need to run configure to use Armadillo from R, and so we don't do.
RcppArmadillo installs the usual R CMD INSTALL ... way; this is tested before every release and has worked reliably.
As you say "your ultimate goal is to use Rcpp and RcppArmadillo", you are in fact done at the R CMD INSTALL .... You can replicate the step from source, and test the package -- all that should "just work".
The other thing to keep in mind is what the "Writing R Extensions" and "R Installation and Administration" manuals have to say about your compiler. As far is R is concerned, your g++ 4.8.* does not exist. Only the Rtools version matters, or you get into non-standard land real quick.
I made a simple fortran routine
subroutine add(x,y)
real(8) :: x,y
y = x + 3
end subroutine
saved as test.f90.
I compile with
gfortran -shared test.f90 -o test.so
In R (in the same directory), I use
dyn.load('test.so')
but it gives me this error:
Error in dyn.load("test.so") :
unable to load shared object '/Users/Steven/Documents/PhD/npsR/test.so':
dlopen(/Users/Steven/Documents/PhD/npsR/test.so, 6): Symbol not found: ___addtf3
Referenced from: /usr/local/gfortran/lib/libquadmath.0.dylib
Expected in: /Library/Frameworks/R.framework/Resources/lib/libgcc_s.1.dylib
in /usr/local/gfortran/lib/libquadmath.0.dylib
Does anyone know why? I'm using mac osx Lion, with R v2.15.0 and gfortran 4.6.2.
Thank you!
Unless you really understand what you're doing, you should use gfortran that comes with R tools. The missing symbol in libgcc isn't surprising since you're trying to run code compiled with a 4.6 gfortran in a 4.2 runtime environment.
You can only use the gfortran version that was used to build R.
Since you are on Lion and presumably have Xcode installed you can get the appropriate version of gfortran from here: http://r.research.att.com/tools/
Go to section: "Apple Xcode gcc-42 add-ons" and choose the appropriate version.
You'll have to get rid of your gfortran 4.6.2 completely or make it inaccessible by changing PATH if possible (which I doubt unless it is in /opt/...).
And do use R CMD SHLIB since that will pass the correct options to compiler and linker.