From 3a4b3facc17854c02b92a65775307ba0ed58d03e Mon Sep 17 00:00:00 2001 From: Tao Xu Date: Thu, 12 Sep 2019 01:24:38 -0700 Subject: [PATCH 1/7] [iOS]Replace the source link for testing A couple of changes 1. Replace the source link with the newly nightly build address 2. Remove module support for Swift and Objective-C 3. Upload all static libraries instead of archiving them into one single library. This is because those static libraries might contain object files that have the same name, e.g. `init.c.o` in both libcupinfo and libqnnpack. If we archive them into one using this `libtool -static` command, by default, it only picks one object file and discard the others, which could result in undefined symbols when linking the executable.The solution here is to keep all the static libraries and let the linker decide which one to use. - pod spec lint succeed - `pod spec lint --verbose --allow-warnings --no-clean --use-libraries --skip-import-validation` --- ios/LibTorch.podspec | 11 ++++++----- ios/framework.modulemap | 4 ---- 2 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 ios/framework.modulemap diff --git a/ios/LibTorch.podspec b/ios/LibTorch.podspec index c04d3a1cdd534..efb03cd6e99b5 100644 --- a/ios/LibTorch.podspec +++ b/ios/LibTorch.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.authors = 'PyTorch Team' s.license = { :type => 'BSD' } s.homepage = 'https://github.com/pytorch/pytorch' - s.source = { :http => 'http://ossci-macos.s3.amazonaws.com/libtorch_x86_arm64.zip' } + s.source = { :http => 'http://ossci-ios-build.s3.amazonaws.com/libtorch_ios_nightly_build.zip' } s.summary = 'The PyTorch C++ library for iOS' s.description = <<-DESC The PyTorch C++ library for iOS. @@ -18,7 +18,7 @@ Pod::Spec.new do |s| s.subspec 'Torch' do |ss| ss.header_mappings_dir = 'install/include/' ss.preserve_paths = 'install/include/**/*.{h,cpp,cc,c}' - ss.vendored_libraries = 'install/lib/libtorch.a' + ss.vendored_libraries = 'install/lib/*.a' ss.libraries = ['c++', 'stdc++'] end s.user_target_xcconfig = { @@ -27,8 +27,9 @@ Pod::Spec.new do |s| 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++11', 'CLANG_CXX_LIBRARY' => 'libc++' } - s.pod_target_xcconfig = { 'VALID_ARCHS' => 'x86_64 armv7s arm64' } - s.module_name='LibTorch' - s.module_map = 'src/framework.modulemap' + s.pod_target_xcconfig = { + 'HEADER_SEARCH_PATHS' => '$(inherited) "$(PODS_ROOT)/LibTorch/install/include/"', + 'VALID_ARCHS' => 'x86_64 armv7s arm64' + } s.library = ['c++', 'stdc++'] end \ No newline at end of file diff --git a/ios/framework.modulemap b/ios/framework.modulemap deleted file mode 100644 index 263554d370631..0000000000000 --- a/ios/framework.modulemap +++ /dev/null @@ -1,4 +0,0 @@ -framework module LibTorch { - umbrella header "LibTorch.h" - export * -} \ No newline at end of file From ca6cc0574e88af10314937e5d034c20a46be4af5 Mon Sep 17 00:00:00 2001 From: Tao Xu Date: Thu, 12 Sep 2019 02:35:16 -0700 Subject: [PATCH 2/7] Update on "[iOS] Change the source link in podspec" ### Summary A couple of changes 1. Replace the source link with the newly nightly build address 2. Remove module support for Swift and Objective-C 3. Expose all static libraries instead of archiving them into one single library. This is because those static libraries might contain object files that have the same name, e.g. `init.c.o` in both libcupinfo and libqnnpack. If we archive them into one using this `libtool -static` command, by default, it only picks one object file and discard the others, which could result in undefined symbols when linking the executable.The solution here is to keep all the static libraries and let the linker decide which one to use. ### Test Plan - pod spec lint succeed - `pod spec lint --verbose --allow-warnings --no-clean --use-libraries --skip-import-validation` --- ios/LibTorch.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/LibTorch.podspec b/ios/LibTorch.podspec index efb03cd6e99b5..2febb5af1946d 100644 --- a/ios/LibTorch.podspec +++ b/ios/LibTorch.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.authors = 'PyTorch Team' s.license = { :type => 'BSD' } s.homepage = 'https://github.com/pytorch/pytorch' - s.source = { :http => 'http://ossci-ios-build.s3.amazonaws.com/libtorch_ios_nightly_build.zip' } + s.source = { :http => 'https://ossci-ios-build.s3.amazonaws.com/libtorch_ios_nightly_build.zip' } s.summary = 'The PyTorch C++ library for iOS' s.description = <<-DESC The PyTorch C++ library for iOS. From 52ecec1dd67d92e78e3665af2565312cf0daeb17 Mon Sep 17 00:00:00 2001 From: Tao Xu Date: Thu, 12 Sep 2019 18:53:41 -0700 Subject: [PATCH 3/7] Update on "[iOS] Change the source link in podspec" ### Summary A couple of changes 1. Replace the source link with the newly nightly build address 2. Remove module support for Swift and Objective-C 3. Expose all static libraries instead of archiving them into one single library. This is because those static libraries might contain object files that have the same name, e.g. `init.c.o` in both `libcupinfo.a` and `libqnnpack.a`. If we archive them into one using this `libtool -static` command, by default, it only picks one object file and discards the others, which could result in undefined symbols when linking the executable. The change here is to expose all the static libraries and let the linker decide which one to use. ### Test Plan - pod spec lint succeed - `pod spec lint --verbose --allow-warnings --no-clean --use-libraries --skip-import-validation` --- ios/LibTorch.h | 8 +------- ios/LibTorch.podspec | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/ios/LibTorch.h b/ios/LibTorch.h index ec6627ebedea9..0d145ecefc66e 100644 --- a/ios/LibTorch.h +++ b/ios/LibTorch.h @@ -1,7 +1 @@ -#include - -#if TARGET_OS_IPHONE - #define AT_NNPACK_ENABLED() 1 - #define USE_NNPACK ON - #undef CAFFE2_PERF_WITH_AVX512 -#endif +#include \ No newline at end of file diff --git a/ios/LibTorch.podspec b/ios/LibTorch.podspec index 2febb5af1946d..af189eea9e23b 100644 --- a/ios/LibTorch.podspec +++ b/ios/LibTorch.podspec @@ -12,7 +12,7 @@ Pod::Spec.new do |s| s.default_subspec = 'Core' s.subspec 'Core' do |ss| ss.dependency 'LibTorch/Torch' - ss.source_files = 'src/*.{h,cpp,cc}' + ss.source_files = 'src/*.{h,cpp,c,cc}' ss.public_header_files = ['src/LibTorch.h'] end s.subspec 'Torch' do |ss| From 13417e37f3ad62223e00d3021f9db0854f37e6cb Mon Sep 17 00:00:00 2001 From: Tao Xu Date: Thu, 12 Sep 2019 23:16:59 -0700 Subject: [PATCH 4/7] Update on "[iOS] Change the source link in podspec" ### Summary A couple of changes 1. Replace the source link with the newly nightly build address 2. Remove module support for Swift and Objective-C 3. Expose all static libraries instead of archiving them into one single library. This is because those static libraries might contain object files that have the same name, e.g. `init.c.o` in both `libcupinfo.a` and `libqnnpack.a`. If we archive them into one using this `libtool -static` command, by default, it only picks one object file and discards the others, which could result in undefined symbols when linking the executable. The change here is to expose all the static libraries and let the linker decide which one to use. ### Test Plan - pod spec lint succeed - `pod spec lint --verbose --allow-warnings --no-clean --use-libraries --skip-import-validation` Differential Revision: [D17363037](https://our.internmc.facebook.com/intern/diff/D17363037) --- ios/LibTorch.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ios/LibTorch.h b/ios/LibTorch.h index 0d145ecefc66e..e75bb1eb8404a 100644 --- a/ios/LibTorch.h +++ b/ios/LibTorch.h @@ -1 +1,6 @@ -#include \ No newline at end of file +#ifndef LibTorch_h +#define LibTorch_h + +#include + +#endif From 83cf671d695cec3c642e61e0d4489000a64593ad Mon Sep 17 00:00:00 2001 From: Tao Xu Date: Fri, 13 Sep 2019 13:28:22 -0700 Subject: [PATCH 5/7] Update on "[iOS] Change the source link in podspec" ### Summary A couple of changes 1. Replace the source link with the newly nightly build address 2. Remove module support for Swift and Objective-C 3. Expose all static libraries instead of archiving them into one single library. This is because those static libraries might contain object files that have the same name, e.g. `init.c.o` in both `libcupinfo.a` and `libqnnpack.a`. If we archive them into one using this `libtool -static` command, by default, it only picks one object file and discards the others, which could result in undefined symbols when linking the executable. The change here is to expose all the static libraries and let the linker decide which one to use. ### Test Plan - pod spec lint succeed - `pod spec lint --verbose --allow-warnings --no-clean --use-libraries --skip-import-validation` Differential Revision: [D17363037](https://our.internmc.facebook.com/intern/diff/D17363037) --- ios/LibTorch.podspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ios/LibTorch.podspec b/ios/LibTorch.podspec index af189eea9e23b..c4a021009bba3 100644 --- a/ios/LibTorch.podspec +++ b/ios/LibTorch.podspec @@ -22,13 +22,13 @@ Pod::Spec.new do |s| ss.libraries = ['c++', 'stdc++'] end s.user_target_xcconfig = { - 'HEADER_SEARCH_PATHS' => '$(inherited) "$(PODS_ROOT)/LibTorch/install/include/"', - 'OTHER_LDFLAGS' => '-force_load "$(PODS_ROOT)/LibTorch/install/lib/libtorch.a"', + 'HEADER_SEARCH_PATHS' => '$(inherited) "$(PODS_ROOT)/#{s.name}/install/include/"', + 'OTHER_LDFLAGS' => '-force_load "$(PODS_ROOT)/#{s.name}/install/lib/libtorch.a"', 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++11', 'CLANG_CXX_LIBRARY' => 'libc++' } s.pod_target_xcconfig = { - 'HEADER_SEARCH_PATHS' => '$(inherited) "$(PODS_ROOT)/LibTorch/install/include/"', + 'HEADER_SEARCH_PATHS' => '$(inherited) "$(PODS_ROOT)/#{s.name}/install/include/"', 'VALID_ARCHS' => 'x86_64 armv7s arm64' } s.library = ['c++', 'stdc++'] From 979c4b604dae9dc857f04075620fcbfc1329a687 Mon Sep 17 00:00:00 2001 From: Tao Xu Date: Fri, 13 Sep 2019 13:44:14 -0700 Subject: [PATCH 6/7] Update on "[iOS] Change the source link in podspec" ### Summary A couple of changes 1. Replace the source link with the newly nightly build address 2. Remove module support for Swift and Objective-C 3. Expose all static libraries instead of archiving them into one single library. This is because those static libraries might contain object files that have the same name, e.g. `init.c.o` in both `libcupinfo.a` and `libqnnpack.a`. If we archive them into one using this `libtool -static` command, by default, it only picks one object file and discards the others, which could result in undefined symbols when linking the executable. The change here is to expose all the static libraries and let the linker decide which one to use. ### Test Plan - pod spec lint succeed - `pod spec lint --verbose --allow-warnings --no-clean --use-libraries --skip-import-validation` Differential Revision: [D17363037](https://our.internmc.facebook.com/intern/diff/D17363037) --- ios/LibTorch.podspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ios/LibTorch.podspec b/ios/LibTorch.podspec index c4a021009bba3..af189eea9e23b 100644 --- a/ios/LibTorch.podspec +++ b/ios/LibTorch.podspec @@ -22,13 +22,13 @@ Pod::Spec.new do |s| ss.libraries = ['c++', 'stdc++'] end s.user_target_xcconfig = { - 'HEADER_SEARCH_PATHS' => '$(inherited) "$(PODS_ROOT)/#{s.name}/install/include/"', - 'OTHER_LDFLAGS' => '-force_load "$(PODS_ROOT)/#{s.name}/install/lib/libtorch.a"', + 'HEADER_SEARCH_PATHS' => '$(inherited) "$(PODS_ROOT)/LibTorch/install/include/"', + 'OTHER_LDFLAGS' => '-force_load "$(PODS_ROOT)/LibTorch/install/lib/libtorch.a"', 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++11', 'CLANG_CXX_LIBRARY' => 'libc++' } s.pod_target_xcconfig = { - 'HEADER_SEARCH_PATHS' => '$(inherited) "$(PODS_ROOT)/#{s.name}/install/include/"', + 'HEADER_SEARCH_PATHS' => '$(inherited) "$(PODS_ROOT)/LibTorch/install/include/"', 'VALID_ARCHS' => 'x86_64 armv7s arm64' } s.library = ['c++', 'stdc++'] From f64c13a58d3e86daeb8d4abbb24752582932371a Mon Sep 17 00:00:00 2001 From: Tao Xu Date: Fri, 13 Sep 2019 13:46:23 -0700 Subject: [PATCH 7/7] Update on "[iOS] Change the source link in podspec" ### Summary A couple of changes 1. Replace the source link with the newly nightly build address 2. Remove module support for Swift and Objective-C 3. Expose all static libraries instead of archiving them into one single library. This is because those static libraries might contain object files that have the same name, e.g. `init.c.o` in both `libcupinfo.a` and `libqnnpack.a`. If we archive them into one using this `libtool -static` command, by default, it only picks one object file and discards the others, which could result in undefined symbols when linking the executable. The change here is to expose all the static libraries and let the linker decide which one to use. ### Test Plan - pod spec lint succeed - `pod spec lint --verbose --allow-warnings --no-clean --use-libraries --skip-import-validation` Differential Revision: [D17363037](https://our.internmc.facebook.com/intern/diff/D17363037) --- ios/LibTorch.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/LibTorch.podspec b/ios/LibTorch.podspec index af189eea9e23b..62a872de733f2 100644 --- a/ios/LibTorch.podspec +++ b/ios/LibTorch.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'LibTorch' - s.version = '0.0.1' + s.version = '0.0.2' s.authors = 'PyTorch Team' s.license = { :type => 'BSD' } s.homepage = 'https://github.com/pytorch/pytorch'