Cross compile for TX2 with make file

Hi,

While I trying to compile my project for TX2 by using makefile at linux console.

While I am trying to change the target architecture from X64 to Arm64 I am facing compilations error:
nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified

while my makefile is:

CXXCU =nvcc aarch64-linux-g++ -O0 -std=c++11 --compile --relocatable-device-code=true -gencode arch=compute_61,code=compute_61

OBJ = $(addprefix $(OBJDIR)/, $(CSOURCES:.c=.o) $(CXXSOURCES:.cpp=.o) $(CXXSOURCESCU:.cu=.o) )
CXXFLAGS = $(INCLUDEDIRS)

CXX =$(CXXCU) #g++
CC =$(CXXCU) # gcc

LDFLAGS = $(LIBDIRS) $(LIBS)
all: $(PROGRAM)

$(PROGRAM): $(OBJ)
ar rc $(PROGRAM).a $(OBJ)
ranlib $(PROGRAM).a

$(OBJDIR)/%.o: ./%.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c -o $@ $^

$(OBJDIR)/%.o: ./%.c
@mkdir -p $(@D)
$(CC) $(CXXFLAGS) -c -o $@ $^

$(OBJDIR)/%.o: ./%.cu
@mkdir -p $(@D)
$(CXXCU) $(INCLUDEDIRS) -c -o $@ $^

clean:
$(RM) -f $(CXXOBJECTS) $(PROGRAM)

When I removes the aarch64-linux-g++ argument the compilation is pass.
What I am doing wrong at the makefile that the compilation for the Arm64 is fail.

Yehonatan

Hi yehonatanswjf8y,

Not sure what’s the actual issue but for TX2 you should use below compiler options.

arch=compute_62,code=sm_62

Hi,

I also tried that argument for Tx2.

But when I set the arch=compute_62,code=sm_62 it should compile for arm64??
There is no need to set another flag in order to compile the c code for aarch64?

Please take a look at [url]http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#cross-platform[/url]. Or try to use/reference to options in nsight (http://www.nvidia.com/object/nsight.html).