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

A version of Swift (3.1) is already on HaikuDepot but only for x86_64.

I’m currently testing 4.2 and will update the port when it is ready.

6 Likes

Is it has continue ?:slight_smile:

Снимок экрана 2021-01-05 в 18.23.15

No cmark found :frowning:

I have already have 4.2 ported and tested but that is too old and a lot has changed since then. Instead I’m focused on the latest version, but I’m quite busy with other things. Thus, I can only suggest ‘patches welcome’ unless I have more time to look at this.

3 Likes

Nice to hear it… When you have get a lot free time, tell me please how to build it or how I can help you to port something in future :slight_smile:

So… I tried to build swift-4.2.2-release from scratch with your scripts :slight_smile:
All good but:
Снимок экрана 2021-01-05 в 23.23.23

Could you help me when you can ?)

3 Likes

I found some strange behaviour:
Снимок экрана 2021-01-09 в 10.46.59

But my Haiku use clang-9 :sweat_smile:

Reinstall llvm_clang to 6.x didn’t help me :slight_smile: The main trouble contains in vasprintf / asprintf. I read other sources and found that trouble present on OpenBSD also, and depend on POSIX standard version.

Are you on hrev54818 or newer? If not you could try to update.

haiku_devel-r1~beta2_hrev54858-1-x86_64.hpkg today :slight_smile: It did not help :frowning:

No vasprintf in headers here, this path is linked when build app
Снимок экрана 2021-01-09 в 20.23.20

But, there is vasprintf is presented:
Снимок экрана 2021-01-09 в 20.26.29

Add the features to your ported implementation, if the features are not publically exposed by the OS. Don’t tap into the private OS headers…

But it is clearly there in /bsd/stdio.h which is not private.

Read /bsd/stdio.h, you will see it is guarded by ifdefs:

#if defined(_DEFAULT_SOURCE) || defined(_GNU_SOURCE)
... blabla ...

Pass / define _BSD_SOURCE.

1 Like

Of course I don’t change anything inside system…

@extrowerk: I found GNU_SOURCE everywhere there :slight_smile:
And while code build, stdio.h used from /boot/system/develop/headers/posix/stdio.h :)))

Снимок экрана 2021-01-09 в 23.10.25

Ok, I think it not available now to build GNU_SOURCEd apps which have vasfprintf functions inside.

korli also added _SC_TTY_NAME_MAX to the supported sysconf parameters, added tcgetsid, fixed the definition of in6_addr, improved strace output for termios ioctls, and relaxed some checks in handling of network ioctls to fix incompatibilities with old OpenJDK versions. He also fixed handling of O_APPEND, added aligned_alloc (as specified in C11), made fsync() return EINVAL on fifos, and moved asprintf and vasprintf to BSD extensions as they are not part of POSIX.

From one side it is right, and this BSD/GNU parts of code… but other side gnulib is not supported by Haiku :))

As extrowerk said, you just need to set the correct compile flag. That is add -D_DEFAULT_SOURCE to your compiler flags, and -lbsd to your linker flags. No need for gnulib or anything like that.

1 Like

Thank you so much :slight_smile:

-DCMAKE_C_FLAGS="-D_DEFAULT_SOURCE -fPIC"
-DCMAKE_CXX_FLAGS="-D_DEFAULT_SOURCE -fPIC" 
-DCMAKE_EXE_LINKER_FLAGS=-lbsd

Снимок экрана 2021-01-11 в 16.14.05

3 Likes