libpthread / isspace - PNACL include and library include directories on OSX

101 views
Skip to first unread message

Ed Baafi

unread,
Jan 29, 2016, 10:27:52 AM1/29/16
to Native-Client-Discuss
Hi All,

I'm porting a large library to native client that uses CMAKE for its build system.  I am able to successfully build a static library with nacl  but when I try to compile it with pnacl the different search paths are not set up properly.  For nacl I was using the i686-nacl-* tools in pepper_44/toolchain/mac_pnacl/bin/. For Pnacl I'm attempting to use the pnacl-* tools in pepper_44/toolchain/mac_pnacl/bin/

1) My first problem is "pnacl-ld: Cannot find '-lpthread'"  I mask that by pointing the linker to  pepper_44/toolchain/mac_pnacl/le32-nacl/lib
2) Then I get "use of undeclared identifier 'isspace'" but isspace should be defined in newlib

This is all very confusing because there are various directories within mac_pnacl that have non portable looking names like i686_bc-nacl, arm_bc-nacl, and arm-nacl.  For example my masked fix to #1 above seems to point to a native version of pthread and there doesn't seem to be a portable one.  There also do not seem to be any isspace in any portable looking directory.

Can someone shed some light on this?  Perhaps send me the include directories from a good PNACL -v build so I can at least understand what should be included?

Thanks,
Ed


Sam Clegg

unread,
Jan 29, 2016, 2:42:10 PM1/29/16
to native-cli...@googlegroups.com
On Fri, Jan 29, 2016 at 7:27 AM, Ed Baafi <e...@modk.it> wrote:
> Hi All,
>
> I'm porting a large library to native client that uses CMAKE for its build
> system. I am able to successfully build a static library with nacl but
> when I try to compile it with pnacl the different search paths are not set
> up properly. For nacl I was using the i686-nacl-* tools in
> pepper_44/toolchain/mac_pnacl/bin/. For Pnacl I'm attempting to use the
> pnacl-* tools in pepper_44/toolchain/mac_pnacl/bin/
>
> 1) My first problem is "pnacl-ld: Cannot find '-lpthread'" I mask that by
> pointing the linker to pepper_44/toolchain/mac_pnacl/le32-nacl/lib

This should work by default. How are you running the linker? If you
use the pnacl-clang driver it certainly works for me:
$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-clang -lpthread ~/test/hello.c

> 2) Then I get "use of undeclared identifier 'isspace'" but isspace should be
> defined in newlib

This is a known issue that can be fixed by passing -std=gnu++11. See
https://groups.google.com/forum/#!topic/native-client-discuss/m2vOMflHJrQ.

>
> This is all very confusing because there are various directories within
> mac_pnacl that have non portable looking names like i686_bc-nacl,
> arm_bc-nacl, and arm-nacl. For example my masked fix to #1 above seems to
> point to a native version of pthread and there doesn't seem to be a portable
> one. There also do not seem to be any isspace in any portable looking
> directory.
>
> Can someone shed some light on this? Perhaps send me the include
> directories from a good PNACL -v build so I can at least understand what
> should be included?
>
> Thanks,
> Ed
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Native-Client-Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to native-client-di...@googlegroups.com.
> To post to this group, send email to native-cli...@googlegroups.com.
> Visit this group at https://groups.google.com/group/native-client-discuss.
> For more options, visit https://groups.google.com/d/optout.

e...@modk.it

unread,
Jan 29, 2016, 4:31:55 PM1/29/16
to native-cli...@googlegroups.com
Hi Sam,
 
> 1) My first problem is "pnacl-ld: Cannot find '-lpthread'"  I mask that by
> pointing the linker to  pepper_44/toolchain/mac_pnacl/le32-nacl/lib

This should work by default.  How are you running the linker?  If you
use the pnacl-clang driver it certainly works for me:
$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-clang -lpthread ~/test/hello.c

Sure that works.  I added a -v to find out how the includes are setup by default because the CMAKE setup is definitely messing with something.

#include <...> search starts here:
 ~/nacl_sdk_2/pepper_44/toolchain/mac_pnacl/lib/clang/3.6.0/include
 ~/nacl_sdk_2/pepper_44/toolchain/mac_pnacl/le32-nacl/include/c++/v1
 ~/nacl_sdk_2/pepper_44/toolchain/mac_pnacl/le32-nacl/include
End of search list.

But none of those directories has an isspace in it.  The library expects isspace to be defined in cctypes but that's just a blank file in the C++ lib at  ~/nacl_sdk_2/pepper_44/toolchain/mac_pnacl/le32-nacl/include/c++/v1

I can just start patching the holes but wanted to make sure I wasn't missing anything.

Thanks,
Ed 



e...@modk.it

unread,
Jan 29, 2016, 5:07:42 PM1/29/16
to native-cli...@googlegroups.com
Oh and passing -std=gnu++11 doesn't fix this as it doesn't change the includes and as I said isspace just isn't in those folders.  

Thanks,
Ed


Ben Smith

unread,
Feb 1, 2016, 2:30:46 PM2/1/16
to Native-Client-Discuss
This simple test compiles for me with PNaCl and pepper_46:

$ cat test.cc
#include <cctype>

int main() { return isspace(' '); }
$ `tools/nacl_config.py -t pnacl --tool c++` test.cc

Can you try using a newer SDK?

Sam Clegg

unread,
Feb 1, 2016, 7:55:08 PM2/1/16
to native-cli...@googlegroups.com
On Fri, Jan 29, 2016 at 2:07 PM, e...@modk.it <e...@modk.it> wrote:
> Oh and passing -std=gnu++11 doesn't fix this as it doesn't change the
> includes and as I said isspace just isn't in those folders.

Are you sure? It should be declared in
toolchain/linux_pnacl/le32-nacl/include/ctype.h. If you don't see
it there then your SDK is most likely corrupt and you should
re-install.

cheers,
sam
Reply all
Reply to author
Forward
0 new messages