[GSoC 2017] Porting Swift to Haiku - Final Report | Haiku Project

Hello everyone!

This blog-post marks the final report on bringing Swift to Haiku in the Google Summer of Code period. My introductory post on this project can be found here for a brief overview of the project.


This is a companion discussion topic for the original entry at https://www.haiku-os.org/blog/return0e/2017-08-28_gsoc_2017_porting_swift_to_haiku_-_final_report/
1 Like

Then now we can start to compile something like this ? :smiley: https://github.com/aslanyanhaik/youtube-iOS or it is hard?

Only the programming language was ported, not the whole libraries from iOS.
So for now it will be restricted to comand-line apps. Maybe latter on graphics apps, but using Haiku’s native widgets.

I don’t even know if the GUI toolkit from iOS has an open source implementation?

You wouldn’t be able to compile applications/libraries made specifically for Apple platforms using open-source Swift. They use libraries such as Cocoa, UIKit, etc which are only available on Apple platforms.

@PulkoMandy I think cocotron aims to be the open-source reimplementation of the Cocoa APIs. However it uses the Objective-C runtime, so that won’t be useful for the Swift port anyway.

Also, open-source Swift has no way of directly calling C++ code, so you can’t use the Haiku APIs without some sort of C interface to them, like libcharlemagne or Habid.

Although these libraries are very outdated, the former did have a working demo of calling the Haiku API from C and then to Lua.

1 Like

Update: the swift 3.1 recipe is now merged: https://github.com/haikuports/haikuports/commit/110f53039399ac3f06a3bcf0e5dd179445e68835

2 Likes

There is an open source implementation of UIKit and other iOS libraries, based on SDL and Cairo.


4 Likes

How to begin write app for Haiku on Swift

I dont think you can. NSFoundation etc isnt ported, I dont think you can use LibDispatch either (for threading (GCD)). If it get mature it would be nice to have a HaikuUIKit, etc so we can write apps in Swift instead of C++.

How to port Swift to Haiku, I mean could I help for porting swift Foundation to Haiku, or it’s so hard ?

Try build from port :slight_smile:
Change llvm6_clang to llvm7_clang doesn’t help :frowning:

32

@iQQator The issue in regards to porting Foundation is the hard requirement of Libdispatch (Which needs low-level APIs such as epoll and kqueue.) I’m planning to implement a workaround for this using Haiku’s wait_for_objects() equivalent, but haven’t found enough time to do this.

I have still kept the Swift port updated over at swift-haiku-build which I use to build and test the port. As for the build error, you might need to wait for this patch to land in HaikuPorts first.

Beat this with wait_for_objects, Return’ Github Epoll and we all can get cool things.
(Haha!, repo forking attack! :stuck_out_tongue: )

1 Like

I also try build from Git repo, with script :wink:

I think issue is build system in the Haiku, for example pkgman not contain sqlite3_devel :slight_smile:
What llvm I need install ?

  • llvm (this is 5 in Haiku pkgman) or llvm7 ?

What’s packages do I need install on Haiku for build can be complete ))
In the internet I read float128 is problem of gcc, gcc 6.9 should be fix this issue… but in Haiku I can’t find newer gcc :slight_smile:

You can install sqlite_devel instead.

My patch when merged will allow you to build using at least llvm6-6.0.1-4 or llvm7-7.0.0-2. However those versions won’t be available yet until this pull request is merged.

Actually the proper, generic way to do this is “pkgman install devel:libsqlite3”. Then it will find the package providing development files for libsqlite3, no matter how it’s named.

4 Likes

@iQQator The LLVM versions (6.0.1 and 7.0.0) should be now updated to include the __float128 fixes, so you should be able to build Swift again using llvm6_clang-6.0.1-4 or llvm7_clang-7.0.0-2.

x86_64 only. The builder for x86 is “lost”.

Is swift on HaikuDepot?

Build testing phase

1 Like