Thanks Floh,
seems like adding
the above mentioned -isystem flag does seem to work after all, rebuilt
after clean without any errors the `hello-world` example, also i got no
special env but i'm worried about the write permission error,
However, now i happen to stumble upon something really weird,
When i try to separate the example to a header and source file, it does not
build successfully,

I now get:

ERROR: /home/tsvi/IOTA_DEV/entangled/common/BUILD:8:1: Linking of rule
'//common:errors' failed (Exit 1): false failed: error executing command
  (cd
/home/tsvi/.cache/bazel/_bazel_tsvi/9194043dbd55a599c9568f5a8b5663c8/execroot/org_iota_entangled
&& \
  exec env - \

PATH=/home/tsvi/.local/share/umake/bin:/home/tsvi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/tsvi/go:/home/tsvi/go/bin:/home/tsvi/.go/bin
\
    PWD=/proc/self/cwd \
  /bin/false rcsD bazel-out/asmjs-fastbuild/bin/common/liberrors.a
bazel-out/asmjs-fastbuild/bin/common/_objs/errors/errors.o)
Execution platform: @bazel_tools//platforms:host_platform
Target //common:errors failed to build



On Mon, May 20, 2019 at 4:04 PM Floh <[email protected]> wrote:

> Hmm, AFAIK those libraries you are building manually via embuilder.py
> should be built automatically when running emcc for the first time to build
> a program (basically emcc detects that some runtime libraries are missing,
> or are outdated, and builds them "on the fly").
>
> Your last error (IOError: [Errno 30] Read-only file system:
> '/home/tsvi/.emscripten_cache/asmjs/libc-extras.bc') looks like emcc wants
> to build one of those required runtime libraries, but it can't because it
> doesn't have write-access permissions to the .emscripten_cache directory in
> your home directory.
>
> Do you have some "unusual" Linux environment where write-access to the
> home directory is restricted? Or is bazel running as another user?
>
> Maybe similar permission errors also caused other problems earlier, and
> that's why the bazel tutorial failed.
>
> On Monday, 20 May 2019 14:40:35 UTC+2, Tsvi Sabo wrote:
>>
>> Tried to add to the `cc_toolchain_config.bzl` the missing include dir as
>> `-isystem` flag,
>>
>> Now i get this:
>>
>> cache:INFO: generating system library: libc-extras.bc... (this will be
>> cached in "/home/tsvi/.emscripten_cache/asmjs/libc-extras.bc" for
>> subsequent builds)
>> Traceback (most recent call last):
>>   File "external/emscripten_toolchain/emcc.py", line 3308, in <module>
>>     sys.exit(run(sys.argv))
>>   File "external/emscripten_toolchain/emcc.py", line 1776, in run
>>     extra_files_to_link += system_libs.calculate([f for _, f in
>> sorted(temp_files)] + extra_files_to_link, in_temp, stdout_=None,
>> stderr_=None, forced=forced_stdlibs)
>>   File
>> "/home/tsvi/.cache/bazel/_bazel_tsvi/9194043dbd55a599c9568f5a8b5663c8/external/emscripten_toolchain/tools/system_libs.py",
>> line 757, in calculate
>>     add_library(lib)
>>   File
>> "/home/tsvi/.cache/bazel/_bazel_tsvi/9194043dbd55a599c9568f5a8b5663c8/external/emscripten_toolchain/tools/system_libs.py",
>> line 718, in add_library
>>     libfile = shared.Cache.get(name, do_create)
>>   File
>> "/home/tsvi/.cache/bazel/_bazel_tsvi/9194043dbd55a599c9568f5a8b5663c8/external/emscripten_toolchain/tools/cache.py",
>> line 135, in get
>>     shutil.copyfile(temp, cachename)
>>   File "/usr/lib/python2.7/shutil.py", line 97, in copyfile
>>     with open(dst, 'wb') as fdst:
>> IOError: [Errno 30] Read-only file system:
>> '/home/tsvi/.emscripten_cache/asmjs/libc-extras.bc'
>> Target //:helloworld.js failed to build
>> Use --verbose_failures to see the command lines of failed build steps.
>>
>> On Mon, May 20, 2019 at 2:26 PM Tsvi Sabo <[email protected]> wrote:
>>
>>> An update in case anyone was looking into it,
>>> `cxx` changed to `c++` and `wasm-libc` to `libc-wasm` so a correct way
>>> to run the script now is:
>>>
>>> `python embuilder.py build dlmalloc libc++ libc gl libc++abi
>>> libc++_noexcept libc-wasm`
>>>
>>>
>>>
>>>
>>>
>>> On Mon, May 20, 2019 at 2:05 PM Tsvi Sabo <[email protected]> wrote:
>>>
>>>> I think i might have a hint for how to solve it,
>>>> I am missing some standard library files, and there's a way to generate
>>>> those running:
>>>> "python embuilder.py build dlmalloc libcxx libc gl libcxxabi
>>>> libcxx_noexcept wasm-libc"
>>>> from `external/emscripten_toolchain`
>>>> but when i do that, i get:
>>>>
>>>> embuilder:INFO: building and verifying dlmalloc
>>>> embuilder:INFO: ...success
>>>> embuilder:INFO: building and verifying libcxx
>>>> embuilder:ERROR: unfamiliar build target: libcxx
>>>>
>>>> Any idea?
>>>>
>>>> On Mon, May 20, 2019 at 12:55 PM Tsvi Sabo <[email protected]> wrote:
>>>>
>>>>> Thanks a lot for your reply, will try it, but the reason i was using
>>>>> the Bazel to pull and build emscripten rather than installing
>>>>> the SDK is that i would like to have a Bazel target which i can build
>>>>> with emscripten on any platform,
>>>>> you think that's possible?
>>>>>
>>>>> On Mon, May 20, 2019 at 12:39 PM Floh <[email protected]> wrote:
>>>>>
>>>>>> Wow, that looks overly complicated (I guess that's Bazel's fault).
>>>>>>
>>>>>> If you are on a Mac, the easiest way to get a working emscripten
>>>>>> environment is via homebrew:
>>>>>>
>>>>>> > brew install emscripten
>>>>>>
>>>>>> On Linux, check whether the emscripten SDK is provided by your
>>>>>> distro's package manager, otherwise (or if on Windows), follow the steps
>>>>>> described here to install the emscripten SDK:
>>>>>>
>>>>>> https://emscripten.org/docs/getting_started/downloads.html
>>>>>>
>>>>>> ...and to test whether this worked, write a small hello.c:
>>>>>>
>>>>>> #include <stdio.h>
>>>>>> int main() {
>>>>>>     printf("Hello World!\n");
>>>>>>     return 0;
>>>>>> }
>>>>>>
>>>>>> ...then run:
>>>>>>
>>>>>> > emcc hello.c -o hello.html
>>>>>> ...
>>>>>>
>>>>>> ..this should produce 3 files: hello.html, hello.js and hello.wasm
>>>>>>
>>>>>> ...to test whether the produced application works:
>>>>>>
>>>>>> > emrun hello.html
>>>>>> Starting browser: open http://localhost:6931/hello.html
>>>>>> ...
>>>>>>
>>>>>> ...this should open the system's default browser and show the
>>>>>> emscripten standard demo page, at the bottom of the page there should be 
>>>>>> a
>>>>>> "Hello World!" message in a text output field.
>>>>>>
>>>>>> From there, move to more complex stuff. But I would move to build
>>>>>> systems only when you're sure that the emscripten installation itself 
>>>>>> works.
>>>>>>
>>>>>> Build systems just add more things that can go wrong, and the
>>>>>> additional "obfuscation layer" (which the build systems add on top of the
>>>>>> compiler toolchain) can make it harder to find the actual problems.
>>>>>>
>>>>>> Cheers,
>>>>>> -Floh.
>>>>>>
>>>>>> On Monday, 20 May 2019 11:01:32 UTC+2, Tsvi Sabo wrote:
>>>>>>>
>>>>>>> Following this tutorial:
>>>>>>>
>>>>>>> https://docs.bazel.build/versions/master/tutorial/cc-toolchain-config.html
>>>>>>> And after fixing some of the configuration's paths,
>>>>>>> i manage to build a really simple `hello-world` `c` file, but when i
>>>>>>> follow the example completely, and include some cpp headers such as
>>>>>>> <ctime>, i get the following:
>>>>>>>
>>>>>>> "In file included from
>>>>>>> /home/tsvi/IOTA_DEV/entangled/hello-world.cc:2:
>>>>>>> In file included from
>>>>>>> external/emscripten_toolchain/system/include/libcxx/iostream:38:
>>>>>>> In file included from
>>>>>>> external/emscripten_toolchain/system/include/libcxx/ios:216:
>>>>>>> external/emscripten_toolchain/system/include/libcxx/__locale:417:32:
>>>>>>> error: use of undeclared identifier '_CTYPE_S'
>>>>>>>     static const mask space  = _CTYPE_S;"
>>>>>>>
>>>>>>>
>>>>>>> So, i am guessing, it might be using wrong include paths of clang
>>>>>>> after all?
>>>>>>> How do i fix this?
>>>>>>> Thanks
>>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "emscripten-discuss" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/emscripten-discuss/9cff3f50-bee1-43ac-be9b-f7076024d47e%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/emscripten-discuss/9cff3f50-bee1-43ac-be9b-f7076024d47e%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>> *IOTA Foundation*
>> c/o Nextland
>> Strassburgerstraße 55
>> 10405 Berlin, Germany
>>
>> Board of Directors: Sergey Ivancheglo, Serguei Popov, Ralf Rottmann,
>> Dominik Schiener, David Sønstebø
>>
>> ID/Company No.: 3416/1234/2
>>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/1f8ccc46-13e3-44c7-950c-d67d6f708f14%40googlegroups.com
> <https://groups.google.com/d/msgid/emscripten-discuss/1f8ccc46-13e3-44c7-950c-d67d6f708f14%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
*IOTA Foundation*
c/o Nextland
Strassburgerstraße 55
10405 Berlin, Germany



Board of Directors: Sergey Ivancheglo, Serguei Popov, Ralf Rottmann, 
Dominik Schiener, David Sønstebø


ID/Company No.: 3416/1234/2

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAGtHauJ5jCh2%3D%3DEeg9DYb%3DXabtRRw1sW-d-bgJK%3D%2B3X05hx9eQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to