I'm using CMake 3.8.2 and a custom build Boost 1.64 on travis. I set BOOST_ROOT CMake variable to the prefix where I installed boost. However it still keeps picking the wrong libraries (system installed ones) although it finds my headers.
I tried to debug everything I could but failed to find the reason. Any Ideas why CMake picks the wrong libs?
From https://travis-ci.com/Return-To-The-Roots/s25client/builds/96509387:
ls -la "${BOOST_DIR}/lib"
total 37952 drwxr-xr-x 17 travis staff 578 Jan 5 16:20 . drwxr-xr-x 4 travis staff 136 Jan 5 16:18 ..
-rw-r--r-- 1 travis staff 259576 Jan 7 18:20 libboost_chrono.a
-rwxr-xr-x 1 travis staff 18656 Jan 7 18:20 libboost_chrono.dylib
-rwxr-xr-x 1 travis staff 132152 Jan 7 18:19 libboost_filesystem.dylib
-rwxr-xr-x 1 travis staff 151976 Jan 7 18:19 libboost_iostreams.dylib
-rwxr-xr-x 1 travis staff 768636 Jan 7 18:19 libboost_locale.dylib
-rwxr-xr-x 1 travis staff 82192 Jan 7 18:20 libboost_prg_exec_monitor.dylib
-rwxr-xr-x 1 travis staff 572724 Jan 7 18:19 libboost_program_options.dylib
-rwxr-xr-x 1 travis staff 1243824 Jan 7 18:20 libboost_regex.dylib
-rw-r--r-- 1 travis staff 103008 Jan 7 18:20 libboost_system.a
-rwxr-xr-x 1 travis staff 24932 Jan 7 18:18 libboost_system.dylib
-rw-r--r-- 1 travis staff 14620656 Jan 7 18:21 libboost_test_exec_monitor.a
-rwxr-xr-x 1 travis staff 160108 Jan 7 18:20 libboost_thread.dylib
-rw-r--r-- 1 travis staff 285880 Jan 7 18:20 libboost_timer.a
-rwxr-xr-x 1 travis staff 48080 Jan 7 18:20 libboost_timer.dylib
-rwxr-xr-x 1 travis staff 925444 Jan 7 18:20 libboost_unit_test_framework.dylib
-- [ /Users/travis/build/Return-To-The-Roots/s25client/deps/cmakeosx/share/cmake-3.8/Modules/FindBoost.cmake:1171 ] _boost_INCLUDE_SEARCH_DIRS = /Users/travis/build/Return-To-The-Roots/s25client/deps/boost1.64.0/include;/Users/travis/build/Return-To-The-Roots/s25client/deps/boost1.64.0;PATHS;C:/boost/include;C:/boost;/sw/local/include
-- [ /Users/travis/build/Return-To-The-Roots/s25client/deps/cmakeosx/share/cmake-3.8/Modules/FindBoost.cmake:1421 ] _boost_LIBRARY_SEARCH_DIRS_RELEASE = /Users/travis/build/Return-To-The-Roots/s25client/deps/boost1.64.0/lib;/Users/travis/build/Return-To-The-Roots/s25client/deps/boost1.64.0/stage/lib;/Users/travis/build/Return-To-The-Roots/s25client/deps/boost1.64.0/include/lib;/Users/travis/build/Return-To-The-Roots/s25client/deps/boost1.64.0/include/../lib;/Users/travis/build/Return-To-The-Roots/s25client/deps/boost1.64.0/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib_boost_LIBRARY_SEARCH_DIRS_DEBUG
= /Users/travis/build/Return-To-The-Roots/s25client/deps/boost1.64.0/lib;/Users/travis/build/Return-To-The-Roots/s25client/deps/boost1.64.0/stage/lib;/Users/travis/build/Return-To-The-Roots/s25client/deps/boost1.64.0/include/lib;/Users/travis/build/Return-To-The-Roots/s25client/deps/boost1.64.0/include/../lib;/Users/travis/build/Return-To-The-Roots/s25client/deps/boost1.64.0/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib
-- [ /Users/travis/build/Return-To-The-Roots/s25client/deps/cmakeosx/share/cmake-3.8/Modules/FindBoost.cmake:1567 ] Searching for FILESYSTEM_LIBRARY_RELEASE: boost_filesystem-mt-1_64;boost_filesystem-mt;boost_filesystem
-- [ /Users/travis/build/Return-To-The-Roots/s25client/deps/cmakeosx/share/cmake-3.8/Modules/FindBoost.cmake:365 ] Boost_LIBRARY_DIR_RELEASE = /usr/local/lib
_boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
Boost_FILESYSTEM_LIBRARY_DEBUG:FILEPATH=/usr/local/lib/libboost_filesystem-mt.a
Looking into FindBoost of CMake 3.8.2 it leads to find_library to be ultimately called like:
find_library(result_var
NAMES boost_filesystem-mt-1_64;boost_filesystem-mt;boost_filesystem
HINTS /Users/travis/build/Return-To-The-Roots/s25client/deps/boost1.64.0/lib;<more paths>
NAMES_PER_DIR
DOC "${_boost_docstring_release}"
)
If this finds /usr/local/lib/libboost_filesystem-mt.a it HAS TO find my custom library which is in the first HINTS option and NAMES_PER_DIR is specified. I double-checked CMAKE_PREFIX_PATH, CMAKE_LIBRARY_PATH and CMAKE_FRAMEWORK_PATH and all are empty.
So what is happening here?
To clarify the difference to e.g. How can I get CMake to find my alternative Boost installation?:
I'm using cmake .... -DBOOST_ROOT=$BOOST_DIR
It does find the headers and is not using e.g. the Boost.CMake module
It has "my" path first in the HINTS of find_library and NAMES_PER_DIR should mean it finds my libs first, but it does not.
Related
I'm attempting to compile a binary from source, but keep running into an error while doing so.
$ cmake --build ./\[binary_dir\]/
[ 0%] Building C object [binary_dir]/CMakeFiles/ZIPLIB.dir/extlibs/bzip2/bcompress.c.o
cc: error: unrecognized command line option ‘-std=c++20’; did you mean ‘-std=c++2a’?
make[2]: *** [[binary_dir]/CMakeFiles/ZIPLIB.dir/build.make:154: [binary_dir]/CMakeFiles/ZIPLIB.dir/extlibs/bzip2/bcompress.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:307: [binary_dir]/CMakeFiles/ZIPLIB.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
Specifically, "cc: error: unrecognized command line option ‘-std=c++20’; did you mean ‘-std=c++2a’?."
I suspect this has to do with using the incorrect version of gcc; I have multiple version installed but believe I need to be using the latest, or at least 11.1.0. I have these versions installed:
$ ls -l /usr/bin/gcc*
lrwxrwxrwx 1 root root 5 Mar 20 2020 /usr/bin/gcc -> gcc-9
lrwxrwxrwx 1 root root 23 May 29 2021 /usr/bin/gcc-10 -> x86_64-linux-gnu-gcc-10
lrwxrwxrwx 1 root root 23 Apr 28 2021 /usr/bin/gcc-11 -> x86_64-linux-gnu-gcc-11
lrwxrwxrwx 1 root root 22 Mar 9 12:57 /usr/bin/gcc-9 -> x86_64-linux-gnu-gcc-9
lrwxrwxrwx 1 root root 8 Mar 20 2020 /usr/bin/gcc-ar -> gcc-ar-9
lrwxrwxrwx 1 root root 26 May 29 2021 /usr/bin/gcc-ar-10 -> x86_64-linux-gnu-gcc-ar-10
lrwxrwxrwx 1 root root 26 Apr 28 2021 /usr/bin/gcc-ar-11 -> x86_64-linux-gnu-gcc-ar-11
lrwxrwxrwx 1 root root 25 Mar 9 12:57 /usr/bin/gcc-ar-9 -> x86_64-linux-gnu-gcc-ar-9
lrwxrwxrwx 1 root root 8 Mar 20 2020 /usr/bin/gcc-nm -> gcc-nm-9
lrwxrwxrwx 1 root root 26 May 29 2021 /usr/bin/gcc-nm-10 -> x86_64-linux-gnu-gcc-nm-10
lrwxrwxrwx 1 root root 26 Apr 28 2021 /usr/bin/gcc-nm-11 -> x86_64-linux-gnu-gcc-nm-11
lrwxrwxrwx 1 root root 25 Mar 9 12:57 /usr/bin/gcc-nm-9 -> x86_64-linux-gnu-gcc-nm-9
lrwxrwxrwx 1 root root 12 Mar 20 2020 /usr/bin/gcc-ranlib -> gcc-ranlib-9
lrwxrwxrwx 1 root root 30 May 29 2021 /usr/bin/gcc-ranlib-10 -> x86_64-linux-gnu-gcc-ranlib-10
lrwxrwxrwx 1 root root 30 Apr 28 2021 /usr/bin/gcc-ranlib-11 -> x86_64-linux-gnu-gcc-ranlib-11
lrwxrwxrwx 1 root root 29 Mar 9 12:57 /usr/bin/gcc-ranlib-9 -> x86_64-linux-gnu-gcc-ranlib-9
If that's the issue, how can I specify which version of gcc to use? Would that happen in the makefile/cmakelist itself, as a path which I need to specify in my environment, or as a flag applied when calling cmake?
Or does the error suggest another solution?
Presuming you are in a build directory:
You can set CMAKE_C_COMPILER when you run the original call to cmake.
cmake -DCMAKE_C_COMPILER=/usr/bin/gcc-11 ..
cmake --build .
I wanted to move our database from mysql (community version) to mariadb with the further use of php7.1/apache2.4.25... So I have to compile mariadb in our new production environment. I compiled it with these options:
cmake -DCMAKE_CXX_FLAGS:STRING="-std=c++11" -DCONC_WITH_CURL=ON -DCONC_WITH_EXTERNAL_ZLIB=ON -DDISABLE_SHARED=OFF -DCONC_WITH_MYSQLCOMPAT:BOOL=ON -DPLUGIN_CLIENT_ED25519:STRING=DYNAMIC .
make all && make install
The mysql community version has a libmysqlclient.so in /usr/local/mysql/lib located. If I compile it with the options given above I only found these files in /usr/local/mysql/lib (MariaDB 10.2.6):
# ls -l /usr/local/mysql/lib/
total 3572
-rw-r--r-- 1 root root 2305518 Jul 4 08:14 libmariadbclient.a
lrwxrwxrwx 1 root root 15 Jul 4 08:31 libmariadb.so -> libmariadb.so.3
-rwxr-xr-x 1 root root 1297664 Jul 4 08:14 libmariadb.so.3
-rw-r--r-- 1 root root 48406 Jul 4 08:14 libmysqlservices.a
drwxr-xr-x 2 root root 4096 Jul 4 08:31 plugin
How can I get libmysqlclient.so? There isn't also any libmariadbclient.so just libmariadbclient.a ...
Thank you for further hints!
OK, now I found a solution.
I've just did a symbolic link to libmariadb.so and it now looks like the following:
ls -l /usr/local/mysql/lib/
total 3572
-rw-r--r-- 1 root root 2305518 Jul 4 16:21 libmariadbclient.a
lrwxrwxrwx 1 root root 15 Jul 4 16:39 libmariadb.so -> libmariadb.so.3
-rwxr-xr-x 1 root root 1297664 Jul 4 16:21 libmariadb.so.3
lrwxrwxrwx 1 root root 15 Jul 4 16:40 libmysqlclient_r.so -> libmariadb.so.3
lrwxrwxrwx 1 root root 15 Jul 4 16:40 libmysqlclient.so -> libmariadb.so.3
-rw-r--r-- 1 root root 48406 Jul 4 16:21 libmysqlservices.a
drwxr-xr-x 2 root root 4096 Jul 4 16:39 plugin
In this case PHP 7 would finally find the mysql libraries...
There are a number of similar questions on this matter, but none seem to tell me exactly where to get the R.h and Rmath.h header files if I don't already have them (I have searched my computer and they aren't there). These are the headers necessary for linking C/ C++ functions with R code.
Put simply, which R package should put the headers on the computer, or is there a website I could download them from?
This question mentions the R-devel package, but that does not seem to be available to me in my version of R (3.1.1). Other questions on Stack Overflow found here, here, and here, but not directly answering the question I don't think.
Any help appreciated.
Christopher
Most Linux distros should have locate:
edd#max:~$ locate Rmath.h | grep "usr/" | grep -v "local/"
/usr/include/Rmath.h
/usr/include/JAGS/JRmath.h
/usr/share/R/include/Rmath.h
edd#max:~$
(I have dev versions here, version control checkouts and the sources for the Debian packages hence the grep. Also shows one false positive from JAGS.)
Finally, the "official" way to go about this is to ask R itself:
edd#max:~$ R CMD config --cppflags
-I/usr/share/R/include
edd#max:~$
They should be in the include folder below R's RHOME folder.
$ R RHOME
/home/rowlings/Downloads/R-3.2.1
$ ls -l `R RHOME`/include
total 108
-rw-r--r-- 1 rowlings rowlings 511 Jun 29 17:34 Rconfig.h
-rw-r--r-- 1 rowlings rowlings 5916 Jun 29 17:34 Rdefines.h
-rw-r--r-- 1 rowlings rowlings 2085 Jun 29 17:34 Rembedded.h
drwxr-xr-x 2 rowlings rowlings 4096 Jun 29 17:34 R_ext
-rw-r--r-- 1 rowlings rowlings 2063 Jun 29 17:34 R.h
-rw-r--r-- 1 rowlings rowlings 4818 Jun 29 17:34 Rinterface.h
-rw-r--r-- 1 rowlings rowlings 46137 Jun 29 17:34 Rinternals.h
-rw-r--r-- 1 rowlings rowlings 17619 Jun 29 17:34 Rmath.h
-rw-r--r-- 1 rowlings rowlings 509 Jun 29 17:34 Rversion.h
-rw-r--r-- 1 rowlings rowlings 2142 Jun 29 17:34 S.h
You can get the code form this link -
Rmath.h
https://www.cs.kent.ac.uk/projects/cxxr/doc/html/Rmath_8h_source.html
R.h-
https://www.cs.kent.ac.uk/projects/cxxr/doc/html/R_8h_source.html
These headers are included with R installations (whether from CRAN or built from source); you should be able to find them using R.home() in an R session; e.g.
list.files(R.home("include"))
gives me
> list.files(R.home("include"))
[1] "libintl.h" "R_ext" "R.h"
[4] "Rconfig.h" "Rdefines.h" "Rembedded.h"
[7] "Rinterface.h" "Rinternals.h" "Rmath.h"
[10] "Rversion.h" "S.h"
$./configure --prefix ${HOME}/ocsigen OCSIGEN_USER=${USER} OCSIGEN_GROUP=${USER} --with-missing-libs
...
checking for sqlite3_open in -lsqlite3... no
configure: error: SQLite is required. See the --with-sqlite3 configure option.
$uname -r
[FreeBSD[ 9.0-RELEASE-p3
$whereis sqlite3
sqlite3: /usr/local/bin/sqlite3
$ls -l /usr/local/lib/libsqlite*
-rw-r--r-- 1 root wheel 602092 12 3 2011 /usr/local/lib/libsqlite3.a
-rwxr-xr-x 1 root wheel 943 12 3 2011 /usr/local/lib/libsqlite3.la*
lrwx-rw-r--r-- 1 root wheel 602092 12 3 2011 /usr/local/lib/libsqlite3.a
-rwxr-xr-x 1 root wheel 943 12 3 2011 /usr/local/lib/libsqlite3.la*
lrwxr-xr-x 1 root wheel 15 12 3 2011 /usr/local/lib/libsqlite3.so# -> libsqlite3.so.8
-rwxr-xr-x 1 root wheel 617995 12 3 2011 /usr/local/lib/libsqlite3.so.8*
Any suggestion is appreciated!
I think you can use something like
./configure --with-sqlite3=/usr/local/lib
or maybe just /usr/local to tell the ./configure script that sqlite3 is not in the standard directory (/usr/lib).
I am doing a django project with Sublime Text 2 on OSX-Lion. I have installed virtualenv, so my project is in "/Users/myname/Virtualenvs/"
I need to use a 'sudo' for each command (syncdb, runserver), can I change these rules whithout moving my project and is it normal ?
These are parameters after a "sudo python manage.py startproject"
Chmod infos :
drwxr-xr-x 17 root staff 578 10 jul 23:24 Platform
-rw-r--r-- 1 root staff 155648 10 jul 23:24 database.sqlite3
-rw-r--r-- 1 root staff 251 10 jul 23:09 manage.py
and in Platform :
drwxrwxr-x# 9 Nicolas staff 306 10 jul 23:13 Templates
-rw-r--r--# 1 Nicolas staff 0 4 jul 16:53 __init__.py
-rw-r--r--# 1 Nicolas staff 144 4 jul 16:54 __init__.pyc
-rw-rw-r--# 1 Nicolas staff 123 10 jul 23:13 admin.py
-rw-r--r-- 1 root staff 321 10 jul 23:24 admin.pyc
-rw-rw-r--# 1 Nicolas staff 1706 10 jul 23:13 models.py
-rw-r--r-- 1 root staff 2603 10 jul 23:22 models.pyc
-rw-r--r--# 1 Nicolas staff 5309 10 jul 23:06 settings.py
-rw-r--r-- 1 root staff 3058 10 jul 23:22 settings.pyc
-rw-r--r--# 1 Nicolas staff 639 10 jul 23:06 urls.py
-rw-r--r-- 1 root staff 784 10 jul 23:24 urls.pyc
-rw-rw-r--# 1 Nicolas staff 1895 10 jul 23:06 views.py
-rw-r--r-- 1 root staff 2745 10 jul 23:24 views.pyc
-rw-r--r--# 1 Nicolas staff 1138 10 jul 23:05 wsgi.py
-rw-r--r-- 1 root staff 1047 10 jul 23:24 wsgi.pyc
You'll need to change ownership of all the root-owned files to yourself, but otherwise there shouldn't be any need for sudo here.