Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using iconv for Utf8Converter on Apple device #15599

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions js/react_native/ios/OnnxruntimeModule.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
DBDB57DC2603211A004F16BE /* libOnnxruntimeModule.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 134814201AA4EA6300B7C361 /* libOnnxruntimeModule.a */; };
DBDB588B2609B18F004F16BE /* Resources in Resources */ = {isa = PBXBuildFile; fileRef = DBDB588A2609B18F004F16BE /* Resources */; };
DBDB58B0262A92D7004F16BE /* OnnxruntimeModuleTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = DBDB58AF262A92D6004F16BE /* OnnxruntimeModuleTest.mm */; };
E3D7A60E29F8D87D00FF5265 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = E3D7A60D29F8D87D00FF5265 /* libiconv.tbd */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -46,6 +47,7 @@
DBDB57DB2603211A004F16BE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
DBDB588A2609B18F004F16BE /* Resources */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Resources; path = OnnxruntimeModuleTest/Resources; sourceTree = "<group>"; };
DBDB58AF262A92D6004F16BE /* OnnxruntimeModuleTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = OnnxruntimeModuleTest.mm; sourceTree = "<group>"; };
E3D7A60D29F8D87D00FF5265 /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/lib/libiconv.tbd; sourceTree = DEVELOPER_DIR; };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where can we find the license of this file: Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/lib/libiconv.tbd ?

Would it be bad to hardcode a XCode version here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was generated from XCode GUI Application. I have to link the library for these 2 xcode projects from the Xcode GUI. The library is part of Apple SDK.

I can try to remove the 13.3 from the MacOSX13.3.sdk, and it should works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-04-25 at 9 25 57 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-04-25 at 9 26 48 PM

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The library must come with some headers files. One of them should be iconv.h. Could you please open the file and inspect its license?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/* Copyright (C) 1999-2003, 2005-2006 Free Software Foundation, Inc.
This file is part of the GNU LIBICONV Library.

The GNU LIBICONV Library is free software; you can redistribute it
and/or modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

The GNU LIBICONV Library is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with the GNU LIBICONV Library; see the file COPYING.LIB.
If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
Fifth Floor, Boston, MA 02110-1301, USA. */

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is GNU, but is the copyright expired?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I don't think so. We should avoid using it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we have to find another alternative before we adapt MacOS SDK 13.3.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -60,6 +62,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
E3D7A60E29F8D87D00FF5265 /* libiconv.tbd in Frameworks */,
DBDB57DC2603211A004F16BE /* libOnnxruntimeModule.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -84,6 +87,7 @@
134814211AA4EA7D00B7C361 /* Products */,
62ED2272D9F9CF7E3D0A8F87 /* Pods */,
DBDB57D72603211A004F16BE /* OnnxruntimeModuleTest.xctest */,
E3D7A60C29F8D87D00FF5265 /* Frameworks */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -113,6 +117,14 @@
path = OnnxruntimeModuleTest;
sourceTree = "<group>";
};
E3D7A60C29F8D87D00FF5265 /* Frameworks */ = {
isa = PBXGroup;
children = (
E3D7A60D29F8D87D00FF5265 /* libiconv.tbd */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down
4 changes: 2 additions & 2 deletions onnxruntime/core/providers/cpu/nn/string_normalizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifdef _MSC_VER
#include <codecvt>
#include <locale.h>
#elif defined(__APPLE__) || defined(__ANDROID__)
#elif defined(__ANDROID__)
#include <codecvt>
#else
#include <limits>
Expand Down Expand Up @@ -110,7 +110,7 @@ class Locale {
std::locale loc_;
};

#if defined(__APPLE__) || defined(__ANDROID__)
#if defined(__ANDROID__)
using Utf8Converter = std::wstring_convert<std::codecvt_utf8<wchar_t>>;
#else

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
229E595926586B4A006E41AE /* sigmoid.ort in Resources */ = {isa = PBXBuildFile; fileRef = 229E595826586B4A006E41AE /* sigmoid.ort */; };
22C1D8EA271A79FD002CEE67 /* ios_package_uitest_cpp_api.mm in Sources */ = {isa = PBXBuildFile; fileRef = 22C1D8E9271A79FD002CEE67 /* ios_package_uitest_cpp_api.mm */; };
22C1D8EB271A7A06002CEE67 /* sigmoid.ort in Resources */ = {isa = PBXBuildFile; fileRef = 229E595826586B4A006E41AE /* sigmoid.ort */; };
E3D7A60B29F8877400FF5265 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = E3D7A60A29F8877400FF5265 /* libiconv.tbd */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -37,6 +38,7 @@
229E595826586B4A006E41AE /* sigmoid.ort */ = {isa = PBXFileReference; lastKnownFileType = file; path = sigmoid.ort; sourceTree = "<group>"; };
22C1D8DE271A79AF002CEE67 /* ios_package_testUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ios_package_testUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
22C1D8E9271A79FD002CEE67 /* ios_package_uitest_cpp_api.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ios_package_uitest_cpp_api.mm; sourceTree = "<group>"; };
E3D7A60A29F8877400FF5265 /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/lib/libiconv.tbd; sourceTree = DEVELOPER_DIR; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -51,6 +53,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
E3D7A60B29F8877400FF5265 /* libiconv.tbd in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -64,6 +67,7 @@
229E591E265869BF006E41AE /* ios_package_test */,
22C1D8DF271A79AF002CEE67 /* ios_package_testUITests */,
229E591D265869BF006E41AE /* Products */,
E3D7A60929F8877400FF5265 /* Frameworks */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -105,6 +109,14 @@
path = ios_package_testUITests;
sourceTree = "<group>";
};
E3D7A60929F8877400FF5265 /* Frameworks */ = {
isa = PBXGroup;
children = (
E3D7A60A29F8877400FF5265 /* libiconv.tbd */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down