Coder Social home page Coder Social logo

OS X problems about emscripten HOT 10 CLOSED

emscripten-core avatar emscripten-core commented on May 15, 2024
OS X problems

from emscripten.

Comments (10)

maxm avatar maxm commented on May 15, 2024

I started looking into the tests that fail in OSX. test_assert was easy to fix, the OSX libc headers use a function called __assert_rtn to handle an assert, instead of __assert_fail like glibc.

Then I tried to fix test_dlmalloc, but that opened a lot more problems. OSX's libc headers fail if no architecture is defined (i386 or x86_64), and defining one of those opens a lot more problems.

I ended up copying glibc headers from a Linux install and using that. I still have some tests failing, but it's a lot better. Maybe the best solution would be for emscripten to include a set of libc headers known to work? Trying to support whatever libc is installed on the system seems to be a dead end.

from emscripten.

kripken avatar kripken commented on May 15, 2024

Interesting, thanks for the info. I like the idea of including a standard set of headers, it sounds like that can help a lot here. But that's assuming that does fix the issue everywhere - you say you are still seeing test failures, how bad are they?

Assuming that is fixable, and if we do want to go in the direction of including some standard headers, we then need to pick which ones. glibc and newlib are probably the main options.

from emscripten.

maxm avatar maxm commented on May 15, 2024

I just did a quick check of the rest of the tests that are failing:

  • test_freetype, test_openjpeg and test_the_bullet are failing to build the libraries. The configure fails when checking the compiler (which is set to emmaken.py).
  • test_libcxx is failing to run with error: Assertion failed: Must have a history for a safe heap load!
  • test_pystruct is failing when compiling the .ll into Javascript. The error is:
    // Unclear type in struct: x86_fp80, in %union.PyGC_Head
    Assertion failed: undefined
    Stack: Error
    at assertTrue (utility.js:59:23)
    at runtime.js:114:9
  • test_raytrace is failing because it includes iostream from the installed C++ library.
  • test_strings fails to run because it doesn't have an implementation for __01___isoc99_sscanf. This seems to be a problem with the libc headers I'm using now. I yanked them from an Ubuntu install, I think they use eglibc.

The last two tests problems are similar to the original libc problem. The rest seem to be unrelated.

from emscripten.

kripken avatar kripken commented on May 15, 2024

It looks like there are some serious problems left. Mainly I am concerned about test_libcxx and test_pystruct.

One possible problem is that even with bundled libc headers, the compiler will still end up including system headers (in particular stuff like /sys and /bits can be very system specific). So to be completely independent of the underlying system, we would need to bundle an entire system include directory, basically an entire build environment like for a cross-compiler.

I suspect if we did that all these problems would be solved, I'm not very familiar with cross-compilation though so not sure how easy it would be.

from emscripten.

snowyu avatar snowyu commented on May 15, 2024

I've got the same problems on the MacOS.

Why not use the ll files directly instead of llvm-dis from object files?

Maybe write a tools to translate the libraries into ll files. And put these files into the folder: libs/c/xxx.ll

from emscripten.

kripken avatar kripken commented on May 15, 2024

We could pregenerate .ll files I guess. We already have bundled .ll files for the python and lua tests (to save time building them).

But even if it would help you run more automatic tests without running a compiler, you still wouldn't be able to do much with emscripten unless you have another way of generating .ll from your source files. So not sure I understand what this gets us.

from emscripten.

snowyu avatar snowyu commented on May 15, 2024

Yes, we could. But we also need each c/c++ file has a corresponding ll file in a library. And we can know the source from the ll file. So we can reuse these ll files, only include the necessary ll files ..

from emscripten.

kripken avatar kripken commented on May 15, 2024

I don't quite understand what you mean. What are you trying to achieve, and how?

from emscripten.

snowyu avatar snowyu commented on May 15, 2024

OK ,just for example:

$>clang funcs.c -emit-llvm -o./mylib/funcs.ll
$>clang funcs2.c -emit-llvm -o./mylib/funcs2.ll
$>clang main.c -emit-llvm
$>emscripten.py main.ll -I./mylib -ILibs/c/stdlibs

from emscripten.

kripken avatar kripken commented on May 15, 2024

Emscripten now uses bundled headers, so building on OS X should be identical to Linux and everywhere else.

Closing this issue for now, please reopen if there are any remaining OS X problems.

from emscripten.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.