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

[SR-1835] test/Interpreter/SDK/libc.swift fails on Android #44444

Open
modocache mannequin opened this issue Jun 20, 2016 · 1 comment
Open

[SR-1835] test/Interpreter/SDK/libc.swift fails on Android #44444

modocache mannequin opened this issue Jun 20, 2016 · 1 comment
Labels
Android Platform: Android bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. good first issue Good for newcomers standard library Area: Standard library umbrella

Comments

@modocache
Copy link
Mannequin

modocache mannequin commented Jun 20, 2016

Previous ID SR-1835
Radar None
Original Reporter @modocache
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug, Android, StarterBug
Assignee None
Priority Medium

md5: 0255bc27175dbbaf4288ecf685de7131

Issue Description:

It appears as if the reference to stdout is causing a compilation failure:

********************
FAIL: Swift :: Interpreter/SDK/libc.swift (1126 of 8325)
******************** TEST 'Swift :: Interpreter/SDK/libc.swift' FAILED ********************
Script:
--
rm -rf /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-android-armv7/Interpreter/SDK/Output/libc.swift.tmp  &&  mkdir -p /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-android-armv7/Interpreter/SDK/Output/libc.swift.tmp
rm -rf /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-android-armv7/Interpreter/SDK/Output/libc.swift.tmp && mkdir -p /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-android-armv7/Interpreter/SDK/Output/libc.swift.tmp && /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swiftc -target armv7-none-linux-androideabi -sdk /home/modocache/android-ndk-r11c/platforms/android-21/arch-arm -L /home/modocache/android-ndk-r11c/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a -L /home/modocache/android-ndk-r11c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9 -Xlinker -pie  -module-cache-path '/tmp/swift-testsuite-clang-module-cachesARjF4'   -module-cache-path '/tmp/swift-testsuite-clang-module-cachesARjF4' /home/modocache/GitHub/apple/swift/test/Interpreter/SDK/libc.swift -o /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-android-armv7/Interpreter/SDK/Output/libc.swift.tmp/a.out -module-name main && /home/modocache/GitHub/apple/swift/utils/android/adb_test_runner.py /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-android-armv7/Interpreter/SDK/Output/libc.swift.tmp/a.out /home/modocache/GitHub/apple/swift/test/Interpreter/SDK/libc.swift /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-android-armv7/Interpreter/SDK/Output/libc.swift.tmp | FileCheck /home/modocache/GitHub/apple/swift/test/Interpreter/SDK/libc.swift
--
Exit Code: 1

Command Output (stderr):
--
/home/modocache/GitHub/apple/swift/test/Interpreter/SDK/libc.swift:18:22: error: use of unresolved identifier 'stdout'
fputs("Hello world", stdout)
                     ^~~~~~
SwiftGlibc.strtoul:1:13: note: did you mean 'strtoul'?
public func strtoul(_: UnsafePointer<Int8>!, _: UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>!, _: Int32) -> UInt
            ^
/home/modocache/GitHub/apple/swift/test/Interpreter/SDK/libc.swift:54:26: error: binary operator '==' cannot be applied to operands of type 'UInt32' and 'UInt16'
  assert(statbuf.st_mode == S_IFREG | S_IRUSR | S_IWUSR | S_IXUSR)
         ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/modocache/GitHub/apple/swift/test/Interpreter/SDK/libc.swift:54:26: note: overloads for '==' exist with these partially matching parameter lists: (UInt16, UInt16), (UInt32, UInt32)
  assert(statbuf.st_mode == S_IFREG | S_IRUSR | S_IWUSR | S_IXUSR)

stdout should be defined on Android, though. My guess is that it should be defined in stdlib/public/Platform/Platform.swift or it should be imported from Android's libc, Bionic.

Prerequisites:

  • An Ubuntu 15.10 development environment capable of building Swift from source.

  • A physical Android device.

Helpful skills:
Familiarity with Swift, ClangImporter, and the Android libc would all be helpful, but certainly not required. The most helpful skill here is probably patience as you compile and run the tests again and again. 🙂

Starting point:
Follow the instructions in docs/Android.md to build and run the test suite on a physical Android device. Confirm this test still fails.

@swift-ci
Copy link
Collaborator

swift-ci commented Sep 9, 2017

Comment by Anton Pogonets (JIRA)

Looks like it is because of this https://android.googlesource.com/platform/bionic/+/ndk-r14-release/libc/include/stdio.h#82

Android libc implementation have no stdout symbol (till api 23). Just define.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Platform: Android bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. good first issue Good for newcomers standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

1 participant