CUDA collect2 ld returned 1 exit status - hyperlink
I'm trying to compile Mars for cuda 4.2.9 (cuda 5.0 eliminated a lot of header files used by Mars). Versions below 5.0 seem to utilize this monstrous makefile common.mk and I'm having a hard time configuring it to get the code to work. The object files compile just fine but I'm getting this error:
/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/bin/ld: cannot find -lcutil_x86_64
/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/bin/ld: cannot find -lshrutil_x86_64
collect2: ld returned 1 exit status
make: *** [/home/ian/code/cuda-4.2.9/C/bin/linux/release/MatrixMul] Error 1
Why is this happening? How can I remedy it?
Here is the makefile for MatrixMul:
################################################################################
#
# Build script for project
#
################################################################################
# Add source files here
EXECUTABLE := MatrixMul
# Cuda source files (compiled with cudacc)
CUFILES := main.cu MarsLib.cu MarsScan.cu MarsSort.cu
# C/C++ source files (compiled with gcc / c++)
CCFILES := MarsUtils.cpp
################################################################################
# Rules and targets
include ../cuda-4.2.9/C/common/common.mk
The lines of common.mk that I edited:
# Basic directory setup for SDK
# (override directories only if they are not already defined)
SRCDIR ?=
ROOTDIR ?= /home/ian/code/cuda-4.2.9
ROOTBINDIR ?= $(ROOTDIR)/C/bin
BINDIR ?= $(ROOTBINDIR)/$(OSLOWER)
ROOTOBJDIR ?= obj
LIBDIR := $(ROOTDIR)/C/lib
COMMONDIR := $(ROOTDIR)/C/common
SHAREDDIR := $(ROOTDIR)/shared/
Original values:
# Basic directory setup for SDK
# (override directories only if they are not already defined)
SRCDIR ?=
ROOTDIR ?= ..
ROOTBINDIR ?= $(ROOTDIR)/../bin
BINDIR ?= $(ROOTBINDIR)/$(OSLOWER)
ROOTOBJDIR ?= obj
LIBDIR := $(ROOTDIR)/../lib
COMMONDIR := $(ROOTDIR)/../common
SHAREDDIR := $(ROOTDIR)/../shared/
And the whole common.mk:
################################################################################
#
# Common build script for CUDA source projects for Linux and Mac platforms
#
################################################################################
.SUFFIXES : .cu .cu_dbg.o .c_dbg.o .cpp_dbg.o .cu_rel.o .c_rel.o .cpp_rel.o .cubin .ptx
# Add new SM Versions here as devices with new Compute Capability are released
SM_VERSIONS := 10 11 12 13 20 21 30
CUDA_INSTALL_PATH ?= /home/ian/code/cuda-4.2.9/cuda/
ifdef cuda-install
CUDA_INSTALL_PATH := $(cuda-install)
endif
# detect OS
OSUPPER = $(shell uname -s 2>/dev/null | tr [:lower:] [:upper:])
OSLOWER = $(shell uname -s 2>/dev/null | tr [:upper:] [:lower:])
# 'linux' is output for Linux system, 'darwin' for OS X
DARWIN = $(strip $(findstring DARWIN, $(OSUPPER)))
ifneq ($(DARWIN),)
SNOWLEOPARD = $(strip $(findstring 10.6, $(shell egrep "<string>10\.6" /System/Library/CoreServices/SystemVersion.plist)))
LION = $(strip $(findstring 10.7, $(shell egrep "<string>10\.7" /System/Library/CoreServices/SystemVersion.plist)))
endif
# detect 32-bit or 64-bit platform
HP_64 = $(shell uname -m | grep 64)
OSARCH= $(shell uname -m)
# Basic directory setup for SDK
# (override directories only if they are not already defined)
SRCDIR ?=
ROOTDIR ?= /home/ian/code/cuda-4.2.9/cuda/C
ROOTBINDIR ?= $(ROOTDIR)/bin
BINDIR ?= $(ROOTBINDIR)/$(OSLOWER)
ROOTOBJDIR ?= obj
LIBDIR := $(ROOTDIR)/lib
COMMONDIR := $(ROOTDIR)/common
SHAREDDIR := $(ROOTDIR)/../shared/
# Compilers
NVCC := $(CUDA_INSTALL_PATH)/bin/nvcc
CXX := g++ -fPIC
CC := gcc -fPIC
LINK := g++ -fPIC
# Includes
INCLUDES += -I. -I$(CUDA_INSTALL_PATH)/include -I$(COMMONDIR)/inc -I$(SHAREDDIR)/inc
# Warning flags
CXXWARN_FLAGS := \
-W -Wall \
-Wimplicit \
-Wswitch \
-Wformat \
-Wchar-subscripts \
-Wparentheses \
-Wmultichar \
-Wtrigraphs \
-Wpointer-arith \
-Wcast-align \
-Wreturn-type \
-Wno-unused-function \
$(SPACE)
CWARN_FLAGS := $(CXXWARN_FLAGS) \
-Wstrict-prototypes \
-Wmissing-prototypes \
-Wmissing-declarations \
-Wnested-externs \
-Wmain \
# architecture flag for nvcc and gcc compilers build
CUBIN_ARCH_FLAG :=
CXX_ARCH_FLAGS :=
NVCCFLAGS :=
LIB_ARCH := $(OSARCH)
# Determining the necessary Cross-Compilation Flags
# 32-bit OS, but we target 64-bit cross compilation
ifeq ($(x86_64),1)
NVCCFLAGS += -m64
LIB_ARCH = x86_64
ifneq ($(DARWIN),)
CXX_ARCH_FLAGS += -arch x86_64
else
CXX_ARCH_FLAGS += -m64
endif
else
# 64-bit OS, and we target 32-bit cross compilation
ifeq ($(i386),1)
NVCCFLAGS += -m32
LIB_ARCH = i386
ifneq ($(DARWIN),)
CXX_ARCH_FLAGS += -arch i386
else
CXX_ARCH_FLAGS += -m32
endif
else
ifeq "$(strip $(HP_64))" ""
LIB_ARCH = i386
NVCCFLAGS += -m32
ifneq ($(DARWIN),)
CXX_ARCH_FLAGS += -arch i386
else
CXX_ARCH_FLAGS += -m32
endif
else
ifeq "$(strip $(HP_64))" ""
LIB_ARCH = i386
NVCCFLAGS += -m32
ifneq ($(DARWIN),)
CXX_ARCH_FLAGS += -arch i386
else
CXX_ARCH_FLAGS += -m32
endif
else
LIB_ARCH = x86_64
NVCCFLAGS += -m64
ifneq ($(DARWIN),)
CXX_ARCH_FLAGS += -arch x86_64
else
CXX_ARCH_FLAGS += -m64
endif
endif
endif
endif
# Compiler-specific flags (by default, we always use sm_10, sm_20, and sm_30), unless we use the SMVERSION template
GENCODE_SM10 := -gencode=arch=compute_10,code=\"sm_10,compute_10\"
GENCODE_SM20 := -gencode=arch=compute_20,code=\"sm_20,compute_20\"
GENCODE_SM30 := -gencode=arch=compute_30,code=\"sm_30,compute_30\"
CXXFLAGS += $(CXXWARN_FLAGS) $(CXX_ARCH_FLAGS)
CFLAGS += $(CWARN_FLAGS) $(CXX_ARCH_FLAGS)
LINKFLAGS +=
LINK += $(LINKFLAGS) $(CXX_ARCH_FLAGS)
# This option for Mac allows CUDA applications to work without requiring to set DYLD_LIBRARY_PATH
ifneq ($(DARWIN),)
LINK += -Xlinker -rpath $(CUDA_INSTALL_PATH)/lib
endif
# Common flags
COMMONFLAGS += $(INCLUDES) -DUNIX
# If we are enabling GPU based debugging, then we want to use -G, warning that this
# May have a significant impact on GPU device code, since optimizations are turned off
ifeq ($(gpudbg),1)
NVCCFLAGS += -G
dbg = $(gpudbg)
endif
# Debug/release configuration
ifeq ($(dbg),1)
COMMONFLAGS += -g
NVCCFLAGS += -D_DEBUG
CXXFLAGS += -D_DEBUG
CFLAGS += -D_DEBUG
BINSUBDIR := debug
LIBSUFFIX := D
else
COMMONFLAGS += -O2
BINSUBDIR := release
LIBSUFFIX :=
NVCCFLAGS += --compiler-options -fno-strict-aliasing
CXXFLAGS += -fno-strict-aliasing
CFLAGS += -fno-strict-aliasing
endif
# architecture flag for cubin build
CUBIN_ARCH_FLAG :=
# OpenGL is used or not (if it is used, then it is necessary to include GLEW)
ifeq ($(USEGLLIB),1)
ifneq ($(DARWIN),)
OPENGLLIB := -L/System/Library/Frameworks/OpenGL.framework/Libraries
OPENGLLIB += -lGL -lGLU $(COMMONDIR)/lib/$(OSLOWER)/libGLEW.a
else
# this case for linux platforms
OPENGLLIB := -lGL -lGLU -lX11 -lXi -lXmu
# check if x86_64 flag has been set, otherwise, check HP_64 is i386/x86_64
ifeq ($(x86_64),1)
OPENGLLIB += -lGLEW_x86_64 -L/usr/X11R6/lib64
else
ifeq ($(i386),)
ifeq "$(strip $(HP_64))" ""
OPENGLLIB += -lGLEW -L/usr/X11R6/lib
else
OPENGLLIB += -lGLEW_x86_64 -L/usr/X11R6/lib64
endif
endif
endif
# check if i386 flag has been set, otehrwise check HP_64 is i386/x86_64
ifeq ($(i386),1)
OPENGLLIB += -lGLEW -L/usr/X11R6/lib
else
ifeq ($(x86_64),)
ifeq "$(strip $(HP_64))" ""
OPENGLLIB += -lGLEW -L/usr/X11R6/lib
else
OPENGLLIB += -lGLEW_x86_64 -L/usr/X11R6/lib64
endif
endif
endif
endif
endif
ifeq ($(USEGLUT),1)
ifneq ($(DARWIN),)
OPENGLLIB += -framework GLUT
else
ifeq ($(x86_64),1)
OPENGLLIB += -lglut -L/usr/lib64
endif
ifeq ($(i386),1)
OPENGLLIB += -lglut -L/usr/lib
endif
ifeq ($(x86_64),)
ifeq ($(i386),)
OPENGLLIB += -lglut
endif
endif
endif
endif
ifeq ($(USEPARAMGL),1)
PARAMGLLIB := -lparamgl_$(LIB_ARCH)$(LIBSUFFIX)
endif
ifeq ($(USERENDERCHECKGL),1)
RENDERCHECKGLLIB := -lrendercheckgl_$(LIB_ARCH)$(LIBSUFFIX)
endif
ifeq ($(USENVCUVID), 1)
ifneq ($(DARWIN),)
NVCUVIDLIB := -L../../common/lib/darwin -lnvcuvid
endif
endif
# Libs
ifneq ($(DARWIN),)
LIB := -L$(CUDA_INSTALL_PATH)/lib -L$(LIBDIR) -L$(COMMONDIR)/lib/$(OSLOWER) -L$(SHAREDDIR)/lib $(NVCUVIDLIB)
else
ifeq "$(strip $(HP_64))" ""
ifeq ($(x86_64),1)
LIB := -L$(CUDA_INSTALL_PATH)/lib64 -L$(LIBDIR) -L$(COMMONDIR)/lib/$(OSLOWER) -L$(SHAREDDIR)/lib
else
LIB := -L$(CUDA_INSTALL_PATH)/lib -L$(LIBDIR) -L$(COMMONDIR)/lib/$(OSLOWER) -L$(SHAREDDIR)/lib
endif
else
ifeq ($(i386),1)
LIB := -L$(CUDA_INSTALL_PATH)/lib -L$(LIBDIR) -L$(COMMONDIR)/lib/$(OSLOWER) -L$(SHAREDDIR)/lib
else
LIB := -L$(CUDA_INSTALL_PATH)/lib64 -L$(LIBDIR) -L$(COMMONDIR)/lib/$(OSLOWER) -L$(SHAREDDIR)/lib
endif
endif
endif
# If dynamically linking to CUDA and CUDART, we exclude the libraries from the LIB
ifeq ($(USECUDADYNLIB),1)
LIB += ${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB) ${LIB} -ldl -rdynamic
else
# static linking, we will statically link against CUDA and CUDART
ifeq ($(USEDRVAPI),1)
LIB += -lcuda ${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB) ${LIB}
else
ifeq ($(emu),1)
LIB += -lcudartemu
else
LIB += -lcudart
endif
LIB += ${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB) ${LIB}
endif
endif
ifeq ($(USECUFFT),1)
ifeq ($(emu),1)
LIB += -lcufftemu
else
LIB += -lcufft
endif
endif
ifeq ($(USECUBLAS),1)
ifeq ($(emu),1)
LIB += -lcublasemu
else
LIB += -lcublas
endif
endif
ifeq ($(USECURAND),1)
LIB += -lcurand
endif
ifeq ($(USECUSPARSE),1)
LIB += -lcusparse
endif
# Lib/exe configuration
# Lib/exe configuration
# Lib/exe configuration
ifneq ($(STATIC_LIB),)
TARGETDIR := $(LIBDIR)
TARGET := $(subst .a,_$(LIB_ARCH)$(LIBSUFFIX).a,$(LIBDIR)/$(STATIC_LIB))
LINKLINE = ar rucv $(TARGET) $(OBJS)
else
ifneq ($(OMIT_CUTIL_LIB),1)
LIB += -lcutil_$(LIB_ARCH)$(LIBSUFFIX)
endif
ifneq ($(OMIT_SHRUTIL_LIB),1)
LIB += -lshrutil_$(LIB_ARCH)$(LIBSUFFIX)
endif
# Device emulation configuration
ifeq ($(emu), 1)
NVCCFLAGS += -deviceemu
CUDACCFLAGS +=
BINSUBDIR := emu$(BINSUBDIR)
# consistency, makes developing easier
CXXFLAGS += -D__DEVICE_EMULATION__
CFLAGS += -D__DEVICE_EMULATION__
endif
TARGETDIR := $(BINDIR)/$(BINSUBDIR)
TARGET := $(TARGETDIR)/$(EXECUTABLE)
LINKLINE = $(LINK) -o $(TARGET) $(OBJS) $(LIB)
endif
# check if verbose
ifeq ($(verbose), 1)
VERBOSE :=
else
VERBOSE := #
endif
################################################################################
# Check for input flags and set compiler flags appropriately
################################################################################
ifeq ($(fastmath), 1)
NVCCFLAGS += -use_fast_math
endif
ifeq ($(keep), 1)
NVCCFLAGS += -keep
NVCC_KEEP_CLEAN := *.i* *.cubin *.cu.c *.cudafe* *.fatbin.c *.ptx
endif
ifdef maxregisters
NVCCFLAGS += -maxrregcount $(maxregisters)
endif
ifeq ($(ptxas), 1)
NVCCFLAGS += --ptxas-options=-v
endif
# Add cudacc flags
NVCCFLAGS += $(CUDACCFLAGS)
# Add common flags
NVCCFLAGS += $(COMMONFLAGS)
CXXFLAGS += $(COMMONFLAGS)
CFLAGS += $(COMMONFLAGS)
ifeq ($(nvcc_warn_verbose),1)
NVCCFLAGS += $(addprefix --compiler-options ,$(CXXWARN_FLAGS))
NVCCFLAGS += --compiler-options -fno-strict-aliasing
endif
################################################################################
# Set up object files
################################################################################
OBJDIR := $(ROOTOBJDIR)/$(LIB_ARCH)/$(BINSUBDIR)
OBJS += $(patsubst %.cpp,$(OBJDIR)/%.cpp.o,$(notdir $(CCFILES)))
OBJS += $(patsubst %.c,$(OBJDIR)/%.c.o,$(notdir $(CFILES)))
OBJS += $(patsubst %.cu,$(OBJDIR)/%.cu.o,$(notdir $(CUFILES)))
################################################################################
# Set up cubin output files
################################################################################
CUBINDIR := $(SRCDIR)data
CUBINS += $(patsubst %.cu,$(CUBINDIR)/%.cubin,$(notdir $(CUBINFILES)))
################################################################################
# Set up PTX output files
################################################################################
PTXDIR := $(SRCDIR)data
PTXBINS += $(patsubst %.cu,$(PTXDIR)/%.ptx,$(notdir $(PTXFILES)))
################################################################################
# Rules
################################################################################
$(OBJDIR)/%.c.o : $(SRCDIR)%.c $(C_DEPS)
$(VERBOSE)$(CC) $(CFLAGS) -o $# -c $<
$(OBJDIR)/%.cpp.o : $(SRCDIR)%.cpp $(C_DEPS)
$(VERBOSE)$(CXX) $(CXXFLAGS) -o $# -c $<
# Default arch includes gencode for sm_10, sm_20, sm_30, and other archs from GENCODE_ARCH declared in the makefile
$(OBJDIR)/%.cu.o : $(SRCDIR)%.cu $(CU_DEPS)
$(VERBOSE)$(NVCC) $(GENCODE_SM10) $(GENCODE_ARCH) $(GENCODE_SM20) $(GENCODE_SM30) $(NVCCFLAGS) $(SMVERSIONFLAGS) -o $# -c $<
# Default arch includes gencode for sm_10, sm_20, sm_30, and other archs from GENCODE_ARCH declared in the makefile
$(CUBINDIR)/%.cubin : $(SRCDIR)%.cu cubindirectory
$(VERBOSE)$(NVCC) $(GENCODE_SM10) $(GENCODE_ARCH) $(GENCODE_SM20) $(GENCODE_SM30) $(CUBIN_ARCH_FLAG) $(NVCCFLAGS) $(SMVERSIONFLAGS) -o $# -cubin $<
$(PTXDIR)/%.ptx : $(SRCDIR)%.cu ptxdirectory
$(VERBOSE)$(NVCC) $(CUBIN_ARCH_FLAG) $(NVCCFLAGS) $(SMVERSIONFLAGS) -o $# -ptx $<
# The following definition is a template that gets instantiated for each SM
# version (sm_10, sm_13, etc.) stored in SMVERSIONS. It does 2 things:
# 1. It adds to OBJS a .cu_sm_XX.o for each .cu file it finds in CUFILES_sm_XX.
# 2. It generates a rule for building .cu_sm_XX.o files from the corresponding
# .cu file.
#
# The intended use for this is to allow Makefiles that use common.mk to compile
# files to different Compute Capability targets (aka SM arch version). To do
# so, in the Makefile, list files for each SM arch separately, like so:
# This will be used over the default rule abov
#
# CUFILES_sm_10 := mycudakernel_sm10.cu app.cu
# CUFILES_sm_12 := anothercudakernel_sm12.cu
#
define SMVERSION_template
#OBJS += $(patsubst %.cu,$(OBJDIR)/%.cu_$(1).o,$(notdir $(CUFILES_$(1))))
OBJS += $(patsubst %.cu,$(OBJDIR)/%.cu_$(1).o,$(notdir $(CUFILES_sm_$(1))))
$(OBJDIR)/%.cu_$(1).o : $(SRCDIR)%.cu $(CU_DEPS)
# $(VERBOSE)$(NVCC) -o $$# -c $$< $(NVCCFLAGS) $(1)
$(VERBOSE)$(NVCC) -gencode=arch=compute_$(1),code=\"sm_$(1),compute_$(1)\" $(GENCODE_SM20) $(GENCODE_SM30) -o $$# -c $$< $(NVCCFLAGS)
endef
# This line invokes the above template for each arch version stored in
# SM_VERSIONS. The call function invokes the template, and the eval
# function interprets it as make commands.
$(foreach smver,$(SM_VERSIONS),$(eval $(call SMVERSION_template,$(smver))))
$(TARGET): makedirectories $(OBJS) $(CUBINS) $(PTXBINS) Makefile
$(VERBOSE)$(LINKLINE)
cubindirectory:
$(VERBOSE)mkdir -p $(CUBINDIR)
ptxdirectory:
$(VERBOSE)mkdir -p $(PTXDIR)
makedirectories:
$(VERBOSE)mkdir -p $(LIBDIR)
$(VERBOSE)mkdir -p $(OBJDIR)
$(VERBOSE)mkdir -p $(TARGETDIR)
tidy :
$(VERBOSE)find . | egrep "#" | xargs rm -f
$(VERBOSE)find . | egrep "\~" | xargs rm -f
clean : tidy
$(VERBOSE)rm -f *.stub.c *.gpu *.cu.cpp *.i *.ii
$(VERBOSE)rm -f *.cubin *.ptx *.fatbin.c *.hash
$(VERBOSE)rm -f *.cudafe1.c *.cudafe2.c *.cudafe1.cpp *.cudafe2.cpp
$(VERBOSE)rm -f $(OBJS)
$(VERBOSE)rm -f $(CUBINS)
$(VERBOSE)rm -f $(PTXBINS)
$(VERBOSE)rm -f $(TARGET)
$(VERBOSE)rm -f $(NVCC_KEEP_CLEAN)
$(VERBOSE)rm -f $(ROOTBINDIR)/$(OSLOWER)/$(BINSUBDIR)/*.ppm
$(VERBOSE)rm -f $(ROOTBINDIR)/$(OSLOWER)/$(BINSUBDIR)/*.pgm
$(VERBOSE)rm -f $(ROOTBINDIR)/$(OSLOWER)/$(BINSUBDIR)/*.bin
$(VERBOSE)rm -f $(ROOTBINDIR)/$(OSLOWER)/$(BINSUBDIR)/*.bmp
$(VERBOSE)rm -f $(ROOTBINDIR)/$(OSLOWER)/$(BINSUBDIR)/*.txt
$(VERBOSE)rm -f $(CUBINDIR)/*.cubin $(PTXDIR)/*.ptx
$(VERBOSE)rm -rf $(ROOTOBJDIR)
$(VERBOSE)rm -rf $(LIBDIR)
$(VERBOSE)rm -rf $(OBJDIR)
$(VERBOSE)rm -rf $(TARGETDIR)
clobber : clean
$(VERBOSE)rm -rf $(COMMONDIR)/lib/*.a
$(VERBOSE)rm -rf $(SHAREDDIR)/lib/*.a
$(VERBOSE)rm -rf $(COMMONDIR)/obj
$(VERBOSE)rm -rf $(SHAREDDIR)/obj
Why is this happening?
libcutil_x86_64.lib and libshrutil_x86_64.lib are libraries that are built by the cuda samples (called CUDA SDK in cuda 4.2 and earlier) when a proper make operation has been done after the CUDA SDK is installed. The linker cannot find these libraries and so is throwing these errors.
How can I remedy it?
Make sure that the CUDA 4.2 SDK has been properly installed and that the necessary make operation has been done to build the samples and therefore the requisite libraries. If you're unsure how to install the CUDA SDK or make the sample codes, review the /home/ian/code/cuda-4.2.9/CUDA_SDK_Release_Notes.txt file (especially linux install instructions). You may also be interested in the GPU_COMPUTING_SDK_Description.rtf file in that directory and also the files in the .../doc/release subdirectory. If you have not properly built the samples, the libraries won't be available and you'll have no luck linking your own matrixMul-MARS project. Note that you can specify the directory path to install the CUDA SDK at. Let's assume that from here on that ... in a path represents your SDK install path (which might be /home/ian/code/cuda-4.2.9/NVIDIA_GPU_Computing_SDK or something similar.) If things are jumbled in what you already have, you may want to start clean and re-run the installer.
Create a new project directory for your matrixMul-MARS project, at the same level as the other C source project directories, i.e. .../C/src/myMARS or something similar.
Copy all the files from .../C/src/matrixMul directory into your new .../C/src/myMARS directory.
Make the necessary changes to the Makefile in your new project directory (only) corresponding to what you have shown here, such as including additional files to be built, etc. You should not have to make any changes to common.mk.
Now execute make in your new project directory.
Related
shared:ERROR: BINARYEN_ROOT is set to empty value in /root/.emscripten
I am trying to run a docker image with the following command: docker run -v $PWD/build:/app/build --rm tflite-find-arena-size However this error pops up to me. I am using MacOS. I tried brew install it but that didn't help. I also opened ~/.emscripten file and checked that BINARYEN_ROOT is not empty. Please help. shared:ERROR: BINARYEN_ROOT is set to empty value in /root/.emscripten Makefile.emcc:31: recipe for target 'build' failed make: *** [build] Error 1 This is the makefile that I am using: NAME = find-arena-size CC = emcc CXX = em++ CFLAGS ?= -Wall MACROS += -DTF_LITE_DISABLE_X86_NEON CXXFLAGS += -std=c++11 EMCCFLAGS += -s WASM=0 EMCCFLAGS += --bind CFLAGS += -I. CFLAGS += -Isource CFLAGS += -Iedge-impulse-sdk/ CFLAGS += -Iedge-impulse-sdk/tensorflow CFLAGS += -Iedge-impulse-sdk/third_party CFLAGS += -Iedge-impulse-sdk/third_party/flatbuffers CFLAGS += -Iedge-impulse-sdk/third_party/flatbuffers/include CFLAGS += -Iedge-impulse-sdk/third_party/flatbuffers/include/flatbuffers CFLAGS += -Iedge-impulse-sdk/third_party/gemmlowp/ CFLAGS += -Iedge-impulse-sdk/third_party/gemmlowp/fixedpoint CFLAGS += -Iedge-impulse-sdk/third_party/gemmlowp/internal CFLAGS += -Iedge-impulse-sdk/third_party/ruy CFLAGS += -Imodel-parameters CFLAGS += -Iedge-impulse-sdk/porting all: build .PHONY: build clean build: echo "Mazenm" mkdir -p build/emcc $(CC) -c $(MACROS) $(CFLAGS) $(LFLAGS) edge-impulse-sdk/tensorflow/lite/c/common.c -o build/emcc/common.o $(CXX) $(MACROS) $(CXXFLAGS) $(CFLAGS) $(LFLAGS) $(EMCCFLAGS) emcc/emcc_binding.cpp edge-impulse-sdk/tensorflow/lite/kernels/*.cc edge-impulse-sdk/tensorflow/lite/kernels/internal/*.cc edge-impulse-sdk/tensorflow/lite/micro/kernels/*.cc edge-impulse-sdk/tensorflow/lite/micro/*.cc edge-impulse-sdk/tensorflow/lite/micro/memory_planner/*.cc edge-impulse-sdk/tensorflow/lite/core/api/*.cc ./edge-impulse-sdk/dsp/memory.cpp emcc/porting/*.c* build/emcc/common.o -o build/emcc/$(NAME).js rm build/emcc/*.o clean: rm -r build/emcc
Which docker image are you using? How did you install emscripten (emsdk?) within the docker image. There is a semi-official docker image you can use via docker pull emscripten/emsdk. However you should be able to install the emsdk directly on MacOS without needing to use docker at all. This is the recommended way to install emscripten. If you have problems with installing the emsdk directly please file a bug at https://github.com/emscripten-core/emsdk
It's looks like emsdk is not activated. Mabe path to emsdk is not correct.
Use arm-none-eabi-gcc to invoke arm-none-eabi-ld?
I built up a tool chain with gcc-6.2 with all the latest components. CC = arm-none-eabi-gcc AS = arm-none-eabi-as LD = arm-none-eabi-ld My Makefile flags are: CFLAGS = -std=c11 -Wall -Werror -Wfatal-errors -Wstrict-prototypes -Wundef -gdwarf-2 -O2 -mthumb -mthumb-interwork -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mlittle-endian LDFLAGS = -nodefaultlibs -T./STM32F746NGHx_FLASH.ld -Wl,-Map=ugui3.map,--cref I am linking by having via the compiler. CFLAGS at the front and LDFLAGS at the rear: Linking: ugui3.elf arm-none-eabi-gcc -std=c11 -Wall -Werror -Wfatal-errors -Wstrict prototypes -Wundef -gdwarf-2 -O2 -mthumb -mthumb-interwork -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mlittle-endian stm32746g_discovery.o stm32746g_discovery_lcd.o stm32746g_discovery_sdram.o stm32746g_discovery_ts.o system_stm32f7xx.o stm32f7xx_hal.o stm32f7xx_hal_cortex.o stm32f7xx_hal_dma.o stm32f7xx_hal_dma2d.o stm32f7xx_hal_dma_ex.o stm32f7xx_hal_gpio.o stm32f7xx_hal_i2c.o stm32f7xx_hal_i2c_ex.o stm32f7xx_hal_ltdc.o stm32f7xx_hal_pwr.o stm32f7xx_hal_pwr_ex.o stm32f7xx_hal_rcc.o stm32f7xx_hal_rcc_ex.o stm32f7xx_hal_sdram.o stm32f7xx_hal_uart.o stm32f7xx_ll_fmc.o stm32f7xx_hal_msp.o stm32f7xx_it.o main.o ugui.o ltdc.o sdram.o ft5336.o small_printf.o startup_stm32f746xx.o --output ugui3.elf -nodefaultlibs -T./STM32F746NGHx_FLASH.ld -Wl,-Map=ugui3.map,--cref I can reduce what is in CFLAGS to just: CFLAGS = -mthumb -mthumb-interwork Linking: ugui3.elf arm-none-eabi-gcc -mthumb -mthumb-interwork -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mlittle-endian stm32746g_discovery.o stm32746g_discovery_lcd.o stm32746g_discovery_sdram.o stm32746g_discovery_ts.o system_stm32f7xx.o stm32f7xx_hal.o stm32f7xx_hal_cortex.o stm32f7xx_hal_dma.o stm32f7xx_hal_dma2d.o stm32f7xx_hal_dma_ex.o stm32f7xx_hal_gpio.o stm32f7xx_hal_i2c.o stm32f7xx_hal_i2c_ex.o stm32f7xx_hal_ltdc.o stm32f7xx_hal_pwr.o stm32f7xx_hal_pwr_ex.o stm32f7xx_hal_rcc.o stm32f7xx_hal_rcc_ex.o stm32f7xx_hal_sdram.o stm32f7xx_hal_uart.o stm32f7xx_ll_fmc.o stm32f7xx_hal_msp.o stm32f7xx_it.o main.o ugui.o ltdc.o sdram.o ft5336.o small_printf.o startup_stm32f746xx.o --output ugui3.elf -nodefaultlibs -T./STM32F746NGHx_FLASH.ld -Wl,-Map=ugui3.map,--cref My questions: Is invoking the linker (shown above) via the compiler preferred? Is the first method better than the second method? Is there a better way?
I migrated to a few other projects and continued looking into this. A: arm-none-eabi-gcc -mthumb < .o files > --output image.elf -T./lpc1768.ld -nostartfiles -Wl,-Map=image.map,--cref B: arm-none-eabi-gcc < .o files > --output image.elf -T./lpc1768.ld -nostartfiles -Wl,-Map=image.map,--cref -L /usr/local/arm-none-eabi/lib/thumb A and B both work. Method A with "-mthumb" assumes you want to link with the thumb version of libc.a. Method B specifies the thumb version as -L /usr/local/arm-none-eabi/lib/thumb On yet another project I can get away with a minimal line on the link, no -mthumb flag and no library path. C: arm-none-eabi-gcc < .o files > --output image.elf -T./lpc2132.ld -nostartfiles -Wl,-Map=image.map,--cref Method C works on a lpc2132(arm7tdmi-s) project. But method C does not work on the lpc1768(Cortex-m3) project (A & B). They have almost identical .ld files and start files. The reason that method C does not work (no explicit library or path) is that the ARM libraries are linked by default. Since the lpc1768 is a thumb-only processor this is not good. A "-mthumb" or a "-L path to thumb library" is necessary.
compiling with HDF5: unable to link library files (fortran 90)
I am currently try to compile these files using HDF5 I have directly linked and included everything necessary ( I think) but still the compile unable to find the files that is needed This is my Makefile: CC = h5cc FC = h5fc LD = h5fc FDEBUG = -std -g -traceback CFLAGS = -g -O0 -Wall -pedantic FFLAGS = -g -O0 -Wall -I$(H5DIR)/include -L$(H5DIR)/lib/libhdf5hl_fortran.a LDFLAGS = -I$(H5DIR)/include -L$(H5DIR)/lib/libhdf5hl_fortran.a #LDFLAGS = -I$(MKLROOT)/include -L$(MKLROOT) -mkl=sequential # -opt-block-factor=16 -opt-prefetch=4 \ .SUFFIXES: .SUFFIXES: .c .f .f90 .F90 .o OBJS = timing.o \ kinds.o \ rw_matrix.o \ EXE = matmul_omp.exe all: $(EXE) $(EXE): $(OBJS) matmul_omp.o $(LD) $(LDFLAGS) -o $# $^ .f90.o: -$(RM) -f $*.o $*.mod $(FC) $(FFLAGS) -c $< .c.o: $(CC) $(CFLAGS) -c $< .PHONEY: clean clean: THis is the err: h5fc -I/curc/tools/x_86_64/rh6/hdf5/1.8.13/szip/2.1/zlib/1.2.8/jpeglib/9a/openmpi/1.8.2/intel/13.0.0/include -L/curc/tools/x_86_64/rh6/hdf5/1.8.13/szip/2.1/zlib/1.2.8/jpeglib/9a/openmpi/1.8.2/intel/13.0.0/lib/libhdf5hl_fortran.a -o matmul_omp.exe timing.o matmul_omp.o gfortran: /usr/lib64/libhdf5hl_fortran.a: No such file or directory gfortran: /usr/lib64/libhdf5_hl.a: No such file or directory gfortran: /usr/lib64/libhdf5_fortran.a: No such file or directory gfortran: /usr/lib64/libhdf5.a: No such file or directory As you can see that I directly link libhdf5hl_fortran.a. but i dont know why the error is giving a different directory /usr/lib64/
I think you have a couple of things wrong here. If you are using h5fc then you shouldn't need to add all the include and lib paths. That is the whole point of the helper applications. You are adding the paths that have Intel, yet your h5fc has a GNU (gfortran) error. The gfortran build of HDF5 looks as if it does not have the fortran bindings built. I would suggest trying the following. Using the full paths (as you have done) but call ifort instead of h5fc: ifort -I/curc/tools/x_86_64/rh6/hdf5/1.8.13/szip/2.1/zlib/1.2.8/jpeglib/9a/openmpi/1.8.2/intel/13.0.0/include \ -L/curc/tools/x_86_64/rh6/hdf5/1.8.13/szip/2.1/zlib/1.2.8/jpeglib/9a/openmpi/1.8.2/intel/13.0.0/lib/libhdf5hl_fortran.a \ -o matmul_omp.exe timing.o matmul_omp.o
IOS Simulator getting FIPS signature mismatch when compiling FIPS/Openssl Solution on OS-x
I'm trying to get a OpenSSL/FIPS build forking on the IOS simulator. Every combination I've tried gives wither compile/link errors, or when it does build I get a FIPS signature mismatch (and I've tried many, many permutations of scripts and combinations of settings). Here's the latest configuration I'm using: Tool Set: XCODE V 5 .1 SDK Version 7.1 For the FIPS module I'm using a script based on Appendix E of the Users Manual For the OpenSSL build I'm using a script based on https://github.com/x2on/OpenSSL-for-iPhone FIPS module build script: gunzip openssl-fips-2.0.1.tar.gz tar xf openssl-fips-2.0.1.tar . setenv-reset.sh . setenv-darwin-i386.sh gunzip ios-incore-2.0.1.tar.gz tar xf ios-incore-2.0.1.tar cd openssl-fips-2.0.1 ./config fipscanisterbuild make cd ios make cp ./incore_macho /usr/local/bin cd .. make clean rm -f *.dylib . ../setenv-reset.sh . ../setenv-ios-11.sh ./config fipscanisterbuild make make install Here are the Enviornment Variables ========================= MACHINE = i386 RELEASE = SYSTEM = iphoneos BUILD = build CROSS_TOP = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer CROSS_SDK = iPhoneSimulator7.1.sdk BUILD_TOOLS = CC = CROSS_TYPE = Simulator CROSS_CHAIN = C_INCLUDE_PATH = CPLUS_INCLUDE_PATH = HOSTCC = /usr/bin/cc HOSTCFLAGS = -arch i386 CROSS_COMPILE = /Users/scoleman/dev/IOSFipsBuilds/iosFIPSUsersManual/dev925/openssl-fips-2.0.1/iOS/ FIPS_SIG = /Users/scoleman/dev/IOSFipsBuilds/iosFIPSUsersManual/dev925/openssl-fips-2.0.1/iOS/incore_macho IOS_TARGET = darwin-iphoneos-cross IOS_INSTALLDIR = /usr/local/ssl/Release-iphoneos CONFIG_OPTIONS = no-asm no-shared --openssldir=/usr/local/ssl/Release-iphoneos CROSS_ARCH = CROSS_DEVELOPER = /Applications//Xcode.app/Contents/Developer CROSS_SYSROOT = IOS_TARGET = Openssl module build script VERSION="1.0.1i" # SDKVERSION=`xcrun -sdk iphoneos --show-sdk-version` # # Don't change anything under this line! # CURRENTPATH=`pwd` //ARCHS="i386 x86_64 armv7 armv7s arm64" ARCHS="i386" DEVELOPER=`xcode-select -print-path` mkdir -p "${CURRENTPATH}/src" mkdir -p "${CURRENTPATH}/bin" mkdir -p "${CURRENTPATH}/lib" tar zxf openssl-${VERSION}.tar.gz -C "${CURRENTPATH}/src" cd "${CURRENTPATH}/src/openssl-${VERSION}" for ARCH in ${ARCHS} do if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]]; then PLATFORM="iPhoneSimulator" else sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c" PLATFORM="iPhoneOS" fi export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk" export BUILD_TOOLS="${DEVELOPER}" export CC="${BUILD_TOOLS}/usr/bin/gcc -arch ${ARCH}" mkdir -p "${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" LOG="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/build-openssl-${VERSION}.log" set +e if [[ "$VERSION" =~ 1.0.0. ]]; then ./Configure BSD-generic32 --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" > "${LOG}" 2>&1 elif [ "${ARCH}" == "x86_64" ]; then ./Configure darwin64-x86_64-cc --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" > "${LOG}" 2>&1 else # - original line: ./Configure iphoneos-cross --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" > "${LOG}" 2>&1 ## this line was changed to add fips --with-fipsdir=/usr/local/ssl/Release-iphoneos ./Configure iphoneos-cross --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" fips --with-fipsdir=/usr/local/ssl/Release-iphoneos > "${LOG}" 2>&1 fi if [ $? != 0 ]; then echo "Problem while configure - Please check ${LOG}" exit 1 fi # add -isysroot to CC= sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -miphoneos-version-min=7.0 !" "Makefile" echo "PLATFORM = $PLATFORM" echo "CROSS_TOP = $CROSS_TOP" echo "CROSS_SDK = $CROSS_SDK" echo "BUILD_TOOLS = $BUILD_TOOLS" echo "-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK}" echo "CC = $CC" make >> "${LOG}" 2>&1 set -e make install >> "${LOG}" 2>&1 make clean >> "${LOG}" 2>&1 done echo "Build library..." lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/lib/libssl.a -output ${CURRENTPATH}/lib/libssl.a lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/lib/libcrypto.a -output ${CURRENTPATH}/lib/libcrypto.a mkdir -p ${CURRENTPATH}/include cp -R ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/include/openssl ${CURRENTPATH}/include/ echo "Building done." echo "Cleaning up..." rm -rf ${CURRENTPATH}/src/openssl-${VERSION} echo "Done." Here are the Environment Variables: -------------------------- PLATFORM = iPhoneSimulator CROSS_TOP = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer CROSS_SDK = iPhoneSimulator7.1.sdk BUILD_TOOLS = /Applications/Xcode.app/Contents/Developer -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk CC = /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -arch i386
I'm trying to get a OpenSSL/FIPS build forking on the IOS simulator. Every combination I've tried gives wither compile/link errors, or when it does build I get a FIPS signature mismatch (and I've tried many, many permutations of scripts and combinations of settings). It looks like your're missing a step. Where is the invocation of incore_macho on the resulting binary? Here, "resulting binary" is the executable from your app. In the OpenSSL sample, there is a custom build step called Embed Fingerprint under the Taget's Build Phases (its not available at the Project level). You can find the sample in the OpenSSL User Guide 2.0 for the FIPS Object Module, Appendix E.2. The screenshot is reproduced below: You might also find this useful. Its an updated incore_macho that include support for dylibs (for jail broken devices) and ARM64. I'm pretty sure it includes ARMv7s support.
RT5370 SH4 Cross Compile Driver Errors
I try to build 2.5.0.3 driver from file 2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO.bz2 to RT5370 chipset. Install STLinux 2.4 under Ubuntu 10.04.4 x32, make under kernel linux-sh4-2.5.32.59_stm24_0211. But I wrote /opt/STM/STLinux-2.2/devkit/sources/kernel/linux-sh4-2.5.32.59_stm24_0211 in path instead of STLinux-2.4, because Makefile have some defects: install: ifeq ($(TARGET), LINUX) ifneq (,$(findstring 2.4,$(LINUX_SRC))) $(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.4 install else $(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.6 install endif endif The mention in a path 2.4 build a kernel as 2.4 that in my case a mistake. Wrote in Makefile: PLATFORM = ST ... LINUX_SRC = /opt/STM/STLinux-2.2/devkit/sources/kernel/linux-sh4-2.5.32.59_stm24_0211 CROSS_COMPILE = /opt/STM/STLinux-2.2/devkit/sh4/bin/sh4-linux- In ./os/linux/config.mk wrote: HAS_WPA_SUPPLICANT=y HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y CC := sh4-linux-gcc LD := sh4-linux-ld Build at run make command. But have the error: script/Makefile.build:49: *** CFLAGS was changed in "/home/vitaliy/drv_src/os/linux/Makefile". Fix it to use EXTRA_CFLAGS. Founded strings at ./os/linux/config.mk: ifeq ($(PLATFORM),ST) CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(RT28xx_DIR)/include -Wall -O2 -Wundef -Wstrict-prototypes -Wno-trigraphs -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-aliasing -fno-common -fomit-frame-pointer -ffreestanding -m4-nofpu -o $(WFLAGS) export CFLAGS endif And change CFLAGS to EXTRA_CFLAGS in them. Again error: sh4-linux-gcc: error: -pg and -fomit-frame-pointer are incompatible. Ok. Remove flag -fomit-frame-pointer. Again error: error: cpu/cache.h: No such file or directory. In string: WFLAGS := -DAGGREGATION_SUPPORT -DPIGGYBACK_SUPPORT -DWMM_SUPPORT -DLINUX -Wall -Wstrict-prototypes -Wno-trigraphs Remove flag -DLINUX. Again error with unknown types (for example: ./os/linux/../../common/crypt_md5.c:638:1: error: unknown type name 'VOID' and so on with types 'UCHAR', 'ULONG' etc). Second way to build with help of KBUILD_NOPEDANTIC=1 make without changes in sources files of drivers. Error in this case too: ./os/linux/../../common/crypt_md5.c:28:23: fatal error: rt_config.h: No such file or directory. What is wrong in my building? Or can I fix sources code and build driver for SH4-platform. Thank you!
I recently got myself the same adapter, and I was trying to cross compile for ARM, and run into the same problem. Basically, you just have to add the include folder from the root of the driver package. I did these modifications to get it working: in DRIVER_DIR/Makefile, added: PLATFORM = MYPLATFORM All other platforms are commented out. Later in same file: ifeq ($(PLATFORM),MYPLATFORM) LINUX_SRC = /DIR_TO_MY_KERNEL_SRC/freescale_mainline/linux-mainline CROSS_COMPILE = /DIR_TO_MY_CROSS_COMPILER/arm-unknown-linux-uclibcgnueabi- CROSS_COMPILE_INCLUDE = /DRIVER_DIR/include /*Might not be necessary*/ endif Then in DRIVER_DIR/os/linux/config.mk, added: ifeq ($(PLATFORM),MYPLATFORM) EXTRA_CFLAGS := $(WFLAGS) -I$(RT28xx_DIR)/include endif Also, please note that in your kernel configuration you need to have couple of flags enabled: CONFIG_WEXT_CORE=y CONFIG_WEXT_PROC=y CONFIG_WEXT_SPY=y CONFIG_WEXT_PRIV=y You can find them under Device Drivers-->Network Device Support-->Wireless LAN-->IEEE 802.11 for Host AP I compile it just like this now: DRIVER_DIR$ ARCH=arm make Hope it helps!