Hi i have built a 6 csi-camera capturing application using libargus samples which works well. I have also removed all dependencies and built separately using my own makefile. Now i would like to display the panorama generated with cuda using a render application i built which works fine independently.It takes care of cuda-opengl interop using freeglut. However i get a segmentation fault during the capturing stage when i integrate with libargus. I have checked the opengl box sample program. However , that uses openGLES and EGL .Any help would be appreciated. This is my makefile
# Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of NVIDIA CORPORATION nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# OS info
OSLOWER := $(shell uname -s 2>/dev/null | tr "[:upper:]" "[:lower:]")
OS_ARCH := $(shell uname -m | sed -e "s/i386/i686/")
# Take command line flags that override any of these settings
ifeq ($(i386),1)
OS_ARCH := i686
endif
ifeq ($(x86_64),1)
OS_ARCH := x86_64
endif
ifeq ($(ARMv7),1)
OS_ARCH := armv7l
endif
ifeq ($(ARMv8),1)
OS_ARCH := aarch64
endif
# Specify the logical root directory for headers and libraries.
# From JPEG Makefile
ifeq ($(shell uname -m), aarch64)
TARGET_ROOTFS :=
else
ifeq ($(TARGET_ROOTFS),)
$(error Please specify the target rootfs path if you are cross-compiling)
endif
endif
ifneq ($(TARGET_ROOTFS),)
CPPFLAGS += --sysroot=$(TARGET_ROOTFS)
LDFLAGS += \
-Wl,-rpath-link=$(TARGET_ROOTFS)/lib/$(TEGRA_ARMABI) \
-Wl,-rpath-link=$(TARGET_ROOTFS)/usr/lib/$(TEGRA_ARMABI) \
-Wl,-rpath-link=$(TARGET_ROOTFS)/usr/lib/$(TEGRA_ARMABI)/tegra
endif
CPPFLAGS += \
-I"$(TARGET_ROOTFS)/usr/include/$(TEGRA_ARMABI)" \
-I"../../include"
LDFLAGS += \
-L"$(TARGET_ROOTFS)/usr/lib/$(TEGRA_ARMABI)" \
-L"$(TARGET_ROOTFS)/usr/lib/$(TEGRA_ARMABI)/tegra"
CXXFLAGS += -std=c++0x
ifneq ($(VIBRANTE_TOOLCHAIN_SYSROOT),)
CCFLAGS += --sysroot="$(VIBRANTE_TOOLCHAIN_SYSROOT)"
endif
# Configuration-specific build flags
ifeq ($(dbg),1)
CCFLAGS += -g
TARGET := debug
else
CCFLAGS += -O3 -DNDEBUG
TARGET := release
endif
EXTERNAL_CFLAGS :=
EXTERNAL_LIBS :=
EXTERNAL_CFLAGS += $(shell pkg-config --cflags cudart-8.0)
EXTERNAL_LIBS += $(shell pkg-config --libs cudart-8.0)
INCLUDES :=
INCLUDES += $(EXTERNAL_CFLAGS)
INCLUDES += -I./include
INCLUDES += -I./utils
INCLUDES += -I./argus/include
LIBRARIES := -L"$(PKG_CONFIG_SYSROOT_DIR)/usr/lib"
LIBRARIES += -lpthread -lrt -lm -lv4l2 -lGL -lGLEW -lglut
LIBRARIES += /usr/lib/aarch64-linux-gnu/tegra/libargus.so
ifneq ($(VIBRANTE_TOOLCHAIN_SYSROOT),)
LIBRARIES += -L"$(VIBRANTE_TOOLCHAIN_SYSROOT)/usr/lib"
endif
ifneq ($(PKG_CONFIG_SYSROOT_DIR),)
ifeq ($(ARMv7),1)
LIBRARIES += -Wl,-rpath-link="$(PKG_CONFIG_SYSROOT_DIR)/lib/arm-linux-gnueabihf"
LIBRARIES += -Wl,-rpath-link="$(PKG_CONFIG_SYSROOT_DIR)/usr/lib"
LIBRARIES += -Wl,-rpath-link="$(PKG_CONFIG_SYSROOT_DIR)/usr/lib/arm-linux-gnueabihf"
endif
endif
LIBRARIES += /usr/lib/aarch64-linux-gnu/tegra/libcuda.so
LIBRARIES += $(EXTERNAL_LIBS)
# add CUDA to runtime path
CUDA_LIB_PATH := $(subst -L,,$(shell pkg-config --libs-only-L cudart-8.0))
LDFLAGS += -Wl,--allow-shlib-undefined -pthread
LDFLAGS += -Wl,-rpath=$(CUDA_LIB_PATH)
# show libraries used by linker in debug mode
ifeq ($(dbg),1)
LDFLAGS += -Wl,--trace
endif
CPP_FILES := $(wildcard *.cpp)
C_FILES := $(wildcard *.c)
CU_FILES := $(wildcard *.cu)
OBJ_DIR := obj/$(TARGET)
OBJ_FILES_UTILS := ./utils/obj/release/*.o
OBJ_FILES_CPP := $(addprefix $(OBJ_DIR)/,$(notdir $(CPP_FILES:.cpp=.o)))
OBJ_FILES_C := $(addprefix $(OBJ_DIR)/,$(notdir $(C_FILES:.c=.o)))
OBJ_FILES_CU := $(addprefix $(OBJ_DIR)/,$(notdir $(CU_FILES:.cu=.o)))
OUTPUT_DIR := ./
#OUTPUT_DIR := ../../bin/$(OS_ARCH)/$(OSLOWER)/$(TARGET)$(if $(abi),/$(abi))
################################################################################
# Target rules
all: build
build: $(OUTPUT_DIR)/PanoStitch
$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
$(OBJ_DIR)/%.o: %.cpp | $(OBJ_DIR)
$(CXX) $(INCLUDES) $(CCFLAGS) $(CXXFLAGS) -o $@ -c $<
$(OBJ_DIR)/%.o: %.c | $(OBJ_DIR)
$(CC) $(INCLUDES) $(CCFLAGS) -std=c99 -o $@ -c $<
$(OBJ_DIR)/%.o: %.cu | $(OBJ_DIR)
nvcc -c $(CUDA_INCLUDE) $< -o $@
$(OUTPUT_DIR)/PanoStitch: $(OBJ_FILES_CPP) $(OBJ_FILES_C) $(OBJ_FILES_CU) $(OBJ_FILES_UTILS) | $(OUTPUT_DIR)
$(CXX) $(LDFLAGS) $(CCFLAGS) $(CXXFLAGS) -o $@ $^ $(LIBRARIES)
$(OUTPUT_DIR):
mkdir -p $(OUTPUT_DIR)
run: build
./$(OUTPUT_DIR)/PanoStitch
clean:
rm -f $(OBJ_FILES_CPP) $(OBJ_FILES_C)
rm -f $(OUTPUT_DIR)/PanoStitch
cuda_clean:
rm -f $(OBJ_FILES_CU)