Operating System: CentOS 6.8
Compiler: gcc 4.8.2 and g++4.8.2
Steps to reproduce
Just follow the steps at installation guide
My steps
git clone --recursive https://github.com/dmlc/xgboost
git submodule init
git submodule update
cd xgboost
make -j4
Then I get the error below
[root#xxx]# make -j4
g++ -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/learner.o src/learner.cc >build/learner.d
g++ -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/logging.o src/logging.cc >build/logging.d
g++ -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/c_api/c_api.o src/c_api/c_api.cc >build/c_api/c_api.d
g++ -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/c_api/c_api_error.o src/c_api/c_api_error.cc >build/c_api/c_api_error.d
g++ -c -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -fopenmp src/c_api/c_api_error.cc -o build/c_api/c_api_error.o
g++ -c -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -fopenmp src/learner.cc -o build/learner.o
g++ -c -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -fopenmp src/logging.cc -o build/logging.o
g++ -c -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -fopenmp src/c_api/c_api.cc -o build/c_api/c_api.o
g++ -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/common/common.o src/common/common.cc >build/common/common.d
g++ -c -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -fopenmp src/common/common.cc -o build/common/common.o
g++ -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/data/data.o src/data/data.cc >build/data/data.d
g++ -c -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -fopenmp src/data/data.cc -o build/data/data.o
g++ -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/data/simple_csr_source.o src/data/simple_csr_source.cc >build/data/simple_csr_source.d
g++ -c -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -fopenmp src/data/simple_csr_source.cc -o build/data/simple_csr_source.o
/tmp/ccNp7oXM.s: Assembler messages:
/tmp/ccNp7oXM.s:148: Error: expecting string instruction after `rep'
/tmp/ccNp7oXM.s:1796: Error: expecting string instruction after `rep'
/tmp/ccNp7oXM.s:4394: Error: expecting string instruction after `rep'
make: *** [build/data/simple_csr_source.o] Error 1
make: *** Waiting for unfinished jobs....
/tmp/ccnxYuhm.s: Assembler messages:
/tmp/ccnxYuhm.s:44: Error: expecting string instruction after `rep'
/tmp/ccnxYuhm.s:272: Error: expecting string instruction after `rep'
/tmp/ccnxYuhm.s:276: Error: expecting string instruction after `rep'
/tmp/ccnxYuhm.s:316: Error: expecting string instruction after `rep'
/tmp/ccnxYuhm.s:29012: Error: expecting string instruction after `rep'
make: *** [build/learner.o] Error 1
/tmp/ccyHo0ol.s: Assembler messages:
/tmp/ccyHo0ol.s:331: Error: expecting string instruction after `rep'
/tmp/ccyHo0ol.s:386: Error: expecting string instruction after `rep'
/tmp/ccyHo0ol.s:555: Error: expecting string instruction after `rep'
/tmp/ccyHo0ol.s:11407: Error: expecting string instruction after `rep'
/tmp/ccyHo0ol.s:17712: Error: expecting string instruction after `rep'
make: *** [build/c_api/c_api.o] Error 1
/tmp/cc3gD7Gv.s: Assembler messages:
/tmp/cc3gD7Gv.s:82: Error: expecting string instruction after `rep'
make: *** [build/data/data.o] Error 1
Is any suggestion for the root cause?
I am not familiar with xgboost, however from the error it seems obvious that some ASM code is not getting generated properly:
expecting string instruction after `rep'
The REP keyword prefix in ASM means "repeat this instruction a number of times (defined by the C register)".
However it could also be a problem with your toolchain. Actually, if the code that generates this error is not relying on inline ASM, it would seem likely that this is a toolchain error.
Some versions of binutils consider rep ret to be invalid, while it is in fact a valid x86-64 instruction.
Try upgrading to binutils 2.23.52.0.1
Related
I've developing R packages that contain C++ code on Windows 10.
I wish to check for memory allocation errors. It sounds like the simplest path is to use clang++ with the -fsanitize=address option.
How do I configure R such that clang is the default compiler?
What I've done so far:
Install LLVM, adding binaries to the path
Set the following options in ~/.R/makevars:
CC = "path/to/llvm/bin/clang"
CXX = "path/to/llvm/bin/clang++"
CXX11 = "path/to/llvm/bin/clang++"
CXX14 = "path/to/llvm/bin/clang++"
CXXFLAGS = -O1 -g -fsanitize=address -fno-omit-frame-pointer
PKG_CXXFLAGS = -Og -fsanitize=address
LDFLAGS = -fsanitize=address
Within RStudio, run devtools::install(). I see:
- installing *source* package 'TreeTools' ...
** using staged installation
** libs
"path/to/llvm/bin/clang++" -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG -I'C:/Users/ms609/Documents/R/win-library/4.0/Rcpp/include' -Og -Wall -pedantic -mtune=generic -fsanitize=address -Wno-deprecated-declarations -O2 -Wall -gdwarf-2 -mfpmath=sse -msse2 -mstackrealign -c as_newick.cpp -o as_newick.o
"path/to/llvm/bin/clang++" -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG -I'C:/Users/ms609/Documents/R/win-library/4.0/Rcpp/include' -Og -Wall -pedantic -mtune=generic -fsanitize=address -Wno-deprecated-declarations -O2 -Wall -gdwarf-2 -mfpmath=sse -msse2 -mstackrealign -c int_to_tree.cpp -o int_to_tree.o
"path/to/llvm/bin/clang++" -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG -I'C:/Users/ms609/Documents/R/win-library/4.0/Rcpp/include' -Og -Wall -pedantic -mtune=generic -fsanitize=address -Wno-deprecated-declarations -O2 -Wall -gdwarf-2 -mfpmath=sse -msse2 -mstackrealign -c phangorn_bip.cpp -o phangorn_bip.o
"path/to/llvm/bin/clang++" -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG -I'C:/Users/ms609/Documents/R/win-library/4.0/Rcpp/include' -Og -Wall -pedantic -mtune=generic -fsanitize=address -Wno-deprecated-declarations -O2 -Wall -gdwarf-2 -mfpmath=sse -msse2 -mstackrealign -c renumber_tree.cpp -o renumber_tree.o
"path/to/llvm/bin/clang++" -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG -I'C:/Users/ms609/Documents/R/win-library/4.0/Rcpp/include' -Og -Wall -pedantic -mtune=generic -fsanitize=address -Wno-deprecated-declarations -O2 -Wall -gdwarf-2 -mfpmath=sse -msse2 -mstackrealign -c splits.cpp -o splits.o
"path/to/llvm/bin/clang++" -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG -I'C:/Users/ms609/Documents/R/win-library/4.0/Rcpp/include' -Og -Wall -pedantic -mtune=generic -fsanitize=address -Wno-deprecated-declarations -O2 -Wall -gdwarf-2 -mfpmath=sse -msse2 -mstackrealign -c tree_shape.cpp -o tree_shape.o
path/to/llvm/bin/clang++ -shared -o TreeTools.dll tmp.def RcppExports.o TreeTools-init.o as_newick.o int_to_tree.o phangorn_bip.o renumber_tree.o splits.o tree_shape.o -LC:/PROGRA~1/R/R-40~1.0/bin/i386 -lR
tmp.def : fatal error LNK1107: invalid or corrupt file: cannot read at 0x1E50
clang++: error: linker command failed with exit code 1107 (use -v to see invocation)
no DLL was created
ERROR: compilation failed for package 'TreeTools'
R seems to have successfully compiled individual source files successfully using clang, but is failing to create a .dll.
What have I missed: do I need to do anything to configure Rcmd or Rtools to run with clang rather than the default gcc?
I am trying to add -std=c++0x into the eclipse Ubuntu but I do not know how to add it.
My original set up:
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/copy2.d" -MT"src/copy2.d" -o "src/copy2.o" "../src/copy2.cpp"
Does not include -std=c++0x that's why giving me the error when I run std::stoi:
error: stoi is not a member of std
My expectation:
g++ -std=c++0x -O0 -g3 -Wall -c -fmessage-length=0 MMD -MP -MF"src/copy2.d" -MT"src/copy2.d" -o "src/copy2.o" "../src/copy2.cpp"
I'm trying to compile a program I found on the web using Clang++. The Makefile generates this command:
clang++ -c -arch x86_64 -msse3 -std=c++11 -stdlib=libstdc++
-Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type
-Wno-non-virtual-dtor -Wno-exit-time-destructors -Wformat -Wmissing-braces
-Wparentheses -Wno-switch -Wunused-function -Wunused-label -Wno-unused-parameter
-Wunused-variable -Wunused-value -Wno-empty-body -Wuninitialized -Wunknown-pragmas
-Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion
-Wint-conversion -Wno-shorten-64-to-32 -Wenum-conversion -Wno-newline-eof
-Wno-c++11-extensions -Wno-logical-op-parentheses -Wno-trigraphs
-Wno-invalid-offsetof -Wno-sign-conversion -Wdeprecated-declarations
-fmessage-length=0 -fno-exceptions -fstrict-aliasing -fvisibility=hidden
-fvisibility-inlines-hidden -funsafe-math-optimizations -ftrapping-math -fno-rtti
-fpascal-strings -fasm-blocks -O3 -Iinclude/ src/main.cpp
But I get
src/main.cpp:23:10: fatal error: 'unordered_map' file not found
#include <unordered_map>
^
1 error generated.
If I compile a simple program that includes <unordered_map> running clang++ test.cpp, it compiles fine.
I'm on
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix
I had the same issue when compiling glogg.
As the comments have pointed out. it was stdlib.
In the makefile after running qmake. Change this line from
CXXFLAGS = -g -Wextra -std=c++11 -DGLOGG_VERSION=\"`cat .tarball-version`\" -O2 -arch x86_64 -Wall -W $(DEFINES)
To this line below
CXXFLAGS = -g -Wextra -std=c++11 -stdlib=libc++ -DGLOGG_VERSION=\"`cat .tarball-version`\" -O2 -arch x86_64 -Wall -W $(DEFINES)
notice "-stdlib=libc++" was specified in the cxxflags. It's autospecified in the linker flags, I guess it also needs to be specified in for the C++ flags.
It says -Wno-c++11-extensions. What wrote that makefile?
I have wrote a simple code which uses c++11 thread. It compiles correct but when I try to run it I have the following error:
terminate called after throwing an instance of 'std::system_error'
what(): Enable multithreading to use std::thread: Operation not permitted
Aborted (core dumped)
I am using gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1). This is the output of the makefile which I am using
g++ -std=c++11 -DHAVE_CONFIG_H -I. -I../../../.. -I../../../.. -I/usr/local_machine/openmpi-1.6.5/include -pthread -DMPIPP_H -DENABLE_MPI=1 -O3 -Wall -DNDEBUG -funroll-loops -finline-functions -pthread -fomit-frame-pointer -ffast-math -mfpmath=sse -msse3 -MT threadtest-threadtest.o -MD -MP -MF .deps/threadtest-threadtest.Tpo -c -o threadtest-threadtest.o `test -f 'threadtest.cc' || echo './'`threadtest.cc
mv -f .deps/threadtest-threadtest.Tpo .deps/threadtest-threadtest.Po
/bin/bash ../../../../libtool --tag=CXX --mode=link g++ -std=c++11 -O3 -Wall -DNDEBUG -funroll-loops -finline-functions -pthread -fomit-frame-pointer -ffast-math -mfpmath=sse -msse3 -o threadtest threadtest-threadtest.o -pthread -L/usr/local_machine/openmpi-1.6.5/lib -lmpi -ldl -lm -Wl,--export-dynamic -lrt -lnsl -lutil -lm -ldl ../../../../lib/libdunecommon.la -lm
libtool: link: g++ -std=c++11 -O3 -Wall -DNDEBUG -funroll-loops -finline-functions -pthread -fomit-frame-pointer -ffast-math -mfpmath=sse -msse3 -o threadtest threadtest-threadtest.o -pthread -Wl,--export-dynamic -L/usr/local_machine/openmpi-1.6.5/lib /usr/local_machine/openmpi-1.6.5/lib/libmpi.so -lrt -lnsl -lutil -ldl ../../../../lib/.libs/libdunecommon.a -llapack -lblas -lgfortran -lquadmath -lm -pthread -Wl,-rpath -Wl,/usr/local_machine/openmpi-1.6.5/lib -Wl,-rpath -Wl,/usr/local_machine/openmpi-1.6.5/lib
As you can see there is the flag -pthread. What am I doing wrong? Because if I compile a simple code as
g++ threadstest.cc -o threadstest -pthread -std=c++11
everything works fine therefore in my makefile there is something which interferes with -pthread but I don't understand what it is.
Additional information: a workaround which works is to add -Wl,--no-as-needed at the linking stage.
the answer for similar question "Compiling multithread code with g++ (-Wl,--no-as-needed NOT working)"
is
-pthread is a flag for the compiler, not the linker, the right one for the linker is -lpthread
I've just tried to debug my C++ program after upgrading to Ubuntu 11.10 and it appears the gdb version I'm running (7.3) is broken for debug output.
What happens:
I hit debug, Console window pops up, Message appears at the top:
warning: GDB: failed to set controlling terminal: Operation not permitted
I get no output from std::cout calls, even just a
std::cout << "hi" << std::endl;
Anyone able to help? I tried to google the subject and came up with a lot of similar issues, but not ones related to this particular symptom, and how to fix it. I've made sure I have the latest version of GDB, etc.
Addendum: I am using Code::Blocks as my ide.
A rebuild of my project with full commandline output gives:
-------------- Clean: Debug in DungeonCrawlerCPP ---------------
Cleaned "DungeonCrawlerCPP - Debug"
-------------- Build: Debug in DungeonCrawlerCPP ---------------
g++ -Wall -fexceptions -g -fpermissive -std=gnu++0x -Iinclude -c /home/reedja/CPPProjects/DungeonCrawlerCPP/main.cpp -o obj/Debug/main.o
g++ -Wall -fexceptions -g -fpermissive -std=gnu++0x -Iinclude -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/ActionableObject.cpp -o obj/Debug/src/ActionableObject.o
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/ActionableObject.cpp:1:9: warning: #pragma once in main file [enabled by default]
g++ -Wall -fexceptions -g -fpermissive -std=gnu++0x -Iinclude -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/AppSettings.cpp -o obj/Debug/src/AppSettings.o
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/AppSettings.cpp:1:9: warning: #pragma once in main file [enabled by default]
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/AppSettings.cpp: In member function ‘void AppSettings::load(const char*)’:
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/AppSettings.cpp:98:23: warning: statement has no effect [-Wunused-value]
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/AppSettings.cpp:114:29: warning: statement has no effect [-Wunused-value]
g++ -Wall -fexceptions -g -fpermissive -std=gnu++0x -Iinclude -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/Container.cpp -o obj/Debug/src/Container.o
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/Container.cpp:1:9: warning: #pragma once in main file [enabled by default]
g++ -Wall -fexceptions -g -fpermissive -std=gnu++0x -Iinclude -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/Entity.cpp -o obj/Debug/src/Entity.o
g++ -Wall -fexceptions -g -fpermissive -std=gnu++0x -Iinclude -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/Item.cpp -o obj/Debug/src/Item.o
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/Item.cpp:1:9: warning: #pragma once in main file [enabled by default]
g++ -Wall -fexceptions -g -fpermissive -std=gnu++0x -Iinclude -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/Monster.cpp -o obj/Debug/src/Monster.o
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/Monster.cpp:1:9: warning: #pragma once in main file [enabled by default]
g++ -Wall -fexceptions -g -fpermissive -std=gnu++0x -Iinclude -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/Player.cpp -o obj/Debug/src/Player.o
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/Player.cpp: In member function ‘void Player::attackMonster(std::string)’:
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/Player.cpp:36:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
g++ -Wall -fexceptions -g -fpermissive -std=gnu++0x -Iinclude -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/Room.cpp -o obj/Debug/src/Room.o
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/Room.cpp:1:9: warning: #pragma once in main file [enabled by default]
g++ -Wall -fexceptions -g -fpermissive -std=gnu++0x -Iinclude -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/tinystr.cpp -o obj/Debug/src/tinystr.o
g++ -Wall -fexceptions -g -fpermissive -std=gnu++0x -Iinclude -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/tinyxml.cpp -o obj/Debug/src/tinyxml.o
g++ -Wall -fexceptions -g -fpermissive -std=gnu++0x -Iinclude -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/tinyxmlerror.cpp -o obj/Debug/src/tinyxmlerror.o
g++ -Wall -fexceptions -g -fpermissive -std=gnu++0x -Iinclude -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/tinyxmlparser.cpp -o obj/Debug/src/tinyxmlparser.o
g++ -o bin/Debug/DungeonCrawlerCPP obj/Debug/main.o obj/Debug/src/ActionableObject.o obj/Debug/src/AppSettings.o obj/Debug/src/Container.o obj/Debug/src/Entity.o obj/Debug/src/Item.o obj/Debug/src/Monster.o obj/Debug/src/Player.o obj/Debug/src/Room.o obj/Debug/src/tinystr.o obj/Debug/src/tinyxml.o obj/Debug/src/tinyxmlerror.o obj/Debug/src/tinyxmlparser.o
Output size is 674.11 KB
Process terminated with status 0 (0 minutes, 6 seconds)
0 errors, 9 warnings
If that helps?...
I found the answer - for some reason C::B doesn't set global -g as default, so I had no debugging symbols. I still get the weird error message, but at least I now get console output :)