Reputation: 9369
I have built GCC 4.7 on my x86 32-bit linux system. When I try to cross-compile with the -m64 flag I get the following:
sorry, unimplemented: 64-bit mode not compiled in
while the compiler provided by default by my Linux distribution can cross-compile with -m64.
What do I have to pass to ./configure to enable the 64bit mode in GCC? These are the options I used to build GCC 4.7:
$ /usr/local/bin/g++ -v Using built-in specs.
COLLECT_GCC=/usr/local/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i686-pc-linux-gnu/4.7.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ./configure --enable-multiarch --with-cloog=/usr/local/ --with-mpfr=/usr/local/ --with-ppl=/usr/local/ --verbose --enable-languages=c,c++
Thread model: posix gcc version 4.7.0 20120113 (experimental) (GCC)
EDIT:
--enable-multilib and --enable-targets=i686-pc-linux-gnu,x86_64-pc-linux-gnu
do not change the situation. The compiler still complains about 64 bit mode not compiled in:
$ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i686-pc-linux-gnu/4.7.0/lto-wrapper Target: i686-pc-linux-gnu Configured with: ./configure --enable-multiarch --with-cloog=/usr/local/ --with-mpfr=/usr/local/ --with-ppl=/usr/local/ --verbose --enable-languages=c,c++ --enable-multilib --enable-targets=i686-pc-linux-gnu,x86_64-pc-linux-gnu Thread model: posix gcc version 4.7.0 20120113 (experimental) (GCC)
$ g++ -m64 c.cpp c.cpp:1:0: sorry, unimplemented: 64-bit mode not compiled in
Upvotes: 31
Views: 60598
Reputation: 9
I had the same problem on windows. Despite installing codeblock 20.03 I couldn't compile my code 64 bit. I solved it by setting the compiler to x86_64-w64-mingw32-g++.exe instead of g++.exe. It was in the bin directory as g++.exe. In windows go to Settings menue and: Settings->Compiler... select the "toolchain executables" tab and and from there on it is obvious.
Upvotes: 0
Reputation: 2047
Had the same issues. My solution:
Update everything (R, Rstudio, R packages) and close Rstudio.
Uninstall Rtools and install the latest version.
Add only 2 entries under Enviroment Variables/System variables/Path:
- C:\Rtools\bin
- C:\Rtools\mingw_64\bin (!not the 32bit version)
Path entries have to be in this order and above %SystemRoot\System32
I did NOT install in the strongly recommended default location on C:
After that open Rstudio and re-install Rcpp via console:
install.packages("Rcpp")
Test if it's working with:
Rcpp::evalCpp("2+2")
After that just switch to the Terminal in Rstudio, go into the cmdstan source folder and type 'make build'.
--- CmdStan v2.19.1 built ---
Done!
Details:
*> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=Slovenian_Slovenia.1250 LC_CTYPE=Slovenian_Slovenia.1250 LC_MONETARY=Slovenian_Slovenia.1250 LC_NUMERIC=C
[5] LC_TIME=Slovenian_Slovenia.1250
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.0 tools_3.6.0*
Upvotes: -1
Reputation: 198
Just resolved this issue. In the environment variables, remove the entries to any outdated c++ package.
In my case, I worked in Anaconda on Windows 64-bit. In anaconda, I performed 'conda install mingw libpython'.
Mingw is for c++ compiler. But I had earlier installed cygwin's mingw for c++ compilations which hadn't been updated. This is the reason for conflict.
I resolved this issue by simply removing the environment variable (PATH) corresponding to these c++ packages.
I have tried almost all forums, this solution works.
Please let me know in case anyone needs help. :)
Upvotes: 1
Reputation: 6784
This typically means that you're using the wrong (old) compiler.
The new compilers support both -m32 and -m64. You have to set the PATH to the new compilers (in the gcc,MinGW subdirectory of Rtools) before any old compilers in Rtools.
Try updating your compiler's binary lib path to 64bit version. Other resources like lib folders also should change accordingly.
Upvotes: 23
Reputation: 76519
You will need both binutils and gcc configured with:
--enable-multilib
and probably:
--enable-targets=i686-pc-linux-gnu,x86_64-pc-linux-gnu
to support multilib (the -m64
and/or -m32
options). You'll also need two versions of stuff like glibc to be able to link and run the resulting binaries.
Upvotes: 11