- Posts: 24
- Joined: Wed Nov 27, 2019 3:35 am
- Real Name: Jun Lin
Hello,
I'm developing Resolve(v18.0) plugin based on OFX, and I implemented some swift code(SwiftMotionWrap.swift). But when I compile it by makefile, it always show error below.
It's on MacOS 12.0.1. I'd like to know how compile Swift code in makefile? Thanks a lot.
My makefile likes below.
Jun
I'm developing Resolve(v18.0) plugin based on OFX, and I implemented some swift code(SwiftMotionWrap.swift). But when I compile it by makefile, it always show error below.
- Code: Select all
c++ SwiftMotionWrap.o GainPlugin.o ImageScaler.o MetalKernel.o OpenCLKernel.o ofxsCore.o ofxsImageEffect.o ofxsInteract.o ofxsLog.o ofxsMultiThread.o ofxsParams.o ofxsProperty.o ofxsPropertyValidation.o -o GainPlugin.ofx -bundle -fvisibility=hidden -F/usr/lib/swift -F/Library/Frameworks -framework OpenCL -framework Metal -framework AppKit -framework Foundation -arch arm64 -arch x86_64
ld: warning: Could not find or use auto-linked library 'swiftFoundation'
ld: warning: Could not find or use auto-linked library 'swiftDarwin'
ld: warning: Could not find or use auto-linked library 'swiftCore'
ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find or use auto-linked library 'swift_Concurrency'
ld: warning: Could not find or use auto-linked library 'swiftDispatch'
ld: warning: Could not find or use auto-linked library 'swiftXPC'
ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find or use auto-linked library 'swiftIOKit'
ld: warning: Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
Undefined symbols for architecture arm64:
"value witness table for Builtin.UnknownObject", referenced from:
full type metadata for SwiftMotionWrap.SwiftMotionWrap in SwiftMotionWrap.o
"__swift_FORCE_LOAD_$_swiftCoreFoundation", referenced from:
__swift_FORCE_LOAD_$_swiftCoreFoundation_$_SwiftMotionWrap in SwiftMotionWrap.o
(maybe you meant: __swift_FORCE_LOAD_$_swiftCoreFoundation_$_SwiftMotionWrap)
"__swift_FORCE_LOAD_$_swiftCoreGraphics", referenced from:
__swift_FORCE_LOAD_$_swiftCoreGraphics_$_SwiftMotionWrap in SwiftMotionWrap.o
(maybe you meant: __swift_FORCE_LOAD_$_swiftCoreGraphics_$_SwiftMotionWrap)
"__swift_FORCE_LOAD_$_swiftDarwin", referenced from:
__swift_FORCE_LOAD_$_swiftDarwin_$_SwiftMotionWrap in SwiftMotionWrap.o
(maybe you meant: __swift_FORCE_LOAD_$_swiftDarwin_$_SwiftMotionWrap)
"__swift_FORCE_LOAD_$_swiftDispatch", referenced from:
__swift_FORCE_LOAD_$_swiftDispatch_$_SwiftMotionWrap in SwiftMotionWrap.o
(maybe you meant: __swift_FORCE_LOAD_$_swiftDispatch_$_SwiftMotionWrap)
"__swift_FORCE_LOAD_$_swiftFoundation", referenced from:
__swift_FORCE_LOAD_$_swiftFoundation_$_SwiftMotionWrap in SwiftMotionWrap.o
(maybe you meant: __swift_FORCE_LOAD_$_swiftFoundation_$_SwiftMotionWrap)
"__swift_FORCE_LOAD_$_swiftIOKit", referenced from:
__swift_FORCE_LOAD_$_swiftIOKit_$_SwiftMotionWrap in SwiftMotionWrap.o
(maybe you meant: __swift_FORCE_LOAD_$_swiftIOKit_$_SwiftMotionWrap)
"__swift_FORCE_LOAD_$_swiftObjectiveC", referenced from:
__swift_FORCE_LOAD_$_swiftObjectiveC_$_SwiftMotionWrap in SwiftMotionWrap.o
(maybe you meant: __swift_FORCE_LOAD_$_swiftObjectiveC_$_SwiftMotionWrap)
"__swift_FORCE_LOAD_$_swiftXPC", referenced from:
__swift_FORCE_LOAD_$_swiftXPC_$_SwiftMotionWrap in SwiftMotionWrap.o
(maybe you meant: __swift_FORCE_LOAD_$_swiftXPC_$_SwiftMotionWrap)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [GainPlugin.ofx] Error 1
It's on MacOS 12.0.1. I'd like to know how compile Swift code in makefile? Thanks a lot.
My makefile likes below.
- Code: Select all
UNAME_SYSTEM := $(shell uname -s)
CXXFLAGS = -fvisibility=hidden -I../OpenFX-1.4/include -I../Support/include
SHADERS = ../../../../../../work/code/pw_Utility/lib/TCMotionGradingKit/bin/macOS
ifeq ($(UNAME_SYSTEM), Linux)
AMDAPP_PATH ?= /opt/AMDAPP
CXXFLAGS += -I${AMDAPP_PATH}/include -fPIC
CUDAPATH ?= /usr/local/cuda
NVCC = ${CUDAPATH}/bin/nvcc
NVCCFLAGS = --compiler-options="-fPIC"
LDFLAGS = -shared -fvisibility=hidden -L${CUDAPATH}/lib64 -lcuda -lcudart_static
BUNDLE_DIR = GainPlugin.ofx.bundle/Contents/Linux-x86-64/
CUDA_OBJ = CudaKernel.o
else
ARCH_FLAGS = -arch arm64 -arch x86_64
CXXFLAGS += ${ARCH_FLAGS}
LDFLAGS = -bundle -fvisibility=hidden -F$(SDKROOT)/usr/lib/swift -F/Library/Frameworks -framework OpenCL -framework Metal -framework AppKit -framework Foundation
LDFLAGS += ${ARCH_FLAGS}
BUNDLE_DIR = GainPlugin.ofx.bundle/Contents/MacOS/
METAL_OBJ = MetalKernel.o
endif
GainPlugin.ofx: SwiftMotionWrap.o GainPlugin.o ImageScaler.o ${CUDA_OBJ} $(METAL_OBJ) OpenCLKernel.o ofxsCore.o ofxsImageEffect.o ofxsInteract.o ofxsLog.o ofxsMultiThread.o ofxsParams.o ofxsProperty.o ofxsPropertyValidation.o
$(CXX) $^ -o $@ $(LDFLAGS)
mkdir -p $(BUNDLE_DIR)
cp GainPlugin.ofx $(BUNDLE_DIR)
CudaKernel.o: CudaKernel.cu
${NVCC} -c $< $(NVCCFLAGS)
MetalKernel.o: MetalKernel.mm
$(CXX) -c $< $(CXXFLAGS)
%.o: ../Support/Library/%.cpp
$(CXX) -c $< $(CXXFLAGS)
%.o: %.swift
@swiftc -c $< -o $@ -emit-module
clean:
rm -f *.o *.ofx
rm -fr GainPlugin.ofx.bundle
install: GainPlugin.ofx
rm -fr /Library/OFX/Plugins/GainPlugin.ofx.bundle
cp -fr GainPlugin.ofx.bundle /Library/OFX/Plugins
Jun