libswift frontend ios


(Ramakrishna Mallireddy) #1

HI,

How can I compile the swift front-end for iOS.
the build-script mentioned only Swift Standard Library for iOS.

I have read the build-script-impl, it does have the iOS build flags, but
are they only for building the standard library or am I missing something.

Thanks


(Joe Groff) #2

That's right, the build script only builds the runtime libraries for iOS, not the compiler itself. We don't build or test the compiler on iOS since that's not normally useful for Xcode development.

-Joe

···

On Feb 22, 2016, at 4:29 AM, Ramakrishna Mallireddy via swift-users <swift-users@swift.org> wrote:

HI,

How can I compile the swift front-end for iOS.
the build-script mentioned only Swift Standard Library for iOS.

I have read the build-script-impl, it does have the iOS build flags, but are they only for building the standard library or am I missing something.


(Ramakrishna Mallireddy) #3

Hi Joe,

I am not looking to build the llvm back-end, I am only looking to build
front-ends to generate llvm IR on iOS.

have build the swift-llvm & swift-clang static libraries for iOS using
cmake,
now I am looking to build the swift front-end for iOS, do you have any
instructions that makes my job easier going forward.

Thanks
Ramakrishna

···

On Mon, Feb 22, 2016 at 11:20 PM, Joe Groff <jgroff@apple.com> wrote:

On Feb 22, 2016, at 4:29 AM, Ramakrishna Mallireddy via swift-users < > swift-users@swift.org> wrote:

HI,

How can I compile the swift front-end for iOS.
the build-script mentioned only Swift Standard Library for iOS.

I have read the build-script-impl, it does have the iOS build flags, but
are they only for building the standard library or am I missing something.

That's right, the build script only builds the runtime libraries for iOS,
not the compiler itself. We don't build or test the compiler on iOS since
that's not normally useful for Xcode development.

-Joe


(Joe Groff) #4

Hi Joe,

I am not looking to build the llvm back-end, I am only looking to build front-ends to generate llvm IR on iOS.

have build the swift-llvm & swift-clang static libraries for iOS using cmake,
now I am looking to build the swift front-end for iOS, do you have any instructions that makes my job easier going forward.

We don't build any of the compiler for iOS, either the backend or frontend. I'd start by adding targets to the build system for the compiler's libraries (libswiftAST, libswiftSema, etc.) targeting iOS and seeing what breaks.

-Joe

···

On Feb 22, 2016, at 5:49 PM, Ramakrishna Mallireddy <ramakrishna.malli@gmail.com> wrote:

Thanks
Ramakrishna

On Mon, Feb 22, 2016 at 11:20 PM, Joe Groff <jgroff@apple.com <mailto:jgroff@apple.com>> wrote:
On Feb 22, 2016, at 4:29 AM, Ramakrishna Mallireddy via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

HI,

How can I compile the swift front-end for iOS.
the build-script mentioned only Swift Standard Library for iOS.

I have read the build-script-impl, it does have the iOS build flags, but are they only for building the standard library or am I missing something.

That's right, the build script only builds the runtime libraries for iOS, not the compiler itself. We don't build or test the compiler on iOS since that's not normally useful for Xcode development.

-Joe


(Ramakrishna Mallireddy) #5

While trying to build for iOS, I am stuck here...I am using the
build-script to compile, iOS simulator builds are done and for arm all libs
are generate except libSwiftIRGen.a, libSwiftSILOptimizer &
libSwiftImmediate.a

*swift/swift/lib/Immediate/REPL.cpp:39:10: **fatal error: **'histedit.h'
file not found*

#include <histedit.h>

this file is not there for iOS, how to get around this.

···

On Tue, Feb 23, 2016 at 7:23 AM, Joe Groff <jgroff@apple.com> wrote:

On Feb 22, 2016, at 5:49 PM, Ramakrishna Mallireddy < > ramakrishna.malli@gmail.com> wrote:

Hi Joe,

I am not looking to build the llvm back-end, I am only looking to build
front-ends to generate llvm IR on iOS.

have build the swift-llvm & swift-clang static libraries for iOS using
cmake,
now I am looking to build the swift front-end for iOS, do you have any
instructions that makes my job easier going forward.

We don't build any of the compiler for iOS, either the backend or
frontend. I'd start by adding targets to the build system for the
compiler's libraries (libswiftAST, libswiftSema, etc.) targeting iOS and
seeing what breaks.

-Joe

Thanks
Ramakrishna

On Mon, Feb 22, 2016 at 11:20 PM, Joe Groff <jgroff@apple.com> wrote:

On Feb 22, 2016, at 4:29 AM, Ramakrishna Mallireddy via swift-users < >> swift-users@swift.org> wrote:

HI,

How can I compile the swift front-end for iOS.
the build-script mentioned only Swift Standard Library for iOS.

I have read the build-script-impl, it does have the iOS build flags, but
are they only for building the standard library or am I missing something.

That's right, the build script only builds the runtime libraries for iOS,
not the compiler itself. We don't build or test the compiler on iOS since
that's not normally useful for Xcode development.

-Joe


(Joe Groff) #6

libedit probably isn't available on iOS, but it's only used by the compiler-debugging REPL. You can refine the #if here to exclude it from iOS builds:

#if defined(__APPLE__) || defined(__FreeBSD__)
// FIXME: Support REPL on non-Apple platforms. Ubuntu 14.10's editline does not
// include the wide character entry points needed by the REPL yet.
#include <histedit.h>
#endif // __APPLE__

Instead of defined(__APPLE__), defined(__MACOSX__) is probably more appropriate.

-Joe

···

On Feb 23, 2016, at 12:06 PM, Ramakrishna Mallireddy <ramakrishna.malli@gmail.com> wrote:

While trying to build for iOS, I am stuck here...I am using the build-script to compile, iOS simulator builds are done and for arm all libs are generate except libSwiftIRGen.a, libSwiftSILOptimizer & libSwiftImmediate.a

swift/swift/lib/Immediate/REPL.cpp:39:10: fatal error: 'histedit.h' file not found

#include <histedit.h>

this file is not there for iOS, how to get around this.


(Ramakrishna Mallireddy) #7

I am using the build-script that comes with swift repository. If i remove
Immediate dir completely from the build, mac_os build complains[as this
will always invoke]. If I redefine the #if then I am getting a dozen errors
that are part of histedit.h

How can I tell ninja, that not to worry about this change[i will completely
remove Immediate dir] and go straight to build the arm build.

···

On Wed, Feb 24, 2016 at 1:39 AM, Joe Groff <jgroff@apple.com> wrote:

On Feb 23, 2016, at 12:06 PM, Ramakrishna Mallireddy < > ramakrishna.malli@gmail.com> wrote:

While trying to build for iOS, I am stuck here...I am using the
build-script to compile, iOS simulator builds are done and for arm all libs
are generate except libSwiftIRGen.a, libSwiftSILOptimizer &
libSwiftImmediate.a

*swift/swift/lib/Immediate/REPL.cpp:39:10: **fatal error: **'histedit.h'
file not found*

#include <histedit.h>

this file is not there for iOS, how to get around this.

libedit probably isn't available on iOS, but it's only used by the
compiler-debugging REPL. You can refine the #if here to exclude it from iOS
builds:

#if defined(__APPLE__) || defined(__FreeBSD__)
// FIXME: Support REPL on non-Apple platforms. Ubuntu 14.10's editline
does not
// include the wide character entry points needed by the REPL yet.
#include <histedit.h>
#endif // __APPLE__

Instead of defined(__APPLE__), defined(__MACOSX__) is probably more
appropriate.

-Joe


(Joe Groff) #8

You will need to update the other #if __APPLE__ conditions in the file to match too.

-Joe

···

On Feb 23, 2016, at 12:22 PM, Ramakrishna Mallireddy <ramakrishna.malli@gmail.com> wrote:

I am using the build-script that comes with swift repository. If i remove Immediate dir completely from the build, mac_os build complains[as this will always invoke]. If I redefine the #if then I am getting a dozen errors that are part of histedit.h


(Ramakrishna Mallireddy) #9

__MACOSX__ is not defined, where can I defined this, so that it only
effects mac build.

···

On Wed, Feb 24, 2016 at 1:57 AM, Joe Groff <jgroff@apple.com> wrote:

> On Feb 23, 2016, at 12:22 PM, Ramakrishna Mallireddy < > ramakrishna.malli@gmail.com> wrote:
>
> I am using the build-script that comes with swift repository. If i
remove Immediate dir completely from the build, mac_os build complains[as
this will always invoke]. If I redefine the #if then I am getting a dozen
errors that are part of histedit.h

You will need to update the other #if __APPLE__ conditions in the file to
match too.

-Joe


(Joe Groff) #10

Sorry, it looks like the magic combination is

#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif

#if (TARGET_OS_MAC && !TARGET_OS_IPHONE) || defined(__FreeBSD__)
...do REPL stuff...
#endif

-Joe

···

On Feb 23, 2016, at 12:42 PM, Ramakrishna Mallireddy <ramakrishna.malli@gmail.com> wrote:

__MACOSX__ is not defined, where can I defined this, so that it only effects mac build.

On Wed, Feb 24, 2016 at 1:57 AM, Joe Groff <jgroff@apple.com <mailto:jgroff@apple.com>> wrote:

> On Feb 23, 2016, at 12:22 PM, Ramakrishna Mallireddy <ramakrishna.malli@gmail.com <mailto:ramakrishna.malli@gmail.com>> wrote:
>
> I am using the build-script that comes with swift repository. If i remove Immediate dir completely from the build, mac_os build complains[as this will always invoke]. If I redefine the #if then I am getting a dozen errors that are part of histedit.h

You will need to update the other #if __APPLE__ conditions in the file to match too.

-Joe


(Ramakrishna Mallireddy) #11

Thanks Joe, The build is complete.

···

On Wed, Feb 24, 2016 at 2:33 AM, Joe Groff <jgroff@apple.com> wrote:

Sorry, it looks like the magic combination is

#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif

#if (TARGET_OS_MAC && !TARGET_OS_IPHONE) || defined(__FreeBSD__)
...do REPL stuff...
#endif

-Joe

On Feb 23, 2016, at 12:42 PM, Ramakrishna Mallireddy < > ramakrishna.malli@gmail.com> wrote:

__MACOSX__ is not defined, where can I defined this, so that it only
effects mac build.

On Wed, Feb 24, 2016 at 1:57 AM, Joe Groff <jgroff@apple.com> wrote:

> On Feb 23, 2016, at 12:22 PM, Ramakrishna Mallireddy < >> ramakrishna.malli@gmail.com> wrote:
>
> I am using the build-script that comes with swift repository. If i
remove Immediate dir completely from the build, mac_os build complains[as
this will always invoke]. If I redefine the #if then I am getting a dozen
errors that are part of histedit.h

You will need to update the other #if __APPLE__ conditions in the file to
match too.

-Joe


(Ramakrishna Mallireddy) #12

Hi,

I have build clang, llvm , swift for iOS and added these libraries to a
sample single-view project and the app crash's before it reach appdelegate.

Not able to see what going wrong. could anyone help me to move forward. I
don't know where this *libLLVMContainer *came from*.*

* thread #1: tid = 0x253e8, 0x07a3bddb
libsystem_pthread.dylib`_pthread_rwlock_check_init + 11, queue =
'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
address=0x40000000)

  * frame #0: 0x07a3bddb libsystem_pthread.dylib`_pthread_rwlock_check_init
+ 11

    frame #1: 0x07a3baf0 libsystem_pthread.dylib`_pthread_rwlock_lock + 25

    frame #2: 0x07a40fcc
libsystem_pthread.dylib`pthread_rwlock_wrlock$UNIX2003 + 23

    frame #3: 0x0d57ff13
libLLVMContainer.dylib`llvm::sys::RWMutexImpl::writer_acquire() + 19

    frame #4: 0x0d4dab12
libLLVMContainer.dylib`llvm::PassRegistry::addRegistrationListener(llvm::PassRegistrationListener*)
+ 34

    frame #5: 0x0d4d667e
libLLVMContainer.dylib`llvm::PassNameParser::PassNameParser() + 78

    frame #6: 0x0d4cdad3
libLLVMContainer.dylib`_GLOBAL__sub_I_LegacyPassManager.cpp + 1299

    frame #7: 0x0187e20f

    frame #8: 0x0187e368

    frame #9: 0x01879a01

    frame #10: 0x01879994

    frame #11: 0x01879994

    frame #12: 0x01879994

    frame #13: 0x01879994

    frame #14: 0x01879994

    frame #15: 0x01879994

    frame #16: 0x01879994

    frame #17: 0x01879994

    frame #18: 0x01878d54

    frame #19: 0x01878de3

    frame #20: 0x0186ec50

    frame #21: 0x018722c7

    frame #22: 0x0186e1f9

    frame #23: 0x8fe97118 dyld`dyld::useSimulatorDyld(int, macho_header
const*, char const*, int, char const**, char const**, char const**,
unsigned long*) + 1053

    frame #24: 0x8fe961f2 dyld`dyld::_main(macho_header const*, unsigned
long, int, char const**, char const**, char const**, unsigned long*) + 202

    frame #25: 0x8fe92232 dyld`dyldbootstrap::start(macho_header const*,
int, char const**, long, macho_header const*, unsigned long*) + 428

    frame #26: 0x8fe92047 dyld`_dyld_start + 71

Thanks

Ramakrishna

···

On Wed, Feb 24, 2016 at 3:16 AM, Ramakrishna Mallireddy < ramakrishna.malli@gmail.com> wrote:

Thanks Joe, The build is complete.

On Wed, Feb 24, 2016 at 2:33 AM, Joe Groff <jgroff@apple.com> wrote:

Sorry, it looks like the magic combination is

#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif

#if (TARGET_OS_MAC && !TARGET_OS_IPHONE) || defined(__FreeBSD__)
...do REPL stuff...
#endif

-Joe

On Feb 23, 2016, at 12:42 PM, Ramakrishna Mallireddy < >> ramakrishna.malli@gmail.com> wrote:

__MACOSX__ is not defined, where can I defined this, so that it only
effects mac build.

On Wed, Feb 24, 2016 at 1:57 AM, Joe Groff <jgroff@apple.com> wrote:

> On Feb 23, 2016, at 12:22 PM, Ramakrishna Mallireddy < >>> ramakrishna.malli@gmail.com> wrote:
>
> I am using the build-script that comes with swift repository. If i
remove Immediate dir completely from the build, mac_os build complains[as
this will always invoke]. If I redefine the #if then I am getting a dozen
errors that are part of histedit.h

You will need to update the other #if __APPLE__ conditions in the file
to match too.

-Joe


(Joe Groff) #13

Hi,

I have build clang, llvm , swift for iOS and added these libraries to a sample single-view project and the app crash's before it reach appdelegate.

Not able to see what going wrong. could anyone help me to move forward. I don't know where this libLLVMContainer came from.

No idea, sorry. You might have better luck asking the LLVM mailing lists, since the crash here is inside LLVM's pass manager.

-Joe

···

On Mar 11, 2016, at 11:21 AM, Ramakrishna Mallireddy <ramakrishna.malli@gmail.com> wrote:
* thread #1: tid = 0x253e8, 0x07a3bddb libsystem_pthread.dylib`_pthread_rwlock_check_init + 11, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x40000000)

  * frame #0: 0x07a3bddb libsystem_pthread.dylib`_pthread_rwlock_check_init + 11

    frame #1: 0x07a3baf0 libsystem_pthread.dylib`_pthread_rwlock_lock + 25

    frame #2: 0x07a40fcc libsystem_pthread.dylib`pthread_rwlock_wrlock$UNIX2003 + 23

    frame #3: 0x0d57ff13 libLLVMContainer.dylib`llvm::sys::RWMutexImpl::writer_acquire() + 19

    frame #4: 0x0d4dab12 libLLVMContainer.dylib`llvm::PassRegistry::addRegistrationListener(llvm::PassRegistrationListener*) + 34

    frame #5: 0x0d4d667e libLLVMContainer.dylib`llvm::PassNameParser::PassNameParser() + 78

    frame #6: 0x0d4cdad3 libLLVMContainer.dylib`_GLOBAL__sub_I_LegacyPassManager.cpp + 1299

    frame #7: 0x0187e20f

    frame #8: 0x0187e368

    frame #9: 0x01879a01

    frame #10: 0x01879994

    frame #11: 0x01879994

    frame #12: 0x01879994

    frame #13: 0x01879994

    frame #14: 0x01879994

    frame #15: 0x01879994

    frame #16: 0x01879994

    frame #17: 0x01879994

    frame #18: 0x01878d54

    frame #19: 0x01878de3

    frame #20: 0x0186ec50

    frame #21: 0x018722c7

    frame #22: 0x0186e1f9

    frame #23: 0x8fe97118 dyld`dyld::useSimulatorDyld(int, macho_header const*, char const*, int, char const**, char const**, char const**, unsigned long*) + 1053

    frame #24: 0x8fe961f2 dyld`dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 202

    frame #25: 0x8fe92232 dyld`dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*, unsigned long*) + 428

    frame #26: 0x8fe92047 dyld`_dyld_start + 71

Thanks

Ramakrishna

On Wed, Feb 24, 2016 at 3:16 AM, Ramakrishna Mallireddy <ramakrishna.malli@gmail.com <mailto:ramakrishna.malli@gmail.com>> wrote:
Thanks Joe, The build is complete.

On Wed, Feb 24, 2016 at 2:33 AM, Joe Groff <jgroff@apple.com <mailto:jgroff@apple.com>> wrote:
Sorry, it looks like the magic combination is

#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif

#if (TARGET_OS_MAC && !TARGET_OS_IPHONE) || defined(__FreeBSD__)
...do REPL stuff...
#endif

-Joe

On Feb 23, 2016, at 12:42 PM, Ramakrishna Mallireddy <ramakrishna.malli@gmail.com <mailto:ramakrishna.malli@gmail.com>> wrote:

__MACOSX__ is not defined, where can I defined this, so that it only effects mac build.

On Wed, Feb 24, 2016 at 1:57 AM, Joe Groff <jgroff@apple.com <mailto:jgroff@apple.com>> wrote:

> On Feb 23, 2016, at 12:22 PM, Ramakrishna Mallireddy <ramakrishna.malli@gmail.com <mailto:ramakrishna.malli@gmail.com>> wrote:
>
> I am using the build-script that comes with swift repository. If i remove Immediate dir completely from the build, mac_os build complains[as this will always invoke]. If I redefine the #if then I am getting a dozen errors that are part of histedit.h

You will need to update the other #if __APPLE__ conditions in the file to match too.

-Joe


(Ramakrishna Mallireddy) #14

If I remove ClangImporter related code in swift front-end, I am able to
start the app. so just want to know what features I miss without
ClangImporter. I want to emit LLVM IR assembly for pure swift code. ObjC/C
is not something I want to deal with right now.

Inputs on any unexpected things I might face going forward without
ClangImporter in this regard will greatly helpful.

Thanks
Ramakrishna

···

On Sat, Mar 12, 2016 at 12:53 AM, Joe Groff <jgroff@apple.com> wrote:

On Mar 11, 2016, at 11:21 AM, Ramakrishna Mallireddy < > ramakrishna.malli@gmail.com> wrote:

Hi,

I have build clang, llvm , swift for iOS and added these libraries to a
sample single-view project and the app crash's before it reach appdelegate.

Not able to see what going wrong. could anyone help me to move forward. I
don't know where this *libLLVMContainer *came from*.*

No idea, sorry. You might have better luck asking the LLVM mailing lists,
since the crash here is inside LLVM's pass manager.

-Joe

* thread #1: tid = 0x253e8, 0x07a3bddb
libsystem_pthread.dylib`_pthread_rwlock_check_init + 11, queue =
'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
address=0x40000000)

  * frame #0: 0x07a3bddb
libsystem_pthread.dylib`_pthread_rwlock_check_init + 11

    frame #1: 0x07a3baf0 libsystem_pthread.dylib`_pthread_rwlock_lock + 25

    frame #2: 0x07a40fcc
libsystem_pthread.dylib`pthread_rwlock_wrlock$UNIX2003 + 23

    frame #3: 0x0d57ff13
libLLVMContainer.dylib`llvm::sys::RWMutexImpl::writer_acquire() + 19

    frame #4: 0x0d4dab12
libLLVMContainer.dylib`llvm::PassRegistry::addRegistrationListener(llvm::PassRegistrationListener*)
+ 34

    frame #5: 0x0d4d667e
libLLVMContainer.dylib`llvm::PassNameParser::PassNameParser() + 78

    frame #6: 0x0d4cdad3
libLLVMContainer.dylib`_GLOBAL__sub_I_LegacyPassManager.cpp + 1299

    frame #7: 0x0187e20f

    frame #8: 0x0187e368

    frame #9: 0x01879a01

    frame #10: 0x01879994

    frame #11: 0x01879994

    frame #12: 0x01879994

    frame #13: 0x01879994

    frame #14: 0x01879994

    frame #15: 0x01879994

    frame #16: 0x01879994

    frame #17: 0x01879994

    frame #18: 0x01878d54

    frame #19: 0x01878de3

    frame #20: 0x0186ec50

    frame #21: 0x018722c7

    frame #22: 0x0186e1f9

    frame #23: 0x8fe97118 dyld`dyld::useSimulatorDyld(int, macho_header
const*, char const*, int, char const**, char const**, char const**,
unsigned long*) + 1053

    frame #24: 0x8fe961f2 dyld`dyld::_main(macho_header const*, unsigned
long, int, char const**, char const**, char const**, unsigned long*) + 202

    frame #25: 0x8fe92232 dyld`dyldbootstrap::start(macho_header const*,
int, char const**, long, macho_header const*, unsigned long*) + 428

    frame #26: 0x8fe92047 dyld`_dyld_start + 71

Thanks

Ramakrishna

On Wed, Feb 24, 2016 at 3:16 AM, Ramakrishna Mallireddy < > ramakrishna.malli@gmail.com> wrote:

Thanks Joe, The build is complete.

On Wed, Feb 24, 2016 at 2:33 AM, Joe Groff <jgroff@apple.com> wrote:

Sorry, it looks like the magic combination is

#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif

#if (TARGET_OS_MAC && !TARGET_OS_IPHONE) || defined(__FreeBSD__)
...do REPL stuff...
#endif

-Joe

On Feb 23, 2016, at 12:42 PM, Ramakrishna Mallireddy < >>> ramakrishna.malli@gmail.com> wrote:

__MACOSX__ is not defined, where can I defined this, so that it only
effects mac build.

On Wed, Feb 24, 2016 at 1:57 AM, Joe Groff <jgroff@apple.com> wrote:

> On Feb 23, 2016, at 12:22 PM, Ramakrishna Mallireddy < >>>> ramakrishna.malli@gmail.com> wrote:
>
> I am using the build-script that comes with swift repository. If i
remove Immediate dir completely from the build, mac_os build complains[as
this will always invoke]. If I redefine the #if then I am getting a dozen
errors that are part of histedit.h

You will need to update the other #if __APPLE__ conditions in the file
to match too.

-Joe


(Ramakrishna Mallireddy) #15

Initially I got missing module "Swift" then I provided the missing module
and now I am getting error: missing module "SwiftShims".

I have searched the entire swift build generated lib folder and have not
found this module except the shims folder.

How do I locate this module, In OSX also I got the same error flow [by
deleting the entire lib/swift folder to generate this error/issue] and when
I provided the respective swift module & shims directory under
lib/swift/shims I was able to past this error message but the same doesn't
helping for iOS.

Thanks
Ramakrishna

···

On Sat, Mar 12, 2016 at 6:43 PM, Ramakrishna Mallireddy < ramakrishna.malli@gmail.com> wrote:

If I remove ClangImporter related code in swift front-end, I am able to
start the app. so just want to know what features I miss without
ClangImporter. I want to emit LLVM IR assembly for pure swift code. ObjC/C
is not something I want to deal with right now.

Inputs on any unexpected things I might face going forward without
ClangImporter in this regard will greatly helpful.

Thanks
Ramakrishna

On Sat, Mar 12, 2016 at 12:53 AM, Joe Groff <jgroff@apple.com> wrote:

On Mar 11, 2016, at 11:21 AM, Ramakrishna Mallireddy < >> ramakrishna.malli@gmail.com> wrote:

Hi,

I have build clang, llvm , swift for iOS and added these libraries to a
sample single-view project and the app crash's before it reach appdelegate.

Not able to see what going wrong. could anyone help me to move forward. I
don't know where this *libLLVMContainer *came from*.*

No idea, sorry. You might have better luck asking the LLVM mailing lists,
since the crash here is inside LLVM's pass manager.

-Joe

* thread #1: tid = 0x253e8, 0x07a3bddb
libsystem_pthread.dylib`_pthread_rwlock_check_init + 11, queue =
'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
address=0x40000000)

  * frame #0: 0x07a3bddb
libsystem_pthread.dylib`_pthread_rwlock_check_init + 11

    frame #1: 0x07a3baf0 libsystem_pthread.dylib`_pthread_rwlock_lock + 25

    frame #2: 0x07a40fcc
libsystem_pthread.dylib`pthread_rwlock_wrlock$UNIX2003 + 23

    frame #3: 0x0d57ff13
libLLVMContainer.dylib`llvm::sys::RWMutexImpl::writer_acquire() + 19

    frame #4: 0x0d4dab12
libLLVMContainer.dylib`llvm::PassRegistry::addRegistrationListener(llvm::PassRegistrationListener*)
+ 34

    frame #5: 0x0d4d667e
libLLVMContainer.dylib`llvm::PassNameParser::PassNameParser() + 78

    frame #6: 0x0d4cdad3
libLLVMContainer.dylib`_GLOBAL__sub_I_LegacyPassManager.cpp + 1299

    frame #7: 0x0187e20f

    frame #8: 0x0187e368

    frame #9: 0x01879a01

    frame #10: 0x01879994

    frame #11: 0x01879994

    frame #12: 0x01879994

    frame #13: 0x01879994

    frame #14: 0x01879994

    frame #15: 0x01879994

    frame #16: 0x01879994

    frame #17: 0x01879994

    frame #18: 0x01878d54

    frame #19: 0x01878de3

    frame #20: 0x0186ec50

    frame #21: 0x018722c7

    frame #22: 0x0186e1f9

    frame #23: 0x8fe97118 dyld`dyld::useSimulatorDyld(int, macho_header
const*, char const*, int, char const**, char const**, char const**,
unsigned long*) + 1053

    frame #24: 0x8fe961f2 dyld`dyld::_main(macho_header const*, unsigned
long, int, char const**, char const**, char const**, unsigned long*) + 202

    frame #25: 0x8fe92232 dyld`dyldbootstrap::start(macho_header const*,
int, char const**, long, macho_header const*, unsigned long*) + 428

    frame #26: 0x8fe92047 dyld`_dyld_start + 71

Thanks

Ramakrishna

On Wed, Feb 24, 2016 at 3:16 AM, Ramakrishna Mallireddy < >> ramakrishna.malli@gmail.com> wrote:

Thanks Joe, The build is complete.

On Wed, Feb 24, 2016 at 2:33 AM, Joe Groff <jgroff@apple.com> wrote:

Sorry, it looks like the magic combination is

#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif

#if (TARGET_OS_MAC && !TARGET_OS_IPHONE) || defined(__FreeBSD__)
...do REPL stuff...
#endif

-Joe

On Feb 23, 2016, at 12:42 PM, Ramakrishna Mallireddy < >>>> ramakrishna.malli@gmail.com> wrote:

__MACOSX__ is not defined, where can I defined this, so that it only
effects mac build.

On Wed, Feb 24, 2016 at 1:57 AM, Joe Groff <jgroff@apple.com> wrote:

> On Feb 23, 2016, at 12:22 PM, Ramakrishna Mallireddy < >>>>> ramakrishna.malli@gmail.com> wrote:
>
> I am using the build-script that comes with swift repository. If i
remove Immediate dir completely from the build, mac_os build complains[as
this will always invoke]. If I redefine the #if then I am getting a dozen
errors that are part of histedit.h

You will need to update the other #if __APPLE__ conditions in the file
to match too.

-Joe


(Joe Groff) #16

SwiftShims is a C module used by the standard library to interface with OS C code, corresponding to the headers in stdlib/public/SwiftShims. Since you've built without the Clang importer, it will be unavailable.

-Joe

···

On Mar 14, 2016, at 4:45 AM, Ramakrishna Mallireddy <ramakrishna.malli@gmail.com> wrote:

Initially I got missing module "Swift" then I provided the missing module and now I am getting error: missing module "SwiftShims".

I have searched the entire swift build generated lib folder and have not found this module except the shims folder.

How do I locate this module, In OSX also I got the same error flow [by deleting the entire lib/swift folder to generate this error/issue] and when I provided the respective swift module & shims directory under lib/swift/shims I was able to past this error message but the same doesn't helping for iOS.


(Jordan Rose) #17

The Clang importer is used both for SwiftShims and for code generation; you can't just chop it out. You may be able to get away with explicitly passing an empty SDKPath, though; that keeps it from trying to look up things in /.

Just to be sure, you know you won't be able to execute the LLVM IR you emit, right? iOS doesn't support JIT-compiled code (other than the JavaScript JIT).

Jordan

···

On Mar 14, 2016, at 4:45 , Ramakrishna Mallireddy via swift-users <swift-users@swift.org> wrote:

Initially I got missing module "Swift" then I provided the missing module and now I am getting error: missing module "SwiftShims".

I have searched the entire swift build generated lib folder and have not found this module except the shims folder.

How do I locate this module, In OSX also I got the same error flow [by deleting the entire lib/swift folder to generate this error/issue] and when I provided the respective swift module & shims directory under lib/swift/shims I was able to past this error message but the same doesn't helping for iOS.

Thanks
Ramakrishna

On Sat, Mar 12, 2016 at 6:43 PM, Ramakrishna Mallireddy <ramakrishna.malli@gmail.com <mailto:ramakrishna.malli@gmail.com>> wrote:
If I remove ClangImporter related code in swift front-end, I am able to start the app. so just want to know what features I miss without ClangImporter. I want to emit LLVM IR assembly for pure swift code. ObjC/C is not something I want to deal with right now.

Inputs on any unexpected things I might face going forward without ClangImporter in this regard will greatly helpful.

Thanks
Ramakrishna

On Sat, Mar 12, 2016 at 12:53 AM, Joe Groff <jgroff@apple.com <mailto:jgroff@apple.com>> wrote:

On Mar 11, 2016, at 11:21 AM, Ramakrishna Mallireddy <ramakrishna.malli@gmail.com <mailto:ramakrishna.malli@gmail.com>> wrote:

Hi,

I have build clang, llvm , swift for iOS and added these libraries to a sample single-view project and the app crash's before it reach appdelegate.

Not able to see what going wrong. could anyone help me to move forward. I don't know where this libLLVMContainer came from.

No idea, sorry. You might have better luck asking the LLVM mailing lists, since the crash here is inside LLVM's pass manager.

-Joe

* thread #1: tid = 0x253e8, 0x07a3bddb libsystem_pthread.dylib`_pthread_rwlock_check_init + 11, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x40000000)

  * frame #0: 0x07a3bddb libsystem_pthread.dylib`_pthread_rwlock_check_init + 11

    frame #1: 0x07a3baf0 libsystem_pthread.dylib`_pthread_rwlock_lock + 25

    frame #2: 0x07a40fcc libsystem_pthread.dylib`pthread_rwlock_wrlock$UNIX2003 + 23

    frame #3: 0x0d57ff13 libLLVMContainer.dylib`llvm::sys::RWMutexImpl::writer_acquire() + 19

    frame #4: 0x0d4dab12 libLLVMContainer.dylib`llvm::PassRegistry::addRegistrationListener(llvm::PassRegistrationListener*) + 34

    frame #5: 0x0d4d667e libLLVMContainer.dylib`llvm::PassNameParser::PassNameParser() + 78

    frame #6: 0x0d4cdad3 libLLVMContainer.dylib`_GLOBAL__sub_I_LegacyPassManager.cpp + 1299

    frame #7: 0x0187e20f

    frame #8: 0x0187e368

    frame #9: 0x01879a01

    frame #10: 0x01879994

    frame #11: 0x01879994

    frame #12: 0x01879994

    frame #13: 0x01879994

    frame #14: 0x01879994

    frame #15: 0x01879994

    frame #16: 0x01879994

    frame #17: 0x01879994

    frame #18: 0x01878d54

    frame #19: 0x01878de3

    frame #20: 0x0186ec50

    frame #21: 0x018722c7

    frame #22: 0x0186e1f9

    frame #23: 0x8fe97118 dyld`dyld::useSimulatorDyld(int, macho_header const*, char const*, int, char const**, char const**, char const**, unsigned long*) + 1053

    frame #24: 0x8fe961f2 dyld`dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 202

    frame #25: 0x8fe92232 dyld`dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*, unsigned long*) + 428

    frame #26: 0x8fe92047 dyld`_dyld_start + 71

Thanks

Ramakrishna

On Wed, Feb 24, 2016 at 3:16 AM, Ramakrishna Mallireddy <ramakrishna.malli@gmail.com <mailto:ramakrishna.malli@gmail.com>> wrote:
Thanks Joe, The build is complete.

On Wed, Feb 24, 2016 at 2:33 AM, Joe Groff <jgroff@apple.com <mailto:jgroff@apple.com>> wrote:
Sorry, it looks like the magic combination is

#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif

#if (TARGET_OS_MAC && !TARGET_OS_IPHONE) || defined(__FreeBSD__)
...do REPL stuff...
#endif

-Joe

On Feb 23, 2016, at 12:42 PM, Ramakrishna Mallireddy <ramakrishna.malli@gmail.com <mailto:ramakrishna.malli@gmail.com>> wrote:

__MACOSX__ is not defined, where can I defined this, so that it only effects mac build.

On Wed, Feb 24, 2016 at 1:57 AM, Joe Groff <jgroff@apple.com <mailto:jgroff@apple.com>> wrote:

> On Feb 23, 2016, at 12:22 PM, Ramakrishna Mallireddy <ramakrishna.malli@gmail.com <mailto:ramakrishna.malli@gmail.com>> wrote:
>
> I am using the build-script that comes with swift repository. If i remove Immediate dir completely from the build, mac_os build complains[as this will always invoke]. If I redefine the #if then I am getting a dozen errors that are part of histedit.h

You will need to update the other #if __APPLE__ conditions in the file to match too.

-Joe

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Ramakrishna Mallireddy) #18

Thanks for quick help on this, I am not looking for JIT-compiled, just want
to have an AST / LLVM IR from source that will be Translated to JS.

···

On Mon, Mar 14, 2016 at 10:14 PM, Jordan Rose <jordan_rose@apple.com> wrote:

The Clang importer is used both for SwiftShims and for code generation;
you can't just chop it out. You may be able to get away with explicitly
passing an empty SDKPath, though; that keeps it from trying to look up
things in /.

Just to be sure, you know you won't be able to *execute* the LLVM IR you
emit, right? iOS doesn't support JIT-compiled code (other than the
JavaScript JIT).

Jordan

On Mar 14, 2016, at 4:45 , Ramakrishna Mallireddy via swift-users < > swift-users@swift.org> wrote:

Initially I got missing module "Swift" then I provided the missing module
and now I am getting error: missing module "SwiftShims".

I have searched the entire swift build generated lib folder and have not
found this module except the shims folder.

How do I locate this module, In OSX also I got the same error flow [by
deleting the entire lib/swift folder to generate this error/issue] and when
I provided the respective swift module & shims directory under
lib/swift/shims I was able to past this error message but the same doesn't
helping for iOS.

Thanks
Ramakrishna

On Sat, Mar 12, 2016 at 6:43 PM, Ramakrishna Mallireddy < > ramakrishna.malli@gmail.com> wrote:

If I remove ClangImporter related code in swift front-end, I am able to
start the app. so just want to know what features I miss without
ClangImporter. I want to emit LLVM IR assembly for pure swift code. ObjC/C
is not something I want to deal with right now.

Inputs on any unexpected things I might face going forward without
ClangImporter in this regard will greatly helpful.

Thanks
Ramakrishna

On Sat, Mar 12, 2016 at 12:53 AM, Joe Groff <jgroff@apple.com> wrote:

On Mar 11, 2016, at 11:21 AM, Ramakrishna Mallireddy < >>> ramakrishna.malli@gmail.com> wrote:

Hi,

I have build clang, llvm , swift for iOS and added these libraries to a
sample single-view project and the app crash's before it reach appdelegate.

Not able to see what going wrong. could anyone help me to move forward.
I don't know where this *libLLVMContainer *came from*.*

No idea, sorry. You might have better luck asking the LLVM mailing
lists, since the crash here is inside LLVM's pass manager.

-Joe

* thread #1: tid = 0x253e8, 0x07a3bddb
libsystem_pthread.dylib`_pthread_rwlock_check_init + 11, queue =
'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
address=0x40000000)

  * frame #0: 0x07a3bddb
libsystem_pthread.dylib`_pthread_rwlock_check_init + 11

    frame #1: 0x07a3baf0 libsystem_pthread.dylib`_pthread_rwlock_lock +
25

    frame #2: 0x07a40fcc
libsystem_pthread.dylib`pthread_rwlock_wrlock$UNIX2003 + 23

    frame #3: 0x0d57ff13
libLLVMContainer.dylib`llvm::sys::RWMutexImpl::writer_acquire() + 19

    frame #4: 0x0d4dab12
libLLVMContainer.dylib`llvm::PassRegistry::addRegistrationListener(llvm::PassRegistrationListener*)
+ 34

    frame #5: 0x0d4d667e
libLLVMContainer.dylib`llvm::PassNameParser::PassNameParser() + 78

    frame #6: 0x0d4cdad3
libLLVMContainer.dylib`_GLOBAL__sub_I_LegacyPassManager.cpp + 1299

    frame #7: 0x0187e20f

    frame #8: 0x0187e368

    frame #9: 0x01879a01

    frame #10: 0x01879994

    frame #11: 0x01879994

    frame #12: 0x01879994

    frame #13: 0x01879994

    frame #14: 0x01879994

    frame #15: 0x01879994

    frame #16: 0x01879994

    frame #17: 0x01879994

    frame #18: 0x01878d54

    frame #19: 0x01878de3

    frame #20: 0x0186ec50

    frame #21: 0x018722c7

    frame #22: 0x0186e1f9

    frame #23: 0x8fe97118 dyld`dyld::useSimulatorDyld(int, macho_header
const*, char const*, int, char const**, char const**, char const**,
unsigned long*) + 1053

    frame #24: 0x8fe961f2 dyld`dyld::_main(macho_header const*, unsigned
long, int, char const**, char const**, char const**, unsigned long*) + 202

    frame #25: 0x8fe92232 dyld`dyldbootstrap::start(macho_header const*,
int, char const**, long, macho_header const*, unsigned long*) + 428

    frame #26: 0x8fe92047 dyld`_dyld_start + 71

Thanks

Ramakrishna

On Wed, Feb 24, 2016 at 3:16 AM, Ramakrishna Mallireddy < >>> ramakrishna.malli@gmail.com> wrote:

Thanks Joe, The build is complete.

On Wed, Feb 24, 2016 at 2:33 AM, Joe Groff <jgroff@apple.com> wrote:

Sorry, it looks like the magic combination is

#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif

#if (TARGET_OS_MAC && !TARGET_OS_IPHONE) || defined(__FreeBSD__)
...do REPL stuff...
#endif

-Joe

On Feb 23, 2016, at 12:42 PM, Ramakrishna Mallireddy < >>>>> ramakrishna.malli@gmail.com> wrote:

__MACOSX__ is not defined, where can I defined this, so that it only
effects mac build.

On Wed, Feb 24, 2016 at 1:57 AM, Joe Groff <jgroff@apple.com> wrote:

> On Feb 23, 2016, at 12:22 PM, Ramakrishna Mallireddy < >>>>>> ramakrishna.malli@gmail.com> wrote:
>
> I am using the build-script that comes with swift repository. If i
remove Immediate dir completely from the build, mac_os build complains[as
this will always invoke]. If I redefine the #if then I am getting a dozen
errors that are part of histedit.h

You will need to update the other #if __APPLE__ conditions in the
file to match too.

-Joe

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Ramakrishna Mallireddy) #19

The libLLVMContainer.dylib is actually from opengl.framework.
On iOS the lib may be loaded by opengles.framework and I am not using any
opengl myself, ios may be loading it by default.

I have compiled llvm core & support libs along with my llvmtest code, Even
then the conflict remains.
How to I get around this.

Thanks
Ramakrishna

···

On Tue, Mar 15, 2016 at 10:02 AM, Ramakrishna Mallireddy < ramakrishna.malli@gmail.com> wrote:

Thanks for quick help on this, I am not looking for JIT-compiled, just
want to have an AST / LLVM IR from source that will be Translated to JS.

On Mon, Mar 14, 2016 at 10:14 PM, Jordan Rose <jordan_rose@apple.com> > wrote:

The Clang importer is used both for SwiftShims and for code generation;
you can't just chop it out. You may be able to get away with explicitly
passing an empty SDKPath, though; that keeps it from trying to look up
things in /.

Just to be sure, you know you won't be able to *execute* the LLVM IR you
emit, right? iOS doesn't support JIT-compiled code (other than the
JavaScript JIT).

Jordan

On Mar 14, 2016, at 4:45 , Ramakrishna Mallireddy via swift-users < >> swift-users@swift.org> wrote:

Initially I got missing module "Swift" then I provided the missing module
and now I am getting error: missing module "SwiftShims".

I have searched the entire swift build generated lib folder and have not
found this module except the shims folder.

How do I locate this module, In OSX also I got the same error flow [by
deleting the entire lib/swift folder to generate this error/issue] and when
I provided the respective swift module & shims directory under
lib/swift/shims I was able to past this error message but the same doesn't
helping for iOS.

Thanks
Ramakrishna

On Sat, Mar 12, 2016 at 6:43 PM, Ramakrishna Mallireddy < >> ramakrishna.malli@gmail.com> wrote:

If I remove ClangImporter related code in swift front-end, I am able to
start the app. so just want to know what features I miss without
ClangImporter. I want to emit LLVM IR assembly for pure swift code. ObjC/C
is not something I want to deal with right now.

Inputs on any unexpected things I might face going forward without
ClangImporter in this regard will greatly helpful.

Thanks
Ramakrishna

On Sat, Mar 12, 2016 at 12:53 AM, Joe Groff <jgroff@apple.com> wrote:

On Mar 11, 2016, at 11:21 AM, Ramakrishna Mallireddy < >>>> ramakrishna.malli@gmail.com> wrote:

Hi,

I have build clang, llvm , swift for iOS and added these libraries to a
sample single-view project and the app crash's before it reach appdelegate.

Not able to see what going wrong. could anyone help me to move forward.
I don't know where this *libLLVMContainer *came from*.*

No idea, sorry. You might have better luck asking the LLVM mailing
lists, since the crash here is inside LLVM's pass manager.

-Joe

* thread #1: tid = 0x253e8, 0x07a3bddb
libsystem_pthread.dylib`_pthread_rwlock_check_init + 11, queue =
'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
address=0x40000000)

  * frame #0: 0x07a3bddb
libsystem_pthread.dylib`_pthread_rwlock_check_init + 11

    frame #1: 0x07a3baf0 libsystem_pthread.dylib`_pthread_rwlock_lock +
25

    frame #2: 0x07a40fcc
libsystem_pthread.dylib`pthread_rwlock_wrlock$UNIX2003 + 23

    frame #3: 0x0d57ff13
libLLVMContainer.dylib`llvm::sys::RWMutexImpl::writer_acquire() + 19

    frame #4: 0x0d4dab12
libLLVMContainer.dylib`llvm::PassRegistry::addRegistrationListener(llvm::PassRegistrationListener*)
+ 34

    frame #5: 0x0d4d667e
libLLVMContainer.dylib`llvm::PassNameParser::PassNameParser() + 78

    frame #6: 0x0d4cdad3
libLLVMContainer.dylib`_GLOBAL__sub_I_LegacyPassManager.cpp + 1299

    frame #7: 0x0187e20f

    frame #8: 0x0187e368

    frame #9: 0x01879a01

    frame #10: 0x01879994

    frame #11: 0x01879994

    frame #12: 0x01879994

    frame #13: 0x01879994

    frame #14: 0x01879994

    frame #15: 0x01879994

    frame #16: 0x01879994

    frame #17: 0x01879994

    frame #18: 0x01878d54

    frame #19: 0x01878de3

    frame #20: 0x0186ec50

    frame #21: 0x018722c7

    frame #22: 0x0186e1f9

    frame #23: 0x8fe97118 dyld`dyld::useSimulatorDyld(int, macho_header
const*, char const*, int, char const**, char const**, char const**,
unsigned long*) + 1053

    frame #24: 0x8fe961f2 dyld`dyld::_main(macho_header const*,
unsigned long, int, char const**, char const**, char const**, unsigned
long*) + 202

    frame #25: 0x8fe92232 dyld`dyldbootstrap::start(macho_header
const*, int, char const**, long, macho_header const*, unsigned long*) + 428

    frame #26: 0x8fe92047 dyld`_dyld_start + 71

Thanks

Ramakrishna

On Wed, Feb 24, 2016 at 3:16 AM, Ramakrishna Mallireddy < >>>> ramakrishna.malli@gmail.com> wrote:

Thanks Joe, The build is complete.

On Wed, Feb 24, 2016 at 2:33 AM, Joe Groff <jgroff@apple.com> wrote:

Sorry, it looks like the magic combination is

#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif

#if (TARGET_OS_MAC && !TARGET_OS_IPHONE) || defined(__FreeBSD__)
...do REPL stuff...
#endif

-Joe

On Feb 23, 2016, at 12:42 PM, Ramakrishna Mallireddy < >>>>>> ramakrishna.malli@gmail.com> wrote:

__MACOSX__ is not defined, where can I defined this, so that it only
effects mac build.

On Wed, Feb 24, 2016 at 1:57 AM, Joe Groff <jgroff@apple.com> wrote:

> On Feb 23, 2016, at 12:22 PM, Ramakrishna Mallireddy < >>>>>>> ramakrishna.malli@gmail.com> wrote:
>
> I am using the build-script that comes with swift repository. If i
remove Immediate dir completely from the build, mac_os build complains[as
this will always invoke]. If I redefine the #if then I am getting a dozen
errors that are part of histedit.h

You will need to update the other #if __APPLE__ conditions in the
file to match too.

-Joe

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Joe Groff) #20

You should statically link in any LLVM libraries you need, ensuring you link the versions built as part of your swiftc build. LLVM libraries are not ABI-stable, and any LLVM libraries that might happen to be distributed in the OS are not for use outside the OS.

-Joe

···

On Mar 17, 2016, at 2:22 PM, Ramakrishna Mallireddy <ramakrishna.malli@gmail.com> wrote:

The libLLVMContainer.dylib is actually from opengl.framework.
On iOS the lib may be loaded by opengles.framework and I am not using any opengl myself, ios may be loading it by default.

I have compiled llvm core & support libs along with my llvmtest code, Even then the conflict remains.
How to I get around this.