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

Build failed on 32-bit arm platform #829

Closed
JackBoosY opened this issue Oct 23, 2020 · 6 comments
Closed

Build failed on 32-bit arm platform #829

JackBoosY opened this issue Oct 23, 2020 · 6 comments
Assignees
Labels

Comments

@JackBoosY
Copy link

Describe the bug

A few months ago, I received an issue, that is, Abseil cannot be built on the 32-bit arm platform using vcpkg (microsoft/vcpkg#11820), so I submitted a PR (microsoft/vcpkg#11827) to fix this issue.
Unfortunately, this PR broke the build of the 64-bit arm platform.
After communicating with the cctz official (google/cctz#173), they believe that this is a setting error in abseil that caused the symbol mismatch problem.
Error log:

time_zone_info.obj : error LNK2001: unresolved external symbol "class std::unique_ptr<class absl::time_internal::cctz::ZoneInfoSource,struct std::default_delete<class absl::time_internal::cctz::ZoneInfoSource> > (__cdecl* absl::time_internal::cctz_extension::zone_info_source_factory)(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::function<class std::unique_ptr<class absl::time_internal::cctz::ZoneInfoSource,struct std::default_delete<class absl::time_internal::cctz::ZoneInfoSource> > __cdecl(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)> const &)" (?zone_info_source_factory@cctz_extension@time_internal@absl@@3P6A?AV?$unique_ptr@VZoneInfoSource@cctz@time_internal@absl@@U?$default_delete@VZoneInfoSource@cctz@time_internal@absl@@@std@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@5@AEBV?$function@$$A6A?AV?$unique_ptr@VZoneInfoSource@cctz@time_internal@absl@@U?$default_delete@VZoneInfoSource@cctz@time_internal@absl@@@std@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z@5@@ZEA) [C:\Users\ComputerName\testx\ProjectForWindows\vcpkg\buildtrees\abseil\arm64-uwp-dbg\absl\abseil_dll.vcxproj]

And if I only use the cctz official patch (only modify #elif defined(_M_IA_64) to #elif defined(_M_IA_64) || defined(_M_AMD64) || \ defined(_M_ARM64)), I will encounter the following error when building arm-windows:

time_zone_info.cc.obj : error LNK2001: unresolved external symbol "class std::unique_ptr<class absl::lts_2020_09_23::time_internal::cctz::ZoneInfoSource,struct std::default_delete<class absl::lts_2020_09_23::time_internal::cctz::ZoneInfoSource> > (__cdecl* absl::lts_2020_09_23::time_internal::cctz_extension::zone_info_source_factory)(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::function<class std::unique_ptr<class absl::lts_2020_09_23::time_internal::cctz::ZoneInfoSource,struct std::default_delete<class absl::lts_2020_09_23::time_internal::cctz::ZoneInfoSource> > __cdecl(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)> const &)" (?zone_info_source_factory@cctz_extension@time_internal@lts_2020_09_23@absl@@3P6A?AV?$unique_ptr@VZoneInfoSource@cctz@time_internal@lts_2020_09_23@absl@@U?$default_delete@VZoneInfoSource@cctz@time_internal@lts_2020_09_23@absl@@@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@6@ABV?$function@$$A6A?AV?$unique_ptr@VZoneInfoSource@cctz@time_internal@lts_2020_09_23@absl@@U?$default_delete@VZoneInfoSource@cctz@time_internal@lts_2020_09_23@absl@@@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z@6@@ZA)

Do you have any ideas?

Steps to reproduce the bug

  1. git clone https://github.com/microsoft/vcpkg.git
  2. .\bootstrap-vcpkg.bat
  3. .\vcpkg install abseil:arm64-uwp

What version of Abseil are you using?
2020-03-03

What operating system and version are you using
Windows 10 64bit
vcpkg latest

What compiler and version are you using?
Visual Studio 2017 latest build

What build system are you using?
vcpkg (cmake 3.18.2 with Visual Studio 2017)
Additional context

Thanks.

@JackBoosY JackBoosY added the bug label Oct 23, 2020
@JackBoosY
Copy link
Author

I've revert my changes about the arm32 build.
Can anyone fix this issue here?

@tusharb86
Copy link

@JackBoosY I think this patch might be the way to make the linker happy for both arm32 and arm64. @vslashg Is there any issue with merging this patch? I'm happy to open a PR and help get this through. Thanks!

diff --git a/absl/time/internal/cctz/src/zone_info_source.cc b/absl/time/internal/cctz/src/zone_info_source.cc
index 7209533..5ab5a59 100644
--- a/absl/time/internal/cctz/src/zone_info_source.cc
+++ b/absl/time/internal/cctz/src/zone_info_source.cc
@@ -65,7 +65,7 @@ ZoneInfoSourceFactory zone_info_source_factory __attribute__((weak)) =
 extern ZoneInfoSourceFactory zone_info_source_factory;
 extern ZoneInfoSourceFactory default_factory;
 ZoneInfoSourceFactory default_factory = DefaultFactory;
-#if defined(_M_IX86)
+#if defined(_M_IX86) || defined(_M_ARM)
 #pragma comment(                                                                                                         \
     linker,                                                                                                              \
     "/alternatename:?zone_info_source_factory@cctz_extension@time_internal@" ABSL_INTERNAL_MANGLED_NS                    \
@@ -83,8 +83,7 @@ ZoneInfoSourceFactory default_factory = DefaultFactory;
     "@@U?$default_delete@VZoneInfoSource@cctz@time_internal@" ABSL_INTERNAL_MANGLED_NS                                   \
     "@@@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z@" ABSL_INTERNAL_MANGLED_BACKREFERENCE \
     "@@ZA")
-#elif defined(_M_IA_64) || defined(_M_AMD64) || defined(_M_ARM) || \
-    defined(_M_ARM64)
+#elif defined(_M_IA_64) || defined(_M_AMD64) || defined(_M_ARM64)
 #pragma comment(                                                                                                          \
     linker,                                                                                                               \
     "/alternatename:?zone_info_source_factory@cctz_extension@time_internal@" ABSL_INTERNAL_MANGLED_NS                     \

@NancyLi1013
Copy link

Thanks for your fix @tusharb86.

@derekmauro, @vslashg Could you please help confirm if the patch from @tusharb86 is acceptable?

I have verified that this can solve the problem posted by @JackBoosY

@derekmauro
Copy link
Member

derekmauro commented Nov 1, 2021

This patch looks plausible to me. I'll run it though some tests and see what happens.

@derekmauro derekmauro assigned derekmauro and unassigned vslashg Nov 1, 2021
derekmauro added a commit to derekmauro/cctz that referenced this issue Nov 1, 2021
This patch changes the linking of 32-bit ARM zone info source to use
the same code as the 32-bit X86 zone info source.

This change is requested in
abseil/abseil-cpp#829 by members of the
Microsoft organization who say it fixes the issue.
devbww pushed a commit to google/cctz that referenced this issue Nov 1, 2021
This patch changes the linking of 32-bit ARM zone info source to use
the same code as the 32-bit X86 zone info source.

This change is requested in
abseil/abseil-cpp#829 by members of the
Microsoft organization who say it fixes the issue.
@derekmauro
Copy link
Member

Fixed by 3b22e57.

@JackBoosY
Copy link
Author

Thanks guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants