I am trying to install an R package with the following command:
devtools::install_github('ococrook/bandle)
However, I keep running into compiler issues. When I run the command I get many, many errors. For example this error related to BH:
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppArmadillo/include' -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/BH/include' -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -Wall -pedantic -fdiagnostics-color=always -c Bessel2ndKind.cpp -o Bessel2ndKind.o
In file included from Bessel2ndKind.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppArmadillo/include/RcppArmadillo.h:34:
In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include/Rcpp.h:59:
In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include/Rcpp/exceptions_impl.h:38:
In file included from /usr/local/include/execinfo.h:28:
/usr/local/include/os/base.h:274:37: warning: type nullability specifier '_Nullable' is a Clang extension [-Wnullability-extension]
typedef void (*os_function_t)(void *_Nullable);
^
Bessel2ndKind.cpp:621:55: warning: explicitly assigning value of variable of type 'int' to itself [-Wself-assign]
nk, tau, D = D, j + 1, nu).t();
~ ^ ~
Bessel2ndKind.cpp:774:49: warning: explicitly assigning value of variable of type 'int' to itself [-Wself-assign]
nk, tau, D = D, j + 1).t();
~ ^ ~
In file included from Bessel2ndKind.cpp:2:
In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/BH/include/boost/math/special_functions/bessel.hpp:24:
/Library/Frameworks/R.framework/Versions/4.1/Resources/library/BH/include/boost/math/special_functions/detail/bessel_ik.hpp:97:18: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
BOOST_ASSERT(abs(x) <= 2);
^
/Library/Frameworks/R.framework/Versions/4.1/Resources/library/BH/include/boost/math/special_functions/detail/bessel_ik.hpp:366:9: note: in instantiation of function template specialization 'boost::math::detail::temme_ik<long double, boost::math::policies::policy<detail::forwarding_arg1, detail::forwarding_arg2>>' requested here
temme_ik(u, x, &Ku, &Ku1, pol); // Temme series
^
/Library/Frameworks/R.framework/Versions/4.1/Resources/library/BH/include/boost/math/special_functions/bessel.hpp:246:4: note: in instantiation of function template specialization 'boost::math::detail::bessel_ik<long double, boost::math::policies::policy<detail::forwarding_arg1, detail::forwarding_arg2>>' requested here
bessel_ik(v, x, &I, &K, need_k, pol);
^
/Library/Frameworks/R.framework/Versions/4.1/Resources/library/BH/include/boost/math/special_functions/bessel.hpp:258:11: note: in instantiation of function template specialization 'boost::math::detail::cyl_bessel_k_imp<long double, boost::math::policies::policy<detail::forwarding_arg1, detail::forwarding_arg2>>' requested here
return cyl_bessel_k_imp(v, x, bessel_no_int_tag(), pol);
^
Or this error related to RcppArmadillo:
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppArmadillo/include' -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/BH/include' -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -Wall -pedantic -fdiagnostics-color=always -c leapfrogGPcpp.cpp -o leapfrogGPcpp.o
In file included from leapfrogGPcpp.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppArmadillo/include/RcppArmadillo.h:34:
In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include/Rcpp.h:59:
In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include/Rcpp/exceptions_impl.h:38:
In file included from /usr/local/include/execinfo.h:28:
/usr/local/include/os/base.h:274:37: warning: type nullability specifier '_Nullable' is a Clang extension [-Wnullability-extension]
typedef void (*os_function_t)(void *_Nullable);
^
In file included from leapfrogGPcpp.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppArmadillo/include/RcppArmadillo.h:31:
In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:49:
In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppArmadillo/include/armadillo:646:
/Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppArmadillo/include/armadillo_bits/op_inv_meat.hpp:200:28: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
const T abs_det_val = std::abs(det_val);
So far I have tried this, and this, and this, and this. However, so far, none of these solutions have worked and I am running out of ideas on how to solve this.
Any help would be greatly appreciated,
Thanks!
Try following the instructions here and change the default timeout to ensure the relatively large "pRolocdata" package is downloaded completely, i.e.
options(timeout = 600)
devtools::install_github('ococrook/bandle')
Using this approach, Bandle installed with a bunch of warnings but without error on my system.
sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.6
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
loaded via a namespace (and not attached):
[1] compiler_4.1.1 tools_4.1.1
My ~/.R/Makevars file:
LOC = /usr/local/gfortran
CC=$(LOC)/bin/gcc -fopenmp
CXX=$(LOC)/bin/g++ -fopenmp
CXX11 = $(LOC)/bin/g++ -fopenmp
CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe
LDFLAGS=-L$(LOC)/lib -Wl,-rpath,$(LOC)/lib
CPPFLAGS=-I$(LOC)/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
FLIBS=-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin19/10.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
CXX1X=/usr/local/gfortran/bin/g++
CXX98=/usr/local/gfortran/bin/g++
CXX11=/usr/local/gfortran/bin/g++
CXX14=/usr/local/gfortran/bin/g++
CXX17=/usr/local/gfortran/bin/g++
Related
I have been trying to install RMariaDB on my CentOS server with no success. I am running R version 3.5. I keep getting error messages related to scope. The source files seem to be correct and the install has been MD5 Sum checked. The package will unpack but then fails with a non-zero exit status. I get similar error messages whether I am installing RMySQL or RMariaDB. They are both related to the my_bool variable. Specific error messages are posted below:
> install.packages("RMariaDB")
Installing package into ‘/home/cmiddlet#cgifederal.com/R/x86_64-redhat-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/RMariaDB_1.0.6.tar.gz'
Content type 'application/x-gzip' length 42903 bytes (41 KB)
==================================================
downloaded 41 KB
* installing *source* package ‘RMariaDB’ ...
** package ‘RMariaDB’ successfully unpacked and MD5 sums checked
Using mysql_config
Found mysql_config/mariadb_config cflags and libs!
Using PKG_CFLAGS=-I/usr/include/mysql -m64
Using PKG_LIBS=-L/usr/lib64/mysql -lmysqlclient -lpthread -lm -lrt -lssl -lcrypto -ldl
** libs
g++ -m64 -I"/usr/include/R" -DNDEBUG -I/usr/include/mysql -m64 -I"/usr/share/R/library/BH/include" -I"/usr/share/R/library/plogr/include" -I"/home/cmiddlet#cgifederal.com/R/x86_64-redhat-linux-gnu-library/3.5/Rcpp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c DbConnection.cpp -o DbConnection.o
g++ -m64 -I"/usr/include/R" -DNDEBUG -I/usr/include/mysql -m64 -I"/usr/share/R/library/BH/include" -I"/usr/share/R/library/plogr/include" -I"/home/cmiddlet#cgifederal.com/R/x86_64-redhat-linux-gnu-library/3.5/Rcpp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c DbResult.cpp -o DbResult.o
In file included from MariaResultPrep.h:6:0,
from DbResult.cpp:4:
MariaBinding.h:14:15: error: ‘my_bool’ was not declared in this scope
std::vector<my_bool> is_null;
^
MariaBinding.h:14:22: error: template argument 1 is invalid
std::vector<my_bool> is_null;
^
MariaBinding.h:14:22: error: template argument 2 is invalid
In file included from MariaResultPrep.h:9:0,
from DbResult.cpp:4:
MariaRow.h:18:15: error: ‘my_bool’ was not declared in this scope
std::vector<my_bool> nulls_, errors_;
^
MariaRow.h:18:22: error: template argument 1 is invalid
std::vector<my_bool> nulls_, errors_;
^
MariaRow.h:18:22: error: template argument 2 is invalid
make: *** [DbResult.o] Error 1
ERROR: compilation failed for package ‘RMariaDB’
* removing ‘/home/cmiddlet#cgifederal.com/R/x86_64-redhat-linux-gnu-library/3.5/RMariaDB’
Warning in install.packages :
installation of package ‘RMariaDB’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmpwlaf35/downloaded_packages’
I'm trying to make my project using Makefile. The Makefile works correctly for other Mac's but bring error in my case.
The output is as follows:
CC kernel.cpp
In file included from kernel.cpp:13:
In file included from ./kernel.hpp:22:
In file included from /usr/local/include/Poco/JSON/Object.h:24:
In file included from /usr/local/include/Poco/JSON/Array.h:25:
In file included from /usr/local/include/Poco/Dynamic/Var.h:26:
In file included from /usr/local/include/Poco/Dynamic/VarHolder.h:24:
In file included from /usr/local/include/Poco/NumberFormatter.h:24:
In file included from /usr/local/include/Poco/NumericString.h:25:
In file included from /usr/local/include/Poco/FPEnvironment.h:35:
In file included from /usr/local/include/Poco/FPEnvironment_C99.h:25:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:313:9: error:
no member named 'signbit' in the global namespace
using ::signbit;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:314:9: error:
no member named 'fpclassify' in the global namespace
using ::fpclassify;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:315:9: error:
no member named 'isfinite' in the global namespace; did you mean 'finite'?
using ::isfinite;
~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/math.h:757:12: note:
'finite' declared here
extern int finite(double) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __M...
^
In file included from kernel.cpp:13:
In file included from ./kernel.hpp:22:
In file included from /usr/local/include/Poco/JSON/Object.h:24:
In file included from /usr/local/include/Poco/JSON/Array.h:25:
In file included from /usr/local/include/Poco/Dynamic/Var.h:26:
In file included from /usr/local/include/Poco/Dynamic/VarHolder.h:24:
In file included from /usr/local/include/Poco/NumberFormatter.h:24:
In file included from /usr/local/include/Poco/NumericString.h:25:
In file included from /usr/local/include/Poco/FPEnvironment.h:35:
In file included from /usr/local/include/Poco/FPEnvironment_C99.h:25:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:316:9: error:
no member named 'isinf' in the global namespace
using ::isinf;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:317:9: error:
no member named 'isnan' in the global namespace
using ::isnan;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:318:9: error:
no member named 'isnormal' in the global namespace
using ::isnormal;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:319:7: error:
no member named 'isgreater' in the global namespace; did you mean
'::std::greater'?
using ::isgreater;
^~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:718:29: note:
'::std::greater' declared here
struct _LIBCPP_TEMPLATE_VIS greater : binary_function<_Tp, _Tp, bool>
^
In file included from kernel.cpp:13:
In file included from ./kernel.hpp:22:
In file included from /usr/local/include/Poco/JSON/Object.h:24:
In file included from /usr/local/include/Poco/JSON/Array.h:25:
In file included from /usr/local/include/Poco/Dynamic/Var.h:26:
In file included from /usr/local/include/Poco/Dynamic/VarHolder.h:24:
In file included from /usr/local/include/Poco/NumberFormatter.h:24:
In file included from /usr/local/include/Poco/NumericString.h:25:
In file included from /usr/local/include/Poco/FPEnvironment.h:35:
In file included from /usr/local/include/Poco/FPEnvironment_C99.h:25:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:320:7: error:
no member named 'isgreaterequal' in the global namespace; did you mean
'::std::greater_equal'?
using ::isgreaterequal;
^~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:747:29: note:
'::std::greater_equal' declared here
struct _LIBCPP_TEMPLATE_VIS greater_equal : binary_function<_Tp, _Tp, bool>
^
The makefile has been tested on Linux platforms, and it's works correctly.
Any recommendations, whats wrong in my Mac c++ configs ?
I'm using MacOS High Sierra(10.13), and Xcode v9.0.1
Edited
This is compiling command:
gcc -pipe -x c++ -std=c++11 -fPIC -pedantic -W -Wall -Wwrite-strings -Wcast-align -Wcast-qual -Wpointer-arith -Wshadow -Wendif-labels -Wundef -Wfloat-equal -Werror -Wconversion -DPROJECT_VERSION="0.0.1" -DUSE_SDK="no" -g -g3 -ggdb3 -D__i386__=1 -D__ppc64__=0 -Wno-sign-conversion -Wno-conversion -Wno-float-equal -Wno-unused-parameter -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/version -I/git/p2p/inc -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/version src/kernel.cpp -o /git/p2p/obj/kernel.o
Instead of running gcc -x c++ I recommend you run g++ or, better on MacOS, clang++.
Also, your compile line appears to be missing the -c option which would tell the compiler to generate an object file; without that it will try to link your file and create an executable.
Also I find it very strange that you have added -D__i386__ and -D__ppc64__ to your compile line: those are typically system macros that are defined by your operating system, not provided on the command line of the compiler.
Another potential problem is why you are explicitly adding system header file directories to your compile line with -I. The compiler will add those itself, and using the proper configuration. System headers often require extra care to include in the correct order etc.
If you change to the proper directory and run this from your shell prompt:
clang++ -pipe -std=c++11 -fPIC -pedantic -W -Wall -Wwrite-strings \
-Wcast-align -Wcast-qual -Wpointer-arith -Wshadow -Wendif-labels \
-Wundef -Wfloat-equal -Werror -Wconversion -DPROJECT_VERSION="0.0.1" \
-DUSE_SDK="no" -g -g3 -ggdb3 -Wno-sign-conversion -Wno-conversion \
-Wno-float-equal -Wno-unused-parameter -I/usr/local/include \
-I/usr/local/opt/openssl/include -I/git/p2p/inc \
-c -o /git/p2p/obj/kernel.o src/kernel.cpp
does it compile properly?
Upgrade your packages :
$ brew update
$ brew upgrade
With XCode updated, it could be fixed.
I am trying to run a couple of fixed-formatted Fortran 90 files on a PC. They run flawlessly with gfortran version 4.1.1, but not with gfortran 4.1.2 or later (I tried). Here are all the things I've tried:
I tried using the tag "-std=legacy" in Cygwin with version 4.9.3 so the processor compiles the code as a Fortran 77 file. I had to work out some kinks, but eventually it began to work splendidly. Then the following error popped up:
Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG IEEE_DIVIDE_BY_ZERO IEEE_OVERFLOW_FLAG IEEE_DENORMAL
I then moved on to plan B: trying to get gfortran 4.1.1 on my PC, on Cygwin.
Building gfortran 4.1.1 from source in Cygwin (since I can't find binary files anywhere online). Cygwin already has a package for gfortran, but only version 4.9.3. I used gcc-fortran-4.1.1.tar.bz2; basically I want to downgrade gfortran in Cygwin. the files in the tarball were lacking so I had to debug some things and add some files with some wget's (like the most current versions of config.guess and config.sub) to get it to configure (I also used autoconf, autoreconf, and automake). Long story short, I tried to run make and I got a long list of errors.
I have access to a Linux machine with gfortran 4.1.1 already on it (on which it works perfectly), and tried to make it there, but it gave a lot of errors as well, completely different from those from Cygwin. At the end are the errors, the first being those from Cygwin and the latter from Linux. I access the Linux computer remotely via SSH; the entire point of this endeavor is to run the codes on PC's (and/or Mac's) so that we don't have to transfer thousands of images and files back and forth.
I tried to download g95 onto Cygwin via the tarball g95-x86-cygwin-41.tgz found online. The INSTALL file said I just need to extract the files in the root directory, create a symbolic link somewhere, and it should work. I did and then I typed it in and nothing happened; no "-bash: ... No such file or directory" error or other errors, but simply nothing. No executable was created-nothing. I even mispelled --version and no error popped up.
J Double B#jdoubleb-PC /wexlerwork/autismcases_CTs/autismcases_23_VOID
$ g95 --versio
J Double B#jdoubleb-PC /wexlerwork/autismcases_CTs/autismcases_23_VOID
$ g95 --version
J Double B#jdoubleb-PC /wexlerwork/autismcases_CTs/autismcases_23_VOID
$ g95 --help
J Double B#jdoubleb-PC /wexlerwork/autismcases_CTs/autismcases_23_VOID
$ man g95
No manual entry for g95
J Double B#jdoubleb-PC /wexlerwork/autismcases_CTs/autismcases_23_VOID
$ g95 ver5.2_v3.5.f -o f05
J Double B#jdoubleb-PC /wexlerwork/autismcases_CTs/autismcases_23_VOID
I even tried the self-extracting files for gcc 4.1 from the following website: http://g95.org/downloads.shtml. I tried the HTTP link and it gave me the tarball I mentioned above. I tried the FTP link and it did nothing useful.
I tried g95 via MinGW and my Windows 7 command shell (from the Start menu). It was an executable, so it was nice to not have to build it. It downloaded and it works. However, there are a lot of errors. It didn't recognize all the comments beginning with 'c', so I changed them all to !'s. Then the compiler mentioned continuations. There are hundreds of continuations in the code, and only a limited amount are allowed per version and format type I think. Essentially the compiler processes Fortran 95 files (naturally-it's in the name), but the file is not a Fortran file. I tried to pass a "-std=legacy" or something similar, but apparently the only options are for Fortran 95, 2003, and 2008. It'd take forever to change a 7000-line and a 3000-line Fortran 77/90 file to Fortran 95 files, so I stopped. Well, I figured I'd give it a try.
I tried changing the extensions of the files to *.f90, but they were interpreted by my computer to be Fortran 95 files and it didn't work.
I'd rather not continue to try and change the codes so they work for some kind of compiler, but rather simply get gfortran 4.1.1 on my computer and have them running just like on the Linux computer. I'd also like to not have to build anything from source-executables for Fortran compilers are welcome. However, I'm not completely closed to the prospect.
Any help from anyone is welcome; thank you in advance for your consideration.
*FROM CYGWIN*
J Double B#jdoubleb-PC /gcc-4.1.1
$ make
cat: libgfortran/../gcc/BASE-VER: No such file or directory
makefile:2442: warning: overriding commands for target `.F90.o'
makefile:1059: warning: ignoring old commands for target `.F90.o'
makefile:2445: warning: overriding commands for target `.F90.obj'
makefile:1062: warning: ignoring old commands for target `.F90.obj'
makefile:2448: warning: overriding commands for target `.F90.lo'
makefile:1065: warning: ignoring old commands for target `.F90.lo'
C:/Users/jdoubleb/Documents/Academia/Cygwin_etal/bin/sh.exe libgfortran/mk-kinds-h.sh ' -I . -Wall -fno-repack-arrays -fno-underscoring ' > kinds.h || rm kinds.h
grep '^#' < kinds.h > kinds.inc
grep '^#' < libgfortran/c99_protos.h > c99_protos.inc
cp libgfortran/config/fpu-glibc.h fpu-target.h
C:/Ch/bin/make all-am
cat: libgfortran/../gcc/BASE-VER: No such file or directory
make[1]: Entering directory `C:/Users/jdoubleb/Documents/Academia/Cygwin_etal/gcc-4.1.1'
makefile:2442: warning: overriding commands for target `.F90.o'
makefile:1059: warning: ignoring old commands for target `.F90.o'
makefile:2445: warning: overriding commands for target `.F90.obj'
makefile:1062: warning: ignoring old commands for target `.F90.obj'
makefile:2448: warning: overriding commands for target `.F90.lo'
makefile:1065: warning: ignoring old commands for target `.F90.lo'
C:/Users/jdoubleb/Documents/Academia/Cygwin_etal/bin/sh.exe ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -std=gnu99 -g -O2 -Wunknown-pragmas -c -o compile_options.lo `test -f 'runtime/compile_options.c' || echo 'libgfortran/'`runtime/compile_options.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -std=gnu99 -g -O2 -Wunknown-pragmas -c libgfortran/runtime/compile_options.c -DDLL_EXPORT -DPIC -o .libs/compile_options.o
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:204:9: error: unknown type name ‘GFC_INTEGER_4’
typedef GFC_INTEGER_4 gfc_charlen_type;
^
libgfortran/libgfortran.h:254:51: error: unknown type name ‘GFC_INTEGER_4’
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_4) gfc_array_i4;
^
libgfortran/libgfortran.h:245:3: note: in definition of macro ‘GFC_ARRAY_DESCRIPTOR’
type *data;\
^
libgfortran/libgfortran.h:255:51: error: unknown type name ‘GFC_INTEGER_8’
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_8) gfc_array_i8;
^
libgfortran/libgfortran.h:245:3: note: in definition of macro ‘GFC_ARRAY_DESCRIPTOR’
type *data;\
^
libgfortran/libgfortran.h:259:51: error: unknown type name ‘GFC_REAL_4’
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_4) gfc_array_r4;
^
libgfortran/libgfortran.h:245:3: note: in definition of macro ‘GFC_ARRAY_DESCRIPTOR’
type *data;\
^
libgfortran/libgfortran.h:260:51: error: unknown type name ‘GFC_REAL_8’
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_8) gfc_array_r8;
^
libgfortran/libgfortran.h:245:3: note: in definition of macro ‘GFC_ARRAY_DESCRIPTOR’
type *data;\
^
libgfortran/libgfortran.h:267:51: error: unknown type name ‘GFC_COMPLEX_4’
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_4) gfc_array_c4;
^
libgfortran/libgfortran.h:245:3: note: in definition of macro ‘GFC_ARRAY_DESCRIPTOR’
type *data;\
^
libgfortran/libgfortran.h:268:51: error: unknown type name ‘GFC_COMPLEX_8’
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_8) gfc_array_c8;
^
libgfortran/libgfortran.h:245:3: note: in definition of macro ‘GFC_ARRAY_DESCRIPTOR’
type *data;\
^
libgfortran/libgfortran.h:275:51: error: unknown type name ‘GFC_LOGICAL_4’
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_4) gfc_array_l4;
^
libgfortran/libgfortran.h:245:3: note: in definition of macro ‘GFC_ARRAY_DESCRIPTOR’
type *data;\
^
libgfortran/libgfortran.h:276:51: error: unknown type name ‘GFC_LOGICAL_8’
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_8) gfc_array_l8;
^
libgfortran/libgfortran.h:245:3: note: in definition of macro ‘GFC_ARRAY_DESCRIPTOR’
type *data;\
^
libgfortran/libgfortran.h:456:51: error: expected ‘)’ before ‘char’
extern const char *gfc_itoa (GFC_INTEGER_LARGEST, char *, size_t);
^
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:457:16: error: ‘gfc_itoa’ undeclared here (not in a function)
internal_proto(gfc_itoa);
^
libgfortran/libgfortran.h:79:52: note: in definition of macro ‘sym_rename2’
#define sym_rename2(old, ulp, new) extern __typeof(old) old __asm__(#ulp #new)
^
libgfortran/libgfortran.h:77:30: note: in expansion of macro ‘sym_rename1’
#define sym_rename(old, new) sym_rename1(old, __USER_LABEL_PREFIX__, new)
^
libgfortran/libgfortran.h:120:28: note: in expansion of macro ‘sym_rename’
# define internal_proto(x) sym_rename(x, IPREFIX(x))
^
libgfortran/libgfortran.h:457:1: note: in expansion of macro ‘internal_proto’
internal_proto(gfc_itoa);
^
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:459:48: error: expected ‘)’ before ‘char’
extern const char *xtoa (GFC_UINTEGER_LARGEST, char *, size_t);
^
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:460:16: error: ‘xtoa’ undeclared here (not in a function)
internal_proto(xtoa);
^
libgfortran/libgfortran.h:79:52: note: in definition of macro ‘sym_rename2’
#define sym_rename2(old, ulp, new) extern __typeof(old) old __asm__(#ulp #new)
^
libgfortran/libgfortran.h:77:30: note: in expansion of macro ‘sym_rename1’
#define sym_rename(old, new) sym_rename1(old, __USER_LABEL_PREFIX__, new)
^
libgfortran/libgfortran.h:120:28: note: in expansion of macro ‘sym_rename’
# define internal_proto(x) sym_rename(x, IPREFIX(x))
^
libgfortran/libgfortran.h:460:1: note: in expansion of macro ‘internal_proto’
internal_proto(xtoa);
^
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:550:1: warning: parameter names (without types) in function declaration
extern void stop_numeric (GFC_INTEGER_4);
^
libgfortran/libgfortran.h:563:1: error: unknown type name ‘GFC_INTEGER_4’
GFC_INTEGER_4 *internal_pack_4 (gfc_array_i4 *);
^
libgfortran/libgfortran.h:566:1: error: unknown type name ‘GFC_INTEGER_8’
GFC_INTEGER_8 *internal_pack_8 (gfc_array_i8 *);
^
libgfortran/libgfortran.h:574:1: error: unknown type name ‘GFC_COMPLEX_4’
GFC_COMPLEX_4 *internal_pack_c4 (gfc_array_c4 *);
^
libgfortran/libgfortran.h:577:1: error: unknown type name ‘GFC_COMPLEX_8’
GFC_COMPLEX_8 *internal_pack_c8 (gfc_array_c8 *);
^
libgfortran/libgfortran.h:585:54: error: unknown type name ‘GFC_INTEGER_4’
extern void internal_unpack_4 (gfc_array_i4 *, const GFC_INTEGER_4 *);
^
libgfortran/libgfortran.h:588:54: error: unknown type name ‘GFC_INTEGER_8’
extern void internal_unpack_8 (gfc_array_i8 *, const GFC_INTEGER_8 *);
^
libgfortran/libgfortran.h:596:55: error: unknown type name ‘GFC_COMPLEX_4’
extern void internal_unpack_c4 (gfc_array_c4 *, const GFC_COMPLEX_4 *);
^
libgfortran/libgfortran.h:599:55: error: unknown type name ‘GFC_COMPLEX_8’
extern void internal_unpack_c8 (gfc_array_c8 *, const GFC_COMPLEX_8 *);
^
libgfortran/libgfortran.h:609:8: error: unknown type name ‘GFC_INTEGER_4’
extern GFC_INTEGER_4 compare_string (GFC_INTEGER_4, const char *,
^
libgfortran/libgfortran.h:609:53: error: expected ‘)’ before ‘const’
extern GFC_INTEGER_4 compare_string (GFC_INTEGER_4, const char *,
^
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:611:15: error: ‘compare_string’ undeclared here (not in a function)
iexport_proto(compare_string);
^
libgfortran/libgfortran.h:79:52: note: in definition of macro ‘sym_rename2’
#define sym_rename2(old, ulp, new) extern __typeof(old) old __asm__(#ulp #new)
^
libgfortran/libgfortran.h:77:30: note: in expansion of macro ‘sym_rename1’
#define sym_rename(old, new) sym_rename1(old, __USER_LABEL_PREFIX__, new)
^
libgfortran/libgfortran.h:139:26: note: in expansion of macro ‘sym_rename’
# define export_proto(x) sym_rename(x, PREFIX(x))
^
libgfortran/libgfortran.h:141:27: note: in expansion of macro ‘export_proto’
# define iexport_proto(x) export_proto(x)
^
libgfortran/libgfortran.h:611:1: note: in expansion of macro ‘iexport_proto’
iexport_proto(compare_string);
^
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:615:26: error: unknown type name ‘GFC_INTEGER_4’
extern void random_seed (GFC_INTEGER_4 * size, gfc_array_i4 * put,
^
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:617:15: error: ‘random_seed’ undeclared here (not in a function)
iexport_proto(random_seed);
^
libgfortran/libgfortran.h:79:52: note: in definition of macro ‘sym_rename2’
#define sym_rename2(old, ulp, new) extern __typeof(old) old __asm__(#ulp #new)
^
libgfortran/libgfortran.h:77:30: note: in expansion of macro ‘sym_rename1’
#define sym_rename(old, new) sym_rename1(old, __USER_LABEL_PREFIX__, new)
^
libgfortran/libgfortran.h:139:26: note: in expansion of macro ‘sym_rename’
# define export_proto(x) sym_rename(x, PREFIX(x))
^
libgfortran/libgfortran.h:141:27: note: in expansion of macro ‘export_proto’
# define iexport_proto(x) export_proto(x)
^
libgfortran/libgfortran.h:617:1: note: in expansion of macro ‘iexport_proto’
iexport_proto(random_seed);
^
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:621:8: error: unknown type name ‘GFC_REAL_4’
extern GFC_REAL_4 normalize_r4_i4 (GFC_UINTEGER_4, GFC_UINTEGER_4);
^
libgfortran/libgfortran.h:621:1: warning: parameter names (without types) in function declaration
extern GFC_REAL_4 normalize_r4_i4 (GFC_UINTEGER_4, GFC_UINTEGER_4);
^
libgfortran/libgfortran.h:624:8: error: unknown type name ‘GFC_REAL_8’
extern GFC_REAL_8 normalize_r8_i8 (GFC_UINTEGER_8, GFC_UINTEGER_8);
^
libgfortran/libgfortran.h:624:1: warning: parameter names (without types) in function declaration
extern GFC_REAL_8 normalize_r8_i8 (GFC_UINTEGER_8, GFC_UINTEGER_8);
^
libgfortran/runtime/compile_options.c:40:1: warning: parameter names (without types) in function declaration
extern void set_std (GFC_INTEGER_4, GFC_INTEGER_4, GFC_INTEGER_4);
^
libgfortran/runtime/compile_options.c:45:10: error: unknown type name ‘GFC_INTEGER_4’
set_std (GFC_INTEGER_4 warn_std, GFC_INTEGER_4 allow_std,
^
libgfortran/runtime/compile_options.c:45:34: error: unknown type name ‘GFC_INTEGER_4’
set_std (GFC_INTEGER_4 warn_std, GFC_INTEGER_4 allow_std,
^
libgfortran/runtime/compile_options.c:46:3: error: unknown type name ‘GFC_INTEGER_4’
GFC_INTEGER_4 pedantic)
^
libgfortran/runtime/compile_options.c: In function ‘set_record_marker’:
libgfortran/runtime/compile_options.c:89:19: error: ‘GFC_INTEGER_4’ undeclared (first use in this function)
if (sizeof (GFC_INTEGER_4) != sizeof (gfc_offset))
^
libgfortran/runtime/compile_options.c:89:19: note: each undeclared identifier is reported only once for each function it appears in
libgfortran/runtime/compile_options.c:94:19: error: ‘GFC_INTEGER_8’ undeclared (first use in this function)
if (sizeof (GFC_INTEGER_8) != sizeof (gfc_offset))
^
make[1]: *** [compile_options.lo] Error 1
make[1]: Leaving directory `C:/Users/jdoubleb/Documents/Academia/Cygwin_etal/gcc-4.1.1'
make: *** [all] Error 2
J Double B#jdoubleb-PC /gcc-4.1.1
*FROM LINUX*
[wexlerlab#AirWay~/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1 ]$ make
cat: libgfortran/../gcc/BASE-VER: No such file or directory
/bin/sh libgfortran/mk-sik-inc.sh 'gfortran -I . -Wall -fno-repack-arrays -fno-underscoring -g -O2' > selected_int_kind.inc || rm selected_int_kind.inc
/bin/sh libgfortran/mk-srk-inc.sh 'gfortran -I . -Wall -fno-repack-arrays -fno-underscoring -g -O2' > selected_real_kind.inc || rm selected_real_kind.inc
/bin/sh libgfortran/mk-kinds-h.sh 'gfortran -I . -Wall -fno-repack-arrays -fno-underscoring -g -O2' > kinds.h || rm kinds.h
grep '^#' < kinds.h > kinds.inc
grep '^#' < libgfortran/c99_protos.h > c99_protos.inc
cp libgfortran/config/fpu-glibc.h fpu-target.h
make all-am
cat: libgfortran/../gcc/BASE-VER: No such file or directory
make[1]: Entering directory `/home/wexlerlab/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1'
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -c -o compile_options.lo `test -f 'runtime/compile_options.c' || echo 'libgfortran/'`runtime/compile_options.c
mkdir .libs
gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -c libgfortran/runtime/compile_options.c -fPIC -DPIC -o .libs/compile_options.o
gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -c libgfortran/runtime/compile_options.c -o compile_options.o >/dev/null 2>&1
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -c -o environ.lo `test -f 'runtime/environ.c' || echo 'libgfortran/'`runtime/environ.c
gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -c libgfortran/runtime/environ.c -fPIC -DPIC -o .libs/environ.o
In file included from libgfortran/runtime/environ.c:37:
libgfortran/runtime/../io/io.h:36:18: error: gthr.h: No such file or directory
In file included from libgfortran/runtime/environ.c:37:
libgfortran/runtime/../io/io.h:504: error: expected specifier-qualifier-list before '__gthread_mutex_t'
libgfortran/runtime/../io/io.h:699: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'unit_lock'
libgfortran/runtime/../io/io.h:700: error: 'unit_lock' undeclared here (not in a function)
libgfortran/runtime/../io/io.h:700: warning: type defaults to 'int' in declaration of 'unit_lock'
libgfortran/runtime/../io/io.h: In function 'inc_waiting_locked':
libgfortran/runtime/../io/io.h:890: error: 'gfc_unit' has no member named 'waiting'
libgfortran/runtime/../io/io.h:890: error: incompatible type for argument 1 of '__sync_fetch_and_add'
libgfortran/runtime/../io/io.h: In function 'predec_waiting_locked':
libgfortran/runtime/../io/io.h:900: error: 'gfc_unit' has no member named 'waiting'
libgfortran/runtime/../io/io.h:900: error: incompatible type for argument 1 of '__sync_add_and_fetch'
libgfortran/runtime/../io/io.h:904: warning: control reaches end of non-void function
libgfortran/runtime/../io/io.h: In function 'dec_waiting_unlocked':
libgfortran/runtime/../io/io.h:910: error: 'gfc_unit' has no member named 'waiting'
libgfortran/runtime/../io/io.h:910: error: incompatible type for argument 1 of '__sync_fetch_and_add'
make[1]: *** [environ.lo] Error 1
make[1]: Leaving directory `/home/wexlerlab/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1'
make: *** [all] Error 2
[wexlerlab#AirWay~/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1 ]$ cd libgfortran/
[wexlerlab#AirWay~/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1/libgfortran ]$ automake
[wexlerlab#AirWay~/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1/libgfortran ]$ cd..
-bash: cd..: command not found
[wexlerlab#AirWay~/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1/libgfortran ]$ make
make: *** No targets specified and no makefile found. Stop.
[wexlerlab#AirWay~/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1/libgfortran ]$ cd ..
[wexlerlab#AirWay~/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1 ]$ make
cat: libgfortran/../gcc/BASE-VER: No such file or directory
cd . && /bin/sh ./config.status Makefile
config.status: creating Makefile
cat: libgfortran/../gcc/BASE-VER: No such file or directory
make all-am
cat: libgfortran/../gcc/BASE-VER: No such file or directory
make[1]: Entering directory `/home/wexlerlab/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1'
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -c -o environ.lo `test -f 'runtime/environ.c' || echo 'libgfortran/'`runtime/environ.c
gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -c libgfortran/runtime/environ.c -fPIC -DPIC -o .libs/environ.o
In file included from libgfortran/runtime/environ.c:37:
libgfortran/runtime/../io/io.h:36:18: error: gthr.h: No such file or directory
In file included from libgfortran/runtime/environ.c:37:
libgfortran/runtime/../io/io.h:504: error: expected specifier-qualifier-list before '__gthread_mutex_t'
libgfortran/runtime/../io/io.h:699: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'unit_lock'
libgfortran/runtime/../io/io.h:700: error: 'unit_lock' undeclared here (not in a function)
libgfortran/runtime/../io/io.h:700: warning: type defaults to 'int' in declaration of 'unit_lock'
libgfortran/runtime/../io/io.h: In function 'inc_waiting_locked':
libgfortran/runtime/../io/io.h:890: error: 'gfc_unit' has no member named 'waiting'
libgfortran/runtime/../io/io.h:890: error: incompatible type for argument 1 of '__sync_fetch_and_add'
libgfortran/runtime/../io/io.h: In function 'predec_waiting_locked':
libgfortran/runtime/../io/io.h:900: error: 'gfc_unit' has no member named 'waiting'
libgfortran/runtime/../io/io.h:900: error: incompatible type for argument 1 of '__sync_add_and_fetch'
libgfortran/runtime/../io/io.h:904: warning: control reaches end of non-void function
libgfortran/runtime/../io/io.h: In function 'dec_waiting_unlocked':
libgfortran/runtime/../io/io.h:910: error: 'gfc_unit' has no member named 'waiting'
libgfortran/runtime/../io/io.h:910: error: incompatible type for argument 1 of '__sync_fetch_and_add'
make[1]: *** [environ.lo] Error 1
make[1]: Leaving directory `/home/wexlerlab/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1'
make: *** [all] Error 2
[wexlerlab#AirWay~/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1 ]$
I have downloaded the following code:
CVPR 2014 intersection over union optimization code
cvpr2014-iou-code-1.0.zip
http://research.microsoft.com/en-us/downloads/e164fe21-ef2b-4e34-98c1-4868968abb06/
What I get is an archive with two folders, one called src/ and another one called matlab/. I am running Linux Fedora 19 and I can compile the code in src/ just fine. The problem arises when I try to compile the code in matlab/.
The README says:
Matlab compilation
------------------
From within Matlab, configure the compiler using "mex -setup", then adjust the
paths in matlab\compile_windows.m or matlab/compile_linux.m scripts and run
either "compile_linux.m" or "compile_windows.m" in the "matlab" directory.
More specifically for Linux:
Linux
=====
From within Matlab run "mex -setup", then edit the mexopts.sh file and modify
the settings
CXXFLAGS='-std=c++11 -fopenmp -march=native -D_GNU_SOURCE'
CXXLIBS="$RPATH $MLIBS -lm -lgomp"
CXXOPTIMFLAGS='-Ofast -DNDEBUG'
This will enable OpenMP and C++11 and should work from G++ 4.7 onwards.
From the matlab/ directory, call compile_linux to build all mex files.
So I open matlab and run mex -setup. I answer yes to the question:
>> mex -setup
Options files control which compiler to use, the compiler and link command
options, and the runtime libraries to link against.
Using the 'mex -setup' command selects an options file that is
placed in /user/wok/home/.matlab/R2012b and used by default for 'mex'. An options
file in the current working directory or specified on the command line
overrides the default options file in /user/wok/home/.matlab/R2012b.
To override the default options file, use the 'mex -f' command
(see 'mex -help' for more information).
The options files available for mex are:
1: /opt/matlab2012b/bin/mexopts.sh :
Template Options file for building gcc MEX-files
0: Exit with no changes
Enter the number of the compiler (0-1):
1
Overwrite /user/wok/home/.matlab/R2012b/mexopts.sh ([y]/n)?
y
/opt/matlab2012b/bin/mexopts.sh is being copied to
/user/wok/home/.matlab/R2012b/mexopts.sh
**************************************************************************
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the new
API. You can find more information about this at:
http://www.mathworks.com/help/techdoc/matlab_external/bsflnue-1.html
Building with the -largeArrayDims option enables the new API.
**************************************************************************
Then I edit the file /user/wok/home/.matlab/R2012b/mexopts.sh and I follow the instructions from the README:
CXX='g++'
CXXFLAGS='-ansi -D_GNU_SOURCE'
CXXFLAGS="$CXXFLAGS -D_FILE_OFFSET_BITS=64"
CXXFLAGS="$CXXFLAGS -fPIC -pthread"
CXXLIBS="$RPATH $MLIBS -lm"
CXXOPTIMFLAGS='-O -DNDEBUG'
CXXDEBUGFLAGS='-g'
becomes:
CXX='g++'
CXXFLAGS='-std=c++11 -fopenmp -march=native -D_GNU_SOURCE'
CXXLIBS="$RPATH $MLIBS -lm -lgomp"
CXXOPTIMFLAGS='-Ofast -DNDEBUG'
CXXDEBUGFLAGS='-g'
After this step, I open matlab and edit compile_linux.m to add the path to Boost:
% You need to have boost 1.49 or higher installed (package libboost-dev on
% most distributions)
%
% Tested on Ubuntu 13.10, Matlab R2012b, gcc 4.8.1
% TODO: this assumes that boost headers are available in /usr/include, as on
% most systems. If you manually installed boost, please add -I/path/to/boost
mex -v -O ...
-output mex_voc_optimize -I../src ...
-I/user/wok/home/Softwares/Boost_1.54/include/boost ...
mex_voc_optimize.cpp matlab_helpers.cpp ...
-largeArrayDims
Edit: Following the first comment from Praetorian, I have added the -v flag.
Finally I run compile_linux, only to get a long list of errors, which I have shortened and pasted below:
>> compile_linux
-> mexopts.sh sourced from directory (DIR = $PREF_DIR)
FILE = /user/wok/home/.matlab/R2012b/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /opt/matlab2012b
-> CC = gcc
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread
CDEBUGFLAGS = -g
COPTIMFLAGS = -O -DNDEBUG
CLIBS = -Wl,-rpath-link,/opt/matlab2012b/bin/glnxa64 -L/opt/matlab2012b/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++
arguments =
-> CXX = g++
-> CXX flags:
CXXFLAGS = -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/opt/matlab2012b/bin/glnxa64 -L/opt/matlab2012b/bin/glnxa64 -lmx -lmex -lmat -lm
arguments =
-> FC = gfortran
-> FC flags:
FFLAGS = -fexceptions -fbackslash -fPIC -fno-omit-frame-pointer
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O
FLIBS = -Wl,-rpath-link,/opt/matlab2012b/bin/glnxa64 -L/opt/matlab2012b/bin/glnxa64 -lmx -lmex -lmat -lm
arguments =
-> LD = g++
-> Link flags:
LDFLAGS = -pthread -shared -Wl,--version-script,/opt/matlab2012b/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexa64
arguments =
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments =
----------------------------------------------------------------
Warning: You are using gcc version "4.8.2". The version
currently supported with MEX is "4.4.6".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/
-> g++ -c -I../src -I/user/wok/home/Softwares/Boost_1.54/include/boost -I/opt/matlab2012b/extern/include -I/opt/matlab2012b/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread -O -DNDEBUG "mex_voc_optimize.cpp"
In file included from /usr/include/c++/4.8.2/cstdint:35:0,
from mex_voc_optimize.cpp:8:
/usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
In file included from ../src/lfp.h:18:0,
from ../src/voc.h:15,
from mex_voc_optimize.cpp:19:
../src/timing.h:15:2: error: ‘chrono’ in namespace ‘std’ does not name a type
std::chrono::time_point<std::chrono::high_resolution_clock> start_time;
^
../src/timing.h: In member function ‘double timer::elapsed_this_period() const’:
../src/timing.h:20:8: error: ‘std::chrono’ has not been declared
std::chrono::time_point<std::chrono::high_resolution_clock> end_time
^
../src/timing.h:20:32: error: ‘std::chrono’ has not been declared
std::chrono::time_point<std::chrono::high_resolution_clock> end_time
until
../src/voc.h:418:31: note: ‘P’ declared here, later in the translation unit
alpha[k_best] += P(j,k_best);
^
../src/voc.h: In instantiation of ‘std::pair<double, double> voc::prediction_function<TFloat>::compute_objective_c(int) const [with TFloat = double]’:
../src/voc.h:328:56: required from ‘double voc::prediction_function<TFloat>::compute_objective() const [with TFloat = double]’
mex_voc_optimize.cpp:250:39: required from here
../src/voc.h:315:17: error: ‘P’ was not declared in this scope
A_c += P(i,c);
^
../src/voc.h:318:17: error: ‘P’ was not declared in this scope
D_c += P(i,c);
^
mex: compile of ' "mex_voc_optimize.cpp"' failed.
Error using mex (line 206)
Unable to complete successfully.
Error in compile_linux (line 9)
mex -O ...
>>
I have tried editing the code to remove every call to chrono (for timers), then to replace unordered_map with map, etc., but it is a pain. I would like to be able to compile the mex file in matlab/ just like I can compile the c++ code in src/
Thanks to Praetorian's comment, I could pinpoint the problem. I had edited the wrong lines in mexopts.sh. Indeed, the CXXFLAGS appears at 3 different places, I had edited the flags at the first place, but it was necessary and sufficient to edit it at the second place (the first place was a decoy).
See for instance:
$ grep -n CXXLIBS /user/wok/home/.matlab/R2012b/mexopts.sh
74: CXXLIBS="$RPATH $MLIBS -lm"
129: CXXLIBS="$RPATH $MLIBS -lm"
199: CXXLIBS="$MLIBS -lstdc++"
So I edited the lines around line 129. The following lines
CXX='g++'
CXXFLAGS='-ansi -D_GNU_SOURCE'
CXXFLAGS="$CXXFLAGS -fPIC -fno-omit-frame-pointer -pthread"
CXXLIBS="$RPATH $MLIBS -lm"
CXXOPTIMFLAGS='-O -DNDEBUG'
CXXDEBUGFLAGS='-g'
become
CXX='g++'
CXXFLAGS='-std=c++11 -fopenmp -march=native -D_GNU_SOURCE'
CXXFLAGS="$CXXFLAGS -fPIC -fno-omit-frame-pointer -pthread"
CXXLIBS="$RPATH $MLIBS -lm -lgomp"
CXXOPTIMFLAGS='-Ofast -DNDEBUG'
CXXDEBUGFLAGS='-g'
I am compiling the C++ code using Android native library NDK but I am getting the following errors while trying to include the g729a.h file in g729_jni.cpp:
ERRORS:
Compile++ arm : g729_jni <= g729_jni.cpp
/usr/src/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-g++ -MMD -MP -MF ./obj/local/armeabi/objs/g729_jni/g729_jni.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -O2 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -I/usr/src/android-ndk-r8/sources/cxx-stl/system/include -Ijni -DANDROID -O3 -Wa,--noexecstack -O2 -DNDEBUG -g -I/usr/src/android-ndk-r8/platforms/android-3/arch-arm/usr/include -c jni/g729_jni.cpp -o ./obj/local/armeabi/objs/g729_jni/g729_jni.o
In file included from jni/g729_jni.cpp:34:
jni/g729/g729a.h:70: error: 'UWord8' has not been declared
jni/g729/g729a.h:126: error: 'UWord8' has not been declared
jni/g729_jni.cpp: In function 'jint Java_org_sipdroid_codecs_G729_open(JNIEnv*, _jobject*)':
jni/g729_jni.cpp:72: error: 'UWord8' was not declared in this scope
jni/g729_jni.cpp: In function 'jint Java_org_sipdroid_codecs_G729_encode(JNIEnv*, _jobject*, _jshortArray*, jint, _jbyteArray*, jint)':
jni/g729_jni.cpp:111: error: 'UWord8' was not declared in this scope
jni/g729_jni.cpp:111: error: expected ';' before 'serial'
jni/g729_jni.cpp:125: error: 'serial' was not declared in this scope
jni/g729_jni.cpp: In function 'jint Java_org_sipdroid_codecs_G729_decode(JNIEnv*, _jobject*, _jbyteArray*, _jshortArray*, jint)':
jni/g729_jni.cpp:156: error: cannot convert 'unsigned char*' to 'int*' for argument '2' to 'void g729a_dec_process(void*, int*, Word16*, Flag)'
make: *** [obj/local/armeabi/objs/g729_jni/g729_jni.o] Error 1
I googled to try and find the reason behind this error. As C++ is case sensitive, if we make a mistake in upper and lower case, then this kind of error occurs. But I didn't make this kind of mistakes.
If you have any idea or suggestion then please guide me through that.
Thanks
UPDATE:
[root#localhost sipdroid-read-only]# /usr/src/android-ndk-r8/ndk-build V=1 APP_ABI=armeabi APP_PROJECT_PATH=. obj/local/armeabi/objs/g729_jni/g729_jni.o
make: `obj/local/armeabi/objs/g729_jni/g729_jni.o' is up to date.
Make sure your typedef.h is similar to http://siphon.googlecode.com/svn/trunk/g729a/Headers/typedef.h
Here are the steps I made to reproduce your problem:
svn checkout http://sipdroid.googlecode.com/svn/trunk/ sipdroid
cd sipdroid
sed "s/^SILK/include $(CLEAR_VARS)\\nSILK/" -i jni/Android.mk
(note that Android.mk needed a fix after line 89).
svn checkout http://siphon.googlecode.com/svn/trunk/ ../siphon
cp -d ../siphon/g729a/Headers/ jni/g729
wget http://pastie.org/pastes/4737332/download -O jni/g729/g729a.h
wget "http://sipdroid.googlecode.com/issues/attachment?aid=7963991223373796529&name=g729_jni.cpp&token=KHEZCoq6ZYSuV_VhsV8fC3uwsSs%3A1348058591979" -O jni/g729_jni.cpp
sed -e "s/g722_jni/g729_jni/" -i jni/Android.mk
ndk-build.cmd V=1 APP_ABI=armeabi APP_PROJECT_PATH=. obj/local/armeabi/objs/g729_jni/g729_jni.o
... and your file compiles with a small warning. What have you done differently?