Git Product home page Git Product logo

Comments (6)

Syniurge avatar Syniurge commented on June 27, 2024

No idea here, sorry. You're probably the first person to try it on OS X.

A class and its methods were previously correctly emitted, since the following is a dump of a thunk generated by Calypso:

    void* __tmp1800 = void;
    , __tmp1800 = cast(void*)this , __tmp1800 += -16L;
    return (cast(DCXXclass)__tmp1800).hello(ceres);

so not everything is broken, but I've no idea what goes wrong with the function template instance. The segfaulting line would be helpful to figure out what's happening, could you rebuild Calypso with -DCMAKE_BUILD_TYPE=RelWithDebInfo?

from calypso.

John-Colvin avatar John-Colvin commented on June 27, 2024

with -DCMAKE_BUILD_TYPE=RelWithDebInfo I get

[ 21%] Generating src/core/atomic.o
ldc2(31541,0x7fff722e8000) malloc: *** mach_vm_map(size=140621419954176) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Error: out of memory
make[2]: *** [runtime/src/core/atomic.o] Error 1
make[1]: *** [runtime/CMakeFiles/druntime-ldc.dir/all] Error 2
make: *** [all] Error 2

while compiling Calypso.

from calypso.

Syniurge avatar Syniurge commented on June 27, 2024

There's some weird stuff going on OS X..

You may be able to gather more info by debugging the ldc2 command, first by retrieving the command line for the generation of atomic.o with make VERBOSE=1

And then if your debugger is gdb (unlikely but I'm not familiar with LLDB):

gdb build/bin/ldc2 -- [ldc2 args during the compilation of atomic.o]

In gdb:

break malloc_error_break
run
bt

It would be very interesting to know where that malloc call comes from. If LDC 0.15.2 works on OS X then it's probably due to a Calypso modification, but again I'm clueless.

from calypso.

wilsonk avatar wilsonk commented on June 27, 2024

Hello @Syniurge and @John-Colvin,

It looks like your error might be because the build line you used is missing a couple things. Here is my 'build.sh' file:

rm -f calypso_cache* *.o
clang++ -std=c++11 -c showcase.cpp -o showcase.cpp.o
ar rcs libshowcase.a showcase.cpp.o
ldc2 -v -cpp-args -std=c++11 -Llibshowcase.a -L-lstdc++ showcase.d

So really you should just need the '-cpp-args -std=c++11' option to build the showcase demo (and -L-lstdc++ I guess :) ). It builds and works here with Calypso from git today and OS X 10.10.3 with clang/llvm 3.6.2.

from calypso.

Syniurge avatar Syniurge commented on June 27, 2024

Hi Kelly, neat that Calypso is working at least partially for you on OS X!

-std=c++11 hasn't been needed for a while for showcase.d, it just prevents the warnings, so I'm not sure what goes wrong on John's setup, why ldc2 built with -DCMAKE_BUILD_TYPE=RelWithDebInfo blows a fuse. I don't have access to an OS X machine unfortunately..

from calypso.

timotheecour avatar timotheecour commented on June 27, 2024

out of memory

IIRC

*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Error: out of memory

could be caused by building ldc using too much memory, depending on options (eg: release builds use more memory, make -j8 uses more memory, having a VM running on the side (eg parallels with dedicated resources) also reduces available memory. IIRC I was able to fix this with make -j{smaller number}

require -std=c++11

Also, yes, the original error was clearly due to requiring -std=c++11;

-lstdc++ vs -lc++

see #82

break malloc_error_break

IIRC this doesn't work on OSX, instead use break malloc_printf worked for me

showcase.cpp doesn't exist in git master; I believe this was moved to Calypso/tests/calypso/basics.d

this works (modulo applying other fixes I mentioned for OSX)

ldc2 -run Calypso/tests/calypso/basics.d
NOTE: adding -cpp-verbosediags (or if the command fails for other reasons), the warnings will be shown: warning: 'override' keyword is a C++11 extension
adding -cpp-args -std=c++11 will suppress these warnings

will close once docs are updated in corresponding files

EDIT: docs were updated in c1cbe1b, closing

from calypso.

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.