Hello,
I am trying to compile a program in NSight, using the Library of the rose compiler(rosecompiler.org)
I can compile such a program without any problems with a manually written Makefile and with standard g++. This one looks like this:
CXX=g++-4.4
CXXFLAGS=-c -Wall
# Anmerkung: BOOST_INSTALL_DIR und ROSE_INSTALL_DIR
# musst du an deine Verzeichnisstruktur anpassen.
# JAVA_HOME ist bei mir eine Umgebungsvariable, die
# ich in der .bashrc setze. Es muss übrigens das
# Oracle Java sein, OpenJDK geht meines wissens nicht.
BOOSTLIBDIR=$(BOOST_INSTALL_DIR)/lib
ROSELIBDIR=$(ROSE_INSTALL_DIR)/lib
JAVALIBDIR=$(JAVA_HOME)/jre/lib/amd64/server
INCLUDE=-I$(ROSE_INSTALL_DIR)/include -I$(BOOST_INSTALL_DIR)/include
LDFLAGS=-Wl,-rpath-link $(BOOSTLIBDIR) -Wl,-rpath-link $(JAVALIBDIR) -L$(ROSELIBDIR)
#LDFLAGS=-L$(BOOSTLIBDIR) -L$(JAVALIBDIR) -L$(ROSELIBDIR)
LIBS=-lrose -lhpdf
# .cpp-Dateien, die ich sowohl für das Programm als auch für die Testmak
PROJECTSOURCES=
SOURCEDIR=../src
# .cpp-Dateien, die nur für das Programm benötigt werden
SOURCES=$(PROJECTSOURCES) $(SOURCEDIR)/useRose.cpp
# .cpp-Dateien, die nur für die Tests benötigt werden
TESTSOURCES=$(PROJECTSOURCES) RunAllTests.cpp
OBJDIR=src
OBJECTS=$(SOURCES:%.cpp=$(OBJDIR)/%.o)
TESTOBJECTS=$(TESTSOURCES:%.cpp=$(OBJDIR)/%.o)
# Name der ausführbaren Datei, die es am Ende werden soll
EXECUTABLE=$(OBJDIR)/useRose
ECHO=@echo
# Verzeichnisse, die nach den angegebenen Quelldateien durchsucht werden.
# Ist einfacher, als jeder Datei den Verzeichnispfad voranzustellen, die
# in Unterverzeichnissen sitzen.
vpath %.cpp src src/common test test/util
all: $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CXX) $(LDFLAGS) $^ -o $@ $(LIBS)
$(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@
test: $(OBJDIR)/runAllTests
$(OBJDIR)/runAllTests: $(TESTOBJECTS)
$(CXX) $(LDFLAGS) $^ -o $@ $(LIBS)
.PHONY: clean
clean:
rm -r $(OBJDIR)/*
How can I set the project properties in NSight in order to use an automatic genereted makefile with nvcc as compiler?
My project properties in Build → Settings → Tool Settings are:
NVCC Compiler -> Includes -> Include paths(-I):
/homes/knoppik/tools/install/rose/include
/homes/knoppik/tools/install/boost/include
NVCC Linker -> Libraries -> Libraries(-l):
rose
hpdf
NVCC Linker -> Libraries -> Library search paths(-l):
/homes/knoppik/tools/install/boost/lib
/homes/knoppik/tools/install/jdk1.7.0_09/jre/lib/amd64/server
/homes/knoppik/tools/install/rose/lib
NVCC Linker -> Miscellaneous ->> Other options(-Xlinker [option])
-rpath
The rest are the standard settings. So the settings in NSight Project Properties are nearly the same compared to the ones in the original, manually written Makefile posted above. But after compiling the project I get this (error) output:
**** Build of configuration Debug for project cpso2cuda ****
make all
Building file: ../src/useRose.cpp
Invoking: NVCC Compiler
nvcc -I/homes/knoppik/tools/install/rose/include -I/homes/knoppik/tools/install/boost/include -G -g -O0 -odir "src" -M -o "src/useRose.d" "../src/useRose.cpp"
nvcc -I/homes/knoppik/tools/install/rose/include -I/homes/knoppik/tools/install/boost/include -G -g -O0 --compile -x c++ -o "src/useRose.o" "../src/useRose.cpp"
Finished building: ../src/useRose.cpp
Building target: cpso2cuda
Invoking: NVCC Linker
nvcc -L/homes/knoppik/tools/install/boost/lib -L/homes/knoppik/tools/install/jdk1.7.0_09/jre/lib/amd64/server -L/homes/knoppik/tools/install/rose/lib -Xlinker -rpath -link -o "cpso2cuda" ./src/useRose.o -lrose -lhpdf
./src/useRose.o: In function `visitorTraversal::visit(SgNode*)':
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:64: undefined reference to `isSgClassDeclaration(SgNode*)'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:67: undefined reference to `AstDOTGeneration::generate(SgNode*, std::basic_string, DOTGeneration::traversalType, std::basic_string)'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:71: undefined reference to `isSgFunctionDeclaration(SgNode*)'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:75: undefined reference to `isSgCudaKernelCallExp(SgNode*)'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:78: undefined reference to `AstDOTGeneration::generate(SgNode*, std::basic_string, DOTGeneration::traversalType, std::basic_string)'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:115: undefined reference to `isSgFunctionDeclaration(SgNode*)'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:124: undefined reference to `SgFunctionDeclaration::get_name() const'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:124: undefined reference to `SgName::str() const'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:124: undefined reference to `SgName::~SgName()'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:126: undefined reference to `SgFunctionDeclaration::get_functionModifier()'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:126: undefined reference to `SgFunctionModifier::isCudaHost() const'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:128: undefined reference to `SgFunctionDeclaration::get_functionModifier()'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:128: undefined reference to `SgFunctionModifier::isCudaDevice() const'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:130: undefined reference to `SgFunctionDeclaration::get_functionModifier()'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:130: undefined reference to `SgFunctionModifier::isCudaKernel() const'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:136: undefined reference to `isSgInitializedName(SgNode*)'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:139: undefined reference to `SgInitializedName::get_name() const'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:139: undefined reference to `SgName::str() const'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:139: undefined reference to `SgName::~SgName()'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:140: undefined reference to `SgInitializedName::get_type() const'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:146: undefined reference to `isSgForStatement(SgNode*)'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:149: undefined reference to `Sg_File_Info::generateDefaultFileInfoForTransformationNode()'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:151: undefined reference to `SgPragma::operator new(unsigned long)'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:151: undefined reference to `SgPragma::SgPragma(std::basic_string, Sg_File_Info*)'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:152: undefined reference to `SgPragmaDeclaration::operator new(unsigned long)'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:152: undefined reference to `SgPragmaDeclaration::SgPragmaDeclaration(Sg_File_Info*, SgPragma*)'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:124: undefined reference to `SgName::~SgName()'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:139: undefined reference to `SgName::~SgName()'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:151: undefined reference to `SgPragma::operator delete(void*)'
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:152: undefined reference to `SgPragmaDeclaration::operator delete(void*)'
./src/useRose.o: In function `visitorTraversal::atTraversalEnd()':
/homes/knoppik/Masterarbeit/quellen/cpso2cuda/Debug/../src/useRose.cpp:166: undefined reference to `SageInterface::insertStatement(SgStatement*, SgStatement*, bool, bool)'
./src/useRose.o: In function `AstSimpleProcessing':
/homes/knoppik/tools/install/rose/include/AstSimpleProcessing.h:59: undefined reference to `vtable for AstSimpleProcessing'
./src/useRose.o: In function `~AstSimpleProcessing':
/homes/knoppik/tools/install/rose/include/AstSimpleProcessing.h:59: undefined reference to `vtable for AstSimpleProcessing'
./src/useRose.o: In function `AstDOTGeneration':
/homes/knoppik/tools/install/rose/include/AstDOTGeneration.h:12: undefined reference to `vtable for AstDOTGeneration'
./src/useRose.o: In function `~AstDOTGeneration':
/homes/knoppik/tools/install/rose/include/AstDOTGeneration.h:12: undefined reference to `vtable for AstDOTGeneration'
./src/useRose.o:(.rodata._ZTV16visitorTraversal[vtable for visitorTraversal]+0x20): undefined reference to `AstSimpleProcessing::evaluateInheritedAttribute(SgNode*, void*)'
./src/useRose.o:(.rodata._ZTV16visitorTraversal[vtable for visitorTraversal]+0x28): undefined reference to `AstSimpleProcessing::evaluateSynthesizedAttribute(SgNode*, void*, StackFrameVector)'
./src/useRose.o:(.rodata._ZTV16visitorTraversal[vtable for visitorTraversal]+0x38): undefined reference to `AstSimpleProcessing::defaultSynthesizedAttribute(void*)'
./src/useRose.o:(.rodata._ZTV16visitorTraversal[vtable for visitorTraversal]+0x40): undefined reference to `AstSimpleProcessing::atTraversalStart()'
./src/useRose.o:(.rodata._ZTI16visitorTraversal[typeinfo for visitorTraversal]+0x10): undefined reference to `typeinfo for AstSimpleProcessing'
./src/useRose.o: In function `SgTreeTraversal::setNodeSuccessors(SgNode*, std::vector&)':
/homes/knoppik/tools/install/rose/include/AstProcessing.h:380: undefined reference to `AstSuccessorsSelectors::selectDefaultSuccessors(SgNode*, std::vector&)'
./src/useRose.o: In function `SgTreeTraversal::setNodeSuccessors(SgNode*, std::vector&)':
/homes/knoppik/tools/install/rose/include/AstProcessing.h:380: undefined reference to `AstSuccessorsSelectors::selectDefaultSuccessors(SgNode*, std::vector&)'
./src/useRose.o: In function `SgTreeTraversal::performTraversal(SgNode*, DOTInheritedAttribute, t_traverseOrder)':
/homes/knoppik/tools/install/rose/include/AstProcessing.h:743: undefined reference to `SgTreeTraversal_inFileToTraverse(SgNode*, bool, SgFile*)'
collect2: ld gab 1 als Ende-Status zurück
make: *** [cpso2cuda] Error 1
**** Build Finished ****
So the rose library seems to be missing, although I told to use them in Project Properties. Can anyone help me solving this? The only difference is that the original building flages are:
-Wl,-rpath-link $(BOOSTLIBDIR) -Wl,-rpath-link $(JAVALIBDIR) -L$(ROSELIBDIR)
And the ones generated by NSight are:
-L/homes/knoppik/tools/install/boost/lib -L/homes/knoppik/tools/install/jdk1.7.0_09/jre/lib/amd64/server -L/homes/knoppik/tools/install/rose/lib -Xlinker -rpath -link -o "cpso2cuda" $(OBJS) $(USER_OBJS) $(LIBS)
So “rpath-link” is translated to “-XLinker rpath” and “-Wl” is missing. Does anyone know a solution?
Regards
sw