On 01/29/2013 11:29 AM, Simon Marlow wrote: > On 25/01/13 08:36, Nathan Hüsken wrote: >> Hey, >> >> When compiling the cross compiler for android, it fails because of >> undefined symbols to mkfifo, tcgetattr and tcsetattr. >> This seems to be because the android ndk defines them as inline. >> >> This patch wraps them (when compiling for android) in __mkfifo >> __tcgetattr and __tcsetattr. > > If you're just using straightforward wrappers, a better way to do it is > to declare the foreign import with 'capi' instead of 'ccall'. This > generates the wrapper for you. >
Appended is an updated patch. Regards, Nathan
>From 5dc47529bb1110227817325aa487c4f9b7f35774 Mon Sep 17 00:00:00 2001 From: Nathan <[email protected]> Date: Tue, 29 Jan 2013 23:25:38 +0100 Subject: [PATCH] Wrap mkfifo, tcsetattr and tcgetattr on android because they are inline and cause linker failer --- System/Posix/Internals.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/System/Posix/Internals.hs b/System/Posix/Internals.hs index 1633a3e..d5bc0c9 100644 --- a/System/Posix/Internals.hs +++ b/System/Posix/Internals.hs @@ -488,8 +488,13 @@ foreign import ccall unsafe "HsBase.h fork" foreign import ccall unsafe "HsBase.h link" c_link :: CString -> CString -> IO CInt +#ifndef linux_android_HOST_OS foreign import ccall unsafe "HsBase.h mkfifo" c_mkfifo :: CString -> CMode -> IO CInt +#else +foreign import capi unsafe "HsBase.h mkfifo" + c_mkfifo :: CString -> CMode -> IO CInt +#endif foreign import ccall unsafe "HsBase.h pipe" c_pipe :: Ptr CInt -> IO CInt @@ -503,11 +508,19 @@ foreign import capi unsafe "signal.h sigaddset" foreign import capi unsafe "signal.h sigprocmask" c_sigprocmask :: CInt -> Ptr CSigset -> Ptr CSigset -> IO CInt +#ifndef linux_android_HOST_OS foreign import ccall unsafe "HsBase.h tcgetattr" c_tcgetattr :: CInt -> Ptr CTermios -> IO CInt foreign import ccall unsafe "HsBase.h tcsetattr" c_tcsetattr :: CInt -> CInt -> Ptr CTermios -> IO CInt +#else +foreign import capi unsafe "HsBase.h tcgetattr" + c_tcgetattr :: CInt -> Ptr CTermios -> IO CInt + +foreign import capi unsafe "HsBase.h tcsetattr" + c_tcsetattr :: CInt -> CInt -> Ptr CTermios -> IO CInt +#endif foreign import capi unsafe "HsBase.h utime" c_utime :: CString -> Ptr CUtimbuf -> IO CInt -- 1.7.10.4
_______________________________________________ ghc-devs mailing list [email protected] http://www.haskell.org/mailman/listinfo/ghc-devs
