Git Product home page Git Product logo

calypso's People

Contributors

alexeyprokhin avatar bioinfornatics avatar ckamm avatar d0k avatar deewiant avatar dnadlinger avatar eldar avatar hardcode84 avatar jkrempus avatar joakim-noah avatar johanengelen avatar kinke avatar lemonboy avatar lindquist avatar llucax avatar mrmonday avatar mwarning avatar rainers avatar redstar avatar rtbo avatar sa111 avatar servis avatar sibnick avatar smolt avatar syniurge avatar thewilsonator avatar timotheecour avatar trass3r avatar webdrake avatar wilsonk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

calypso's Issues

Auto detecting Clang modules

Hello Elie,

After the 'Auto-detect Clang module map files and add module maps for libc and POSIX standard headers' push today, most of the examples in the libstdc++ directory don't work? Is there something missing from that push? Or should the command line be different now or something?

The errors are similar to this (some are missing ptrdiff_t also):
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/ext/new_allocator.h(61): Error: undefined identifier 'size_t'

Paradoxically the iterator example actually parsed, when it never worked before :)

I also saw the Qt5 demo and tried it here but it gives me a few errors like this:
Error: struct cpp..div_t conflicts with static import cpp..div_t at /usr/include/stdlib.h(97)
and then a template specialization error, just in case you aren't seeing the same thing.

Thanks,
Kelly

assert(handle !in _handleToDSO) in setDSOForHandle fails on OSX

@Syniurge @klickverbot @ MartinNowak (since this seem to touch on druntime shared library initialization issues)

to reproduce: same test case as in #63

$calypso_D/lib/libcalypso-ldc-shared.dylib is being registered twice; depending on program, it could be another file that is registered twice;
workaround: just return from _d_dso_registry (in Calypso/runtime/druntime/src/rt/sections_elf_shared.d) when input corresponds to a so already registered.

Here is where it would fail:

#in void setDSOForHandle(DSO* pdso, void* handle):
assert(handle !in _handleToDSO); // fails

not sure if the fix is good enough though, doesn't seem so based on other bug i have after that

cpp11-push has undefined references

Building branch cpp11-push I get these undefined references:

[ 18%] Linking CXX executable bin/ldc2 lib/libldc.a(cppmodule.cpp.o): I funktionen "cpp::DeclMapper::VisitTemplateParameter(clang::NamedDecl const*, clang::TemplateArgument const*)":

/home/tbl/PKGBUILD/ldc-calypso-git/src/ldc/dmd2/cpp/cppmodule.cpp:1040: undefined reference to Array<RootObject*>* cpp::TypeMapper::FromType::fromTemplateArgument(clang::TemplateArgument const*, clang::NamedDecl const*)'`

lib/libldc.a(cppexpression.cpp.o): I funktionen "cpp::fromASTTemplateArgumentListInfo(Loc, clang::TemplateArgumentLoc const*, unsigned int, cpp::TypeMapper&)":

/home/tbl/PKGBUILD/ldc-calypso-git/src/ldc/dmd2/cpp/cppexpression.cpp:64: undefined reference to Array<RootObject*>* cpp::TypeMapper::FromType::fromTemplateArgument(clang::TemplateArgument const*, clang::NamedDecl const*)'`

lib/libldc.a(cpptemplate.cpp.o): I funktionen "cpp::TemplateInstance::semanticTiargs(Scope*)":

/home/tbl/PKGBUILD/ldc-calypso-git/src/ldc/dmd2/cpp/cpptemplate.cpp:790: undefined reference to Array<RootObject*>* cpp::TypeMapper::FromType::fromTemplateArgument(clang::TemplateArgument const*, clang::NamedDecl const*)'`

Dlib matrix.h modmap error

Hello Elie,

I am getting an error when trying to modmap dlib/matrix/matrix.h, which is one the main headers needed for much of Dlib. It appears as though returning the 'literal_assign_helper' struct value at line 1670 of matrix.h is the problem. If you need more information on the bug, please let me know.

Here is part of the backtrace:

    `-ReturnStmt 0xcc62760 <col:16>
      `-UnaryOperator 0xcc62740 <col:16> 'struct dlib::matrix<long, 2, 1, class dlib::memory_manager_stateless_kernel_1<char>, struct dlib::row_major_layout>::literal_assign_helper' lvalue prefix '*'
        `-CXXThisExpr 0xcc62728 <col:16> 'struct dlib::matrix<long, 2, 1, class dlib::memory_manager_stateless_kernel_1<char>, struct dlib::row_major_layout>::literal_assign_helper *' this
ldc2: /home/wilsonk/Downloads/Calypso/dmd2/template.c:4254: virtual void deduceType(RootObject*, Scope*, Type*, TemplateParameters*, Objects*, unsigned int*, size_t)::DeduceType::visit(TypeInstance*): Assertion `false && "Argument type should be semantic'd by now"' failed.
#0 0x3a4cf26 llvm::sys::PrintStackTrace(_IO_FILE*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x3a4cf26)
#1 0x3a4d1c1 PrintStackTraceSignalHandler(void*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x3a4d1c1)
#2 0x3a4bde3 SignalHandler(int) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x3a4bde3)
#3 0x7f040bca4340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x7f040aa9fcc9 gsignal /build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x7f040aaa30d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#6 0x7f040aa98b86 __assert_fail_base /build/buildd/eglibc-2.19/assert/assert.c:92:0
#7 0x7f040aa98c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x11a9deb (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x11a9deb)
#9 0x1163834 TypeInstance::accept(Visitor*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x1163834)
#10 0x11abeee deduceType(RootObject*, Scope*, Type*, Array<TemplateParameter*>*, Array<RootObject*>*, unsigned int*, unsigned long) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x11abeee)
#11 0x11aa32e deduceType(RootObject*, Scope*, Type*, Array<TemplateParameter*>*, Array<RootObject*>*, unsigned int*, unsigned long)::DeduceType::deduceBaseClassParameters(BaseClass*, Scope*, Type*, Array<TemplateParameter*>*, Array<RootObject*>*, Array<RootObject*>*, int&) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x11aa32e)
#12 0x11aa67b deduceType(RootObject*, Scope*, Type*, Array<TemplateParameter*>*, Array<RootObject*>*, unsigned int*, unsigned long)::DeduceType::visit(TypeClass*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x11aa67b)
#13 0x1163960 TypeClass::accept(Visitor*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x1163960)
#14 0x11aa9ae deduceType(RootObject*, Scope*, Type*, Array<TemplateParameter*>*, Array<RootObject*>*, unsigned int*, unsigned long)::DeduceType::visit(Expression*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x11aa9ae)
#15 0x11ab14f deduceType(RootObject*, Scope*, Type*, Array<TemplateParameter*>*, Array<RootObject*>*, unsigned int*, unsigned long)::DeduceType::visit(NullExp*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x11ab14f)
#16 0x1230b9e NullExp::accept(Visitor*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x1230b9e)
#17 0x11abf40 deduceType(RootObject*, Scope*, Type*, Array<TemplateParameter*>*, Array<RootObject*>*, unsigned int*, unsigned long) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x11abf40)
#18 0x11a1859 TemplateDeclaration::deduceFunctionTemplateMatch(TemplateInstance*, Scope*, FuncDeclaration*&, Type*, Array<Expression*>*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x11a1859)
#19 0x11a406b functionResolve(Match*, Dsymbol*, Loc, Scope*, Array<RootObject*>*, Type*, Array<Expression*>*)::ParamDeduce::fp(TemplateDeclaration*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x11a406b)
#20 0x11a3040 functionResolve(Match*, Dsymbol*, Loc, Scope*, Array<RootObject*>*, Type*, Array<Expression*>*)::ParamDeduce::fp(void*, Dsymbol*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x11a3040)
#21 0x11cbe66 overloadApply(Dsymbol*, void*, int (*)(void*, Dsymbol*)) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x11cbe66)
#22 0x11a47ef functionResolve(Match*, Dsymbol*, Loc, Scope*, Array<RootObject*>*, Type*, Array<Expression*>*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x11a47ef)
#23 0x11ccb0b resolveFuncCall(Loc, Scope*, Dsymbol*, Array<RootObject*>*, Type*, Array<Expression*>*, int) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x11ccb0b)
#24 0x121be85 hasIdentityOpAssign(AggregateDeclaration*, Scope*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x121be85)
#25 0x1199057 ClassDeclaration::semantic(Scope*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x1199057)
#26 0x1399b65 cpp::ClassDeclaration::semantic(Scope*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x1399b65)

Thanks,
Kelly

Libstdc++ array error (happens in other libs)

Hello Elie,

When trying to compile the array.h libstdc++ example we get this error:

/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/exception_ptr.h(116): Error: class cpp.std.__exception_ptr.exception_ptr.exception_ptr identity assignment operator overload is illegal

and a few very similar errors (along with this same error) occur when trying to compile some other libs. I just thought I would document it here to make it somewhat of a priority.

Thanks,
Kelly

Can't build after clang submodule added

Hello Elie,

I still can't build Calypso even after the last couple changes to help with the new clang submodule. I rebuilt llvm in debug mode (which is going to really suck for build times and the QT demo), added libc++ and libc++-abi, since that seemed to be required??? Not absolutely sure on that one. Now I get this error:

[  0%] Built target impcnvgen
[  0%] Built target idgen
[ 16%] Built target LDCShared
[ 16%] Performing configure step for 'clang'
-- Found LLVM_CONFIG as /usr/local/bin/llvm-config
CMake Error at CMakeLists.txt:62 (if):
  if given arguments:

    "STREQUAL" "Debug" "AND" "NOT" "Debug+Asserts" "STREQUAL" "Debug"

  Unknown arguments specified

-- Configuring incomplete, errors occurred!

Maybe my version of cmake isn't new enough? cmake-2.8.12.2? I checked into this a little (after a bunch of errors with llvm stuff) and couldn't see what was wrong.

'Frustrated' would be the word for my state of mind at this point, because I would like to try out the new Ogre demo and the build process really needs to be easier than this. I think the install instructions on the website need updating ...and with absolutely dead easy cut-n-paste instructions or people are going to get frustrated and not try Calypso out.

Sorry to be a nag, but it takes a good 30 mins to rebuild llvm/libc++, etc. and I have tried at least 4-5 different combinations over the last couple days and still don't have a working Calypso binary :(

Thanks,
Kelly

P.S. Btw, I can't use the Ubuntu binaries you have spoken of for llvm/clang, because I prefer not to be on the absolute bleeding edge with my linux installs, so I am on 14.04 and not 15.04. I believe this would be the norm, as running non-LTS versions of Ubuntu is a little rare. I literally can't upgrade because the version of linux on my Calypso machine (which is non production) doesn't have an upgrade path to non-LTS versions.

duplicate symbol __D6ℂcpp3std9type_info9type_info6__initZ

on OSX, I'm getting:

duplicate symbol __D6ℂcpp3std9type_info9type_info6__initZ in:
.calypso_cache/__cpp-std-type_info.o
libcalypso-ldc-debug.a(__cpp_monolith-debug.o)
duplicate symbol __D6ℂcpp3std9type_info9type_info7__ClassZ in:
.calypso_cache/__cpp-std-type_info.o
libcalypso-ldc-debug.a(__cpp_monolith-debug.o)
duplicate symbol __D6ℂcpp3std_Cpp9type_info12__ModuleInfoZ in:
.calypso_cache/__cpp-std-type_info.o
libcalypso-ldc-debug.a(__cpp_monolith-debug.o)
ld: 3 duplicate symbols for architecture x86_64

when adding:

modmap (C++) "<vector>";
import (C++) std.vector;

is there an up to date document that contains C++ features support + limitations?

Eg, I'd like to know whether this could work with things like:

stdio.h
opencv2/opencv.hpp
<boost>

I'm sure others are wondering too

EDIT: summarizing from answers below

  • a proper test suite
  • finish MSVC support (catching exceptions)
  • dtor calls by the GC
  • copy ctor calls for function arguments => done recent commits
  • documentation
  • more testing with more libraries and platforms (esp. OS X).

=> https://github.com/Syniurge/Calypso/blob/master/README.md#missing-features

error: The module 'ℂcpp.std.type_info' is already defined in libcalypso-ldc-shared.dylib

BUG:D20180106T154634

@Syniurge @klickverbot @ MartinNowak (since this seem to touch on druntime shared library initialization issues)

on OSX:

main.d:

 // simplified from https://wiki.dlang.org/Calypso
 modmap (C++) "<vector>";
 import (C++) std.vector;
 void main(){
     import core.stdc.stdio : printf;
     printf("begin\n");
     vector!int v;
     printf("v.size = %d\n", cast(int)v.size);
     printf("end\n");
 }
# build calypso (with some modifications to allow build to succeed; cf other bugs i reported)

$calypso_D/bin/ldc2 -of=$exe -cpp-args=-I$HOME/homebrew/include/ -cpp-verbosediags -v -defaultlib=phobos2-ldc-shared,druntime-ldc-shared -cpp-args=-std=c++11 -cpp-args=-stdlib=libc++ -cpp-args=-v -cpp-args=-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 -cpp-args=-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include -cpp-args=-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -cpp-args=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include -cpp-args=-Wno-expansion-to-defined -L-L$calypso_D/lib -L-lcalypso-ldc-shared main.d

$exe

Fatal Error while loading 'main': The module 'ℂcpp.std.type_info' is already defined in '$calypso_D/lib/libcalypso-ldc-shared.dylib'.

environment:

binary    $calypso_D/bin/ldc2
version   1.3.0git-e5342cc-dirty (DMD v2.073.2, LLVM 3.9.1)
config    $calypso_D/bin/ldc2.conf (x86_64-apple-darwin17.2.0)
predefs   LDC all D_Version2 LDC_DCompute assert X86_64 D_InlineAsm_X86_64 D_HardFloat LittleEndian D_LP64 D_PIC OSX darwin Posix D_ObjectiveC LDC_LLVM_309
  • Other note: I had to instrument _d_dso_registry to avoid assert(handle !in _handleToDSO); failing in setDSOForHandle , see #64 for details

ubuntu Build instructions

I could not find the build instructions anywhere. I figured it out how to do it by googling and making cmake happy. Here are the instructions that work for Ubuntu 16.04 in case someone else wants to try this awesome compiler:

  1. Add the llvm-3.9 repo
  2. sudo apt-get install llvm-3.9 clang-3.9 ninja-build systemtap-sdt-dev
  3. Clone this repo and cd into it
  4. git submodule update --init
  5. mkdir build && cd build
  6. cmake ..
  7. make

LLVM_CONFIG isn't passed correctly to clang cmake

$ mkdir build && cd build
$ cmake ../ -DLLVM_CONFIG=/usr/local/Cellar/llvm/3.6.2/bin/llvm-config
# works fine, uses correct path
$ make
[  1%] Built target idgen
[  1%] Performing rebuild step for 'clang'
[  1%] Performing configure step for 'clang'
CMake Error at CMakeLists.txt:51 (message):
  llvm-config not found -- LLVM_CONFIG-NOTFOUND

Loss of qualifiers in function parameters in Clang template instantiations

Hello Elie,

It looks like the list.d example stopped working a couple weeks back.

/home/wilsonk/Downloads/Calypso/tests/calypso/libstdc++/list/list.d(76): Error: template cpp.std.list.list!(int, *allocator!int).list.remove_if cannot deduce function from argument types !()(bool function(const(int))), candidates are:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_list.h(1363): cpp.std.list.list!(int, *allocator!int).list.remove_if(_Predicate)(_Predicate)

Just thought I would let you know in case you didn't see it. The qtdemo (along with my expanded version that I haven't pushed yet) and all other libstdc++ examples work the same after this weeks changes, though, so no regressions there.

Project highlighting and first public beta version

Hi! I think that it's very important to make first public release something like beta version, it will help to attract attention for more developers to project, and there is good chance that some of them will help of fixing and improving project.

What do you think about this idea?

OSX: `make test` fails: 4 tests failed out of 1565

99% tests passed, 4 tests failed out of 1565

Total Test time (real) = 830.57 sec

The following tests FAILED:
1560 - druntime-test-shared (Failed)
1562 - dmd-testsuite-debug (Failed)
1564 - dmd-testsuite (Failed)
1565 - lit-tests (Failed)
Errors while running CTest

is `modmap (C++) "basics.cpp";` an error (instead of basics.h) ?

all the code in calypso shows modmap (C++) {foo.h or foo} except for:

tests/calypso/basics.d:14:1:modmap (C++) "basics.cpp";

is it an error to put the source file instead of header file? The docs don't specify which should be used; I'm guessing it's ok to add .h and .cpp; however, instructions in basics3.d shows:

* Build with:
 *   $ clang++ -std=c++11 -c basics.cpp -o basics.cpp.o
 *   $ ldc2 -cpp-args -std=c++11 basics.cpp.o -L-lstdc++ basics.d

will that introduce ODR violations since ldc2 command will get the obj both from basics.cpp.o and from .calypso_cache/*.o ?

GDAL error again

Hello Elie,

It looks like there was a regression for the GDAL example after the last few months since the last time I was around :)

I get this error:

gdal.d(36): Error: cannot implicitly convert expression (& GDALTermProgress) of type extern (C) int function(double, const(char), void) to extern (C++) int function(double, const(char), void)
gdal.d(46): Error: cannot implicitly convert expression (& GDALGenImgProjTransform) of type extern (C) int function(void* pTransformArg, int bDstToSrc, int nPointCount, double* x, double* y, double* z, int* panSuccess) to extern (C++) int function(void_, int, int, double_, double_, double_, int*)

Thanks,
Kelly

ldc2 basics.cpp.o deletes source file basics.cpp

following instructions from https://github.com/Syniurge/Calypso#specific-flags-and-building-the-basic-example :

cd Calypso/tests/calypso
clang++ -std=c++11 -c basics.cpp -o basics.cpp.o
path_to_build/ldc2 -cpp-args -std=c++11 basics.cpp.o -L-lstdc++ basics.d
#this deletes basics.cpp

EDIT: basics.cpp doesn't get deleted if i instead write:

clang++ -std=c++11 -c basics.cpp -o basics2.cpp.o
path_to_build/ldc2 -cpp-args -std=c++11 basics2.cpp.o -L-lstdc++ basics.d

EDIT: IIRC same issue on ubuntu

Error: forward reference to inferred return type of function call

test.h:

#define tims_my_def2(x) (2*x)

template<typename T> auto _tims_my_def2(const T& x){
  return tims_my_def2(x);
}

main.d:

modmap (C++) "test3.h";
import (C++) _;
void main(){
  //  (compiled with `-cpp-args=-std=c++14`)
  // Error: forward reference to inferred return type of function call '_tims_my_def2(3)'
  auto a=_tims_my_def2(3);
}

workaround: use this (with -cpp-args=-std=c++11)

template <class T>
constexpr auto _tims_my_def2(const T& x) -> decltype(tims_my_def2(x)) {
	return tims_my_def2(x);
}

calypso/cpp/eh/unwind-cxx.h:33:10: fatal error: 'typeinfo' file not found

not sure if it's a dup of #41 but i'm running into a build issue on OSX:

make
start:time=D20170807T012338U15983 hnsecs=636376910181598720
[  0%] Built target LDMD_CXX_LIB
[  0%] Performing rebuild step for 'clang'
[  0%] Performing build step for 'clang'
ninja: no work to do.
[  0%] Performing rtcopy step for 'clang'
[  0%] No install step for 'clang'
[  0%] Completed 'clang'
[  0%] Built target clang
[  3%] Built target LDCShared
[  3%] Built target ldmd2
[  3%] Built target ldc2
[  3%] Built target gen_gccbuiltins
[  3%] Built target not
[  3%] Built target FileCheck
[  3%] Built target ldc-profdata
[  3%] Built target ldc-prune-cache
[  3%] Built target ldc-profile-rt
[  3%] Generating cpp/eh/gnu-debug.o
In file included from Calypso/build/runtime/calypso-ldc-debug-cpp/calypso_cache.h:1:
Calypso/runtime/calypso/cpp/eh/unwind-cxx.h:33:10: fatal error: 'typeinfo' file not found
#include <typeinfo>
         ^
Error: Invalid C/C++ header(s)
make[2]: *** [runtime/cpp/eh/gnu-debug.o] Error 1
make[1]: *** [runtime/CMakeFiles/calypso-ldc-debug-shared.dir/all] Error 2
make: *** [all] Error 2

Build Failure with Nix: fatal error: 'typeinfo' file not found

I am working on reproducible builds for LDC and you project as well using the Nix package manager.
I have ldc working fine however I am stuck on an issue with calypso's build when it tries to compile runtime/druntime/src/ldc/eh/cpp/unwind-cxx.h:33:10 which is from what I can tell included in line one of build/runtime/calypso_cache.h. For some reason it cannot handle the following line as it throws fatal error: 'typeinfo' file not found stopping the build:

#include <typeinfo>

You can test my build environment on any platform that Nix support (linux, osx, cygwin, etc.) by cloning my nix expressions for your project with instructions Nekroze/ldc-calypso.nix and you can find the output of my build (with the middle (boring) part removed) at this gist.

OS X build issue

I am just adding this in case someone else runs into this problem. I was building Calypso on OS X and I needed to add '-lc++abi' to the CMAKE_EXE_LINKER_FLAGS to get things compiled. There was an error like

Undefined symbols for architecture x86_64: 
    "std::terminate()", referenced from: 
        _main in test-648ddf.o

Just thought I should mention it.

GDAL example problems on OS X

GDAL almost works out-of-the-box on OS X but it needs a couple changes. Elie can you patch cpptypes.h with this please, as it is too much work for such a simple change to make a PR IMHO:

diff --git a/dmd2/cpp/cpptypes.cpp b/dmd2/cpp/cpptypes.cpp
index 78d5b03..72e75c7 100644
--- a/dmd2/cpp/cpptypes.cpp
+++ b/dmd2/cpp/cpptypes.cpp
@@ -386,23 +386,26 @@ Type *TypeMapper::FromType::fromTypeUnqual(const clang::Type *T)
     // Pointer and reference types
     auto Pointer = dyn_cast<clang::PointerType>(T);
     auto Reference = dyn_cast<clang::ReferenceType>(T);
+    auto BPointer = dyn_cast<clang::BlockPointerType>(T);

-    if (Pointer || Reference)
+    if (BPointer || Pointer || Reference)
     {
         auto pointeeT = Reference ?
-                Reference->getPointeeTypeAsWritten() : Pointer->getPointeeType();
+            Reference->getPointeeTypeAsWritten() : (BPointer ? BPointer->getPointeeType() : Pointer->getPointeeType());
         auto pt = fromType(pointeeT);
         if (!pt)
             return nullptr;

         Type *t;
-        if (Pointer)
+        if (BPointer)
+            t = new TypePointer(pt);
+        else if (Pointer)
             t = new TypePointer(pt);
         else
             t = new TypeReference(pt);
         return t->merge();
     }

     llvm::llvm_unreachable_internal("Unrecognized C++ type");
 }

Then the GDAL example will compile but not quite link because of this:

Undefined symbols for architecture x86_64:
  "sigval::operator=(sigval const&)", referenced from:
      __siginfo::operator=(__siginfo const&) in __cpp___siginfo.o
ld: symbol(s) not found for architecture x86_64

If you just remove __cpp___siginfo.o from the link line from the verbose Calypso output by hand, then the example compiles. I am not sure why the above error is appearing...I tried to include -lc++ and -lc++abi to no avail???

VTK symbol conflict error (nested enum having the same name as a field)

Hello Elie,

There seems to be one major error holding back a few nice VTK examples. I have isolated it so that I could add it to the basics.hpp example test code like so:

    template <class T>
    class testClassTemplate:
    public testClassTemplate<arrayOfTen<T>>
    {
    public:
      enum test {
        FREE,
        DELETE
      };

    protected:
      int test;

    };

Then instantiate from basics.d ala. "auto tt = new testClassTemplate!(arrayOfTen!int);" and you get this error:

basics.hpp(129): Error: variable cpp.test.testClassTemplate.testClassTemplate!(arrayOfTen!int).testClassTemplate.test conflicts with enum cpp.test.testClassTemplate.testClassTemplate!(arrayOfTen!int).testClassTemplate.test at basics.hpp(123)
basics.d(157): Error: template instance cpp.test.testClassTemplate.testClassTemplate!(arrayOfTen!int) error instantiating

I guess there is a problem with Type::merge() and decorations in mtype.c...maybe? Anyways, I just took a quick look and thought that was where the problem lay.

Thanks,
Kelly

Needing to define CLANG_INCLUDE_DIRS also...

Hello. Please see the following session transcript. The Calypso readme only tells to define LLVM_SOURCE_PATH on the CMake command line, and even the http://wiki.dlang.org/Building_LDC_from_source page does not mention anything about having to manually define CLANG_INCLUDE_DIRS but only if I include that then CMake runs correctly.

[samjnaa:~/sr/_repos/git/_dlang/calypso] mkdir build ; cd build
[samjnaa:~/sr/_repos/git/_dlang/calypso/build] cmake .. -DLLVM_SOURCE_PATH="/home/samjnaa/sr/_repos/svn/_llvm/llvm-3.6"
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found LLVM: /usr/lib/llvm-3.7 (found suitable version "3.7.0", minimum required is "3.1") 
-- Found LibConfig: /usr/include  
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- LDC version identifier: cfcae2
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for setupterm in tinfo
-- Looking for setupterm in tinfo - found
-- Using path for Intrinsics.td: /usr/lib/llvm-3.7/include
-- Looking for _SC_ARG_MAX
-- Looking for _SC_ARG_MAX - found
-- Check size of void*
-- Check size of void* - done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CLANG_INCLUDE_DIRS
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso/runtime
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso/runtime
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso/runtime
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso/runtime
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso/runtime
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso/runtime
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso/runtime
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso/runtime
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso/runtime
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso/runtime
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso/runtime
used as include directory in directory /home/samjnaa/sr/_repos/git/_dlang/calypso/runtime

-- Configuring incomplete, errors occurred!
See also "/home/samjnaa/sr/_repos/git/_dlang/calypso/build/CMakeFiles/CMakeOutput.log".
See also "/home/samjnaa/sr/_repos/git/_dlang/calypso/build/CMakeFiles/CMakeError.log".
[samjnaa:~/sr/_repos/git/_dlang/calypso/build] cmake .. -DLLVM_SOURCE_PATH="/home/samjnaa/sr/_repos/svn/_llvm/llvm-3.6" -DCLANG_INCLUDE_DIRS="/home/samjnaa/sr/_repos/svn/_llvm/llvm-3.6/tools/clang/include"
-- LDC version identifier: cfcae2
-- Using path for Intrinsics.td: /usr/lib/llvm-3.7/include
-- Configuring done
-- Generating done
-- Build files have been written to: /home/samjnaa/sr/_repos/git/_dlang/calypso/build
[samjnaa:~/sr/_repos/git/_dlang/calypso/build]

I'm running Kubuntu Trusty 64 bit.

macro functions not mapped to D

macros don't seemed to be mapped to D, despite what's said in https://wiki.dlang.org/Calypso: Constant and empty preprocessor macros (mapped to enums).

Other tools support macros (eg: swig, dstep etc)

test.h:

#define my_macro 42
#define my_macro2(x) (2*x)

main.d:

modmap (C++) "test.h";
import (C++) _;
void main(){
  enum a1=my_macro;  // Error: undefined identifier 'my_macro'
  enum a2=my_macro2(3);  // Error: undefined identifier 'my_macro2'
}

Use cases:
many (eg: CV_32F in opencv etc)

workaround:
add this in test.h:

enum class macros{
	_CV_8U=CV_8U,
	_CV_32F=CV_32F,
};

and in main.d:

import (C++) macros;
enum CV_8U=macros._CV_8U;

obviously, not ideal.

And for macro function, the workaround is more involved (define a template etc), and generates other issues: #67

EDIT: and this is despite:
Dsymbol* DeclMapper::VisitMacro(const clang::IdentifierInfo* II, const clang::Expr* E)
in ddmd/cpp/cppmodule.cpp

Policy CMP0042 is not set

getting this warning

CMake Warning (dev):
   Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
   --help-policy CMP0042" for policy details.  Use the cmake_policy command to
   set the policy and suppress this warning.

   MACOSX_RPATH is not specified for the following targets:

    calypso-ldc-debug-shared
    calypso-ldc-shared
    calypso-ldc-unittest-debug-shared
    calypso-ldc-unittest-shared
    druntime-ldc-debug-shared
    druntime-ldc-shared
    druntime-ldc-unittest-debug-shared
    druntime-ldc-unittest-shared
    phobos2-ldc-debug-shared
    phobos2-ldc-shared
    phobos2-ldc-unittest-debug-shared
    phobos2-ldc-unittest-shared

Can't build today

Hello Elie,

I tried building today (Oct 14), after the change to the clang libs instead of the binary, but I get this error when trying to link ldc2 (everything else builds fine up until linking):

deps/clang/lib/libclangFrontend.a(SerializedDiagnosticReader.cpp.o): In function operator*': /usr/local/include/llvm/Support/ManagedStatic.h:69: undefined reference toAnnotateHappensAfter'
deps/clang/lib/libclangLex.a(Lexer.cpp.o): In function llvm::sys::UnicodeCharSet::rangesAreValid() const': /usr/local/include/llvm/Support/UnicodeCharRanges.h:71: undefined reference tollvm::DebugFlag'
/usr/local/include/llvm/Support/UnicodeCharRanges.h:71: undefined reference to llvm::isCurrentDebugType(char const*)' /usr/local/include/llvm/Support/UnicodeCharRanges.h:72: undefined reference tollvm::DebugFlag'
/usr/local/include/llvm/Support/UnicodeCharRanges.h:72: undefined reference to llvm::isCurrentDebugType(char const*)' /usr/local/include/llvm/Support/UnicodeCharRanges.h:73: undefined reference tollvm::DebugFlag'
/usr/local/include/llvm/Support/UnicodeCharRanges.h:73: undefined reference to llvm::isCurrentDebugType(char const*)' /usr/local/include/llvm/Support/UnicodeCharRanges.h:74: undefined reference tollvm::DebugFlag'
/usr/local/include/llvm/Support/UnicodeCharRanges.h:74: undefined reference to llvm::isCurrentDebugType(char const*)' /usr/local/include/llvm/Support/UnicodeCharRanges.h:78: undefined reference tollvm::DebugFlag'
/usr/local/include/llvm/Support/UnicodeCharRanges.h:78: undefined reference to llvm::isCurrentDebugType(char const*)' /usr/local/include/llvm/Support/UnicodeCharRanges.h:79: undefined reference tollvm::DebugFlag'
/usr/local/include/llvm/Support/UnicodeCharRanges.h:79: undefined reference to llvm::isCurrentDebugType(char const*)' /usr/local/include/llvm/Support/UnicodeCharRanges.h:80: undefined reference tollvm::DebugFlag'
/usr/local/include/llvm/Support/UnicodeCharRanges.h:80: undefined reference to llvm::isCurrentDebugType(char const*)' /usr/local/include/llvm/Support/UnicodeCharRanges.h:81: undefined reference tollvm::DebugFlag'
/usr/local/include/llvm/Support/UnicodeCharRanges.h:81: undefined reference to `llvm::isCurrentDebugType(char const*)'
clang-3.6: error: linker command failed with exit code 1 (use -v to see invocation)

I updated clang/llvm to the latest 3.6 version. I can see that AnnotateHappensAfter is defined in libclang_rt.tsan-x86_64.a and I try to link this lib in manually, but I still get the same errors?? Not sure what the problem is. Any ideas?

Thanks,
Kelly

Build with external clang

I am trying to build your awesome project with a pre-installed version of clang, still 3.6 but pre-built and on the lib and include paths but I am not having any success and I am rather new to cmake.

Is there a way to get cmake to do this or is there some switch that your project can read to use a different clang without having to build it?

Unless your project modifies clang but it doesn't seem to so this should be doable and I think a good feature to have, it would keep compile times down as well.

Several libs now fail with typedefs conflicting with themselves

Hello Elie,

I have managed to get several libs to compile somewhat but I keep running into errors like this:

/usr/include/_G_config.h(21): Error: struct cpp.core.stdc.zmq._G_fpos_t conflicts with static import cpp.core.stdc.zmq._G_fpos_t at /usr/include/_G_config.h(21)
/usr/include/_G_config.h(26): Error: struct cpp.core.stdc.zmq._G_fpos64_t conflicts with static import cpp.core.stdc.zmq._G_fpos64_t at /usr/include/_G_config.h(26)
/usr/include/libio.h(369): Error: struct cpp.core.stdc.zmq._IO_cookie_io_functions_t conflicts with static import cpp.core.stdc.zmq._IO_cookie_io_functions_t at /usr/include/libio.h(369)

Other types like pthread_t, etc. don't work and the libstdc++ example for has similar errors. It seems like this is an issue that needs to be addressed fairly quickly, but I don't know why it is happening.

There was an error like this in a scintilla header and I just replaced the typedef by hand everywhere in the file, and then every part of the library that I tested would compile (at least a dozen headers). Woohoo.

Thanks,
Kelly

a C++ derived class that defines an operator hides automatic base class conversion

@Syniurge : a C++ derived class that defines an operator hides automatic base class conversion

test.h:

struct A{ int x;};

struct B : public A{
  // comment to remove error
  operator float() const;
};

main.d:

modmap (C++) "test.h";
import (C++) A;
import (C++) B;

void main(){
  B b;
  int bx=b.x;
}

compiling produces this error:
Error: template instance opCast!(A) does not match template declaration opCast(type : float)

The error goes away if we remove operator float() const;

It works if we add operator A*() {return this;} in B and change the D code to:
int bx=(cast(A*)b).x; but this is obviously not practical.

FastFlow test case

Hello Elie,

There is an issue with trying to instantiate an abstract class from the FastFlow C++ library in a D test program. If I use this simple test program:

modmap (C++) "ff/farm.hpp";
import (C++) ff.ff_node;
class Worker : ff_node {
//alias svc = cpp.ff.ff_node.ff_node.svc;
public:
override void* svc(void * task) { return task; }
}
void main() {}

I get this error:

test.d(10): Error: function test.Worker.svc does not override any function, did you mean to override 'cpp.ff.ff_node.ff_node.svc'?

You can see I tried to use an alias to get the override to work (and I tried a few other things to no avail). I tried making a cpp file and overriding in a simple class and then using that class also, bit it didn't work either.

Thanks,
Kelly

Build problem with Ubuntu 16.04

Hey Elie,

Glad to see you are back at it here. I tried to build and ran into this issue with llvm-3.9.1/clang-3.9.1 (downloaded as source and built by hand), ldc 0.17.1:

[  1%] Linking CXX static library lib/libldc.a
[ 11%] Built target LDCShared
[ 11%] Generating bin/ldc2
/usr/bin/ld: /home/wilsonk/Downloads/Calypso/build/lib/libldc.a(GarbageCollect2Stack.cpp.o): undefined reference to symbol '_ZN4llvm9CallGraph19getOrInsertFunctionEPKNS_8FunctionE'
//usr/local/lib/libLLVMipa.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/ldc2.dir/build.make:61: recipe for target 'bin/ldc2' failed
make[2]: *** [bin/ldc2] Error 1
CMakeFiles/Makefile2:141: recipe for target 'CMakeFiles/ldc2.dir/all' failed
make[1]: *** [CMakeFiles/ldc2.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

Not sure what is going on there. Any ideas?

CMake Error at runtime/CMakeLists.txt:430 (else): A duplicate ELSE command was found inside an IF block.

on ubuntu Ubuntu 16.04.2 LTS

git clone --recursive https://github.com/Syniurge/Calypso && cd Calypso
mkdir build && cd build
ccmake ..
c (configure)
 CMake Error at runtime/CMakeLists.txt:430 (else):
   A duplicate ELSE command was found inside an IF block.
 Call Stack (most recent call first):
   runtime/CMakeLists.txt:566 (build_runtime_libs)
   runtime/CMakeLists.txt:577 (build_runtime_variant)
   runtime/CMakeLists.txt:598 (build_runtime_variants)
   runtime/CMakeLists.txt:665 (build_all_runtime_variants)

Ogre3d regression

Hello Elie,

I am now getting this error with the Ogre demo:

/usr/include/boost/type_traits/type_with_alignment.hpp(128): Error: undefined identifier 'cpp' in module 'cpp.boost.detail.has_one_T'
/usr/include/boost/type_traits/type_with_alignment.hpp(128): Error: undefined identifier 'cpp' in module 'cpp.boost.detail.has_one_T'
/usr/include/boost/type_traits/type_with_alignment.hpp(130): Error: template instance __cpp_member_funcptr!(extern (C++) int(), .cpp.boost.detail.alignment_dummy.alignment_dummy) is used as a type
/usr/include/boost/type_traits/type_with_alignment.hpp(128): Error: template instance cpp.boost.detail.has_one_T.has_one_T!(__cpp_member_funcptr!(extern (C++) int(), alignment_dummy)) error instantiating

I also get these errors just before semantics:

demo.d(56): Error: function demo.DemoApplication.setupResources does not override any function, did you mean to override 'cpp.BaseApplication.BaseApplication.setupResources'?
demo.d(69): Error: function demo.DemoApplication.createScene does not override any function, did you mean to override 'cpp.BaseApplication.BaseApplication.createScene'?
demo.d(303): Error: function demo.DemoApplication.frameRenderingQueued does not override any function, did you mean to override 'cpp.BaseApplication.BaseApplication.frameRenderingQueued'?
demo.d(347): Error: function demo.DemoApplication.notifyRenderSingleObject does not override any function, did you mean to override 'cpp.Ogre.RenderObjectListener.RenderObjectListener.notifyRenderSingleObject'?

Thanks,
Kelly

compiler segfault in showcase.d

OS X 10.11.1, LLVM 3.6.2

% ../../build/bin/ldmd2 showcase.d 
In file included from calypso_cache.h:1:
./showcase.hpp:40:32: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
        int echo(int a, int b) override;
                               ^
./showcase.hpp:41:38: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
        virtual float echo2(float f) override;
                                     ^
./showcase.hpp:63:47: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
        virtual const char *hello(bool pluto) override;
                                              ^
3 warnings generated.
void* __tmp1800 = void;
 , __tmp1800 = cast(void*)this , __tmp1800 += -16L;
return (cast(DCXXclass)__tmp1800).hello(ceres);
0  ldc2                     0x00000001103f9859 llvm::sys::PrintStackTrace(__sFILE*) + 57
1  ldc2                     0x00000001103f9db6 SignalHandler(int) + 218
2  libsystem_platform.dylib 0x00007fff9712552a _sigtramp + 26
3  libsystem_platform.dylib 0x00007fbdac1b7030 _sigtramp + 352918304
4  ldc2                     0x000000010e4c1304 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 292
5  ldc2                     0x000000010de6992b cpp::LangPlugin::toDefineFunction(FuncDeclaration*) + 171
6  ldc2                     0x000000010de699ef non-virtual thunk to cpp::LangPlugin::toDefineFunction(FuncDeclaration*) + 47
7  ldc2                     0x000000010dedb130 DtoDefineFunction(FuncDeclaration*) + 1888
8  ldc2                     0x000000010dec7d45 CodegenVisitor::visit(FuncDeclaration*) + 53
9  ldc2                     0x000000010db54de1 FuncDeclaration::accept(Visitor*) + 33
10 ldc2                     0x000000010dec63f4 CodegenVisitor::visit(TemplateInstance*) + 356
11 ldc2                     0x000000010dc4dc61 TemplateInstance::accept(Visitor*) + 33
12 ldc2                     0x000000010dec5a24 Declaration_codegen(Dsymbol*) + 68
13 ldc2                     0x000000010df01534 codegenModule(IRState*, Module*, bool) + 820
14 ldc2                     0x000000010da3d47f ldc::CodeGenerator::emit(Module*) + 431
15 ldc2                     0x000000010da6d766 main + 8966
16 libdyld.dylib            0x00007fff82b0f5ad start + 1
17 libdyld.dylib            0x0000000000000003 start + 2102331991
Error: Error executing /Users/john/Git/Calypso/build/bin/ldc2: Segmentation fault: 11 (core dumped)

Random memory corruption with GCC 4.9.2 (and failure to compile the Qt5 demo)

When compiled with (Ubuntu 15.04) GCC 4.9.2, LDC + Calypso fails to compile the Qt5 demo. It turned out that sometimes a vptr gets corrupted, sometimes it's the last bytes of a Type... and I haven't been able to pinpoint when the corruption happens, because using a breakpoint and querying the values through gdb would always prevent the corruption from happening or wreaking havoc and the compilation of the Qt5 demo would terminate successfully.

None of those random issues occurred with Calypso built with Clang 3.6:

    export CC=clang
    export CXX=clang++
    cmake (...)

The corruption seems related to the recently enabled instantiation of C++ templated constructors because it's always them which get corrupted. Any idea on how to track the issue down? For now I have given up and switched to Clang, and will add a note to the README if this doesn't get fixed.

Qtdemo fails to build

Hey Elie,

I managed to build the simple Qt demo today but the more extensive demo gets part way along and dies with:

semantic3 QMetaTypeIdHelper
code      types
code      moc_
code      moc
code      qt5demo
Instruction does not dominate all uses!
  <badref> = alloca %class.QPoint, align 4
  %98 = bitcast %class.QPoint* <badref> to i64*
Instruction does not dominate all uses!
  <badref> = alloca %class.QPoint, align 4
  %100 = bitcast %class.QPoint* <badref> to i8*
Instruction does not dominate all uses!
  <badref> = alloca %class.QSize, align 4
  %107 = bitcast %class.QSize* <badref> to i64*
Instruction does not dominate all uses!
  <badref> = alloca %class.QSize, align 4
  %109 = bitcast %class.QSize* <badref> to i8*
LLVM ERROR: Broken function found, compilation aborted!

There are a few libstdc++ examples that also fail with similar 'dominates all uses' errors (possibly related?). Just thought I would let you know. Let me know if you need more info on this.

Segmentation fault while compiling Qt 5 demo

I compiled Calypso and then compiled the basic demo without problems. While trying to compile the Qt5 demo (qt5demo.d) I get the following:

semantic3 QtGui
semantic3 FunctorCall
semantic3 IndexesList
semantic3 ApplyReturnValue
semantic3 __shrink_to_fit_aux
semantic3 __alloc_swap
semantic3 __alloc_neq
semantic3 __numeric_traits_integer
semantic3 __declval_protector
semantic3 __uninitialized_default_n_1
semantic3 __copy_move_backward
semantic3 __numeric_traits_floating
semantic3 _
semantic3 _Shift
semantic3 _Mod
semantic3 _Select_uint_least_t
semantic3 __use_cache
semantic3 __numpunct_cache
semantic3 numpunct
semantic3 ExternalRefCountWithCustomDeleter
semantic3 CustomDeleter
code      qt5demo
0  libLLVM-3.9.so.1 0x00007fe9d8dfbc68 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 56
1  libLLVM-3.9.so.1 0x00007fe9d8df9dde llvm::sys::RunSignalHandlers() + 62
2  libLLVM-3.9.so.1 0x00007fe9d8df9f2c
3  libpthread.so.0  0x00007fe9db33e3e0
4  ldc2             0x0000000000bcadfe DVarValue::definedInFuncEntryBB() + 30
5  ldc2             0x0000000000c0b56f toElemDtor(Expression*) + 255
6  ldc2             0x0000000000c669b9
7  ldc2             0x0000000000c62924
8  ldc2             0x0000000000c62c9c
9  ldc2             0x0000000000c67454 Statement_toIR(Statement*, IRState*) + 52
10 ldc2             0x0000000000c6f09e DtoDefineFunction(FuncDeclaration*) + 2718
11 ldc2             0x0000000000c69e13
12 ldc2             0x0000000000c6a6fb
13 ldc2             0x0000000000c6afbe Declaration_codegen(Dsymbol*) + 62
14 ldc2             0x0000000000bd14a5 codegenModule(IRState*, Module*, bool) + 197
15 ldc2             0x0000000000a68024 ldc::CodeGenerator::emit(Module*) + 180
16 ldc2             0x0000000000a5859a main + 7914
17 libc.so.6        0x00007fe9d7b32830 __libc_start_main + 240
18 ldc2             0x0000000000a60ae9 _start + 41
Makefile:2: recipe for target 'all' failed
make: *** [all] Segmentation fault

I did follow the compile instructions in qt5demo.d.

OS: Ubuntu 16.04
LLVM: 3.9 (installed from LLVM repo)
Qt: 5.7

Changes after C++11 fixes Sept 2016

Here is a diff of a few of the comments that can be removed/changed in the libstdc++ examples since the C++11 fixes (I will try to flesh out some better example code and finish array.d, etc. soon) :

diff --git a/tests/calypso/libstdc++/bitset/bitset.d b/tests/calypso/libstdc++/bitset/bitset.d
index 4dc4aec..0336b05 100644
--- a/tests/calypso/libstdc++/bitset/bitset.d
+++ b/tests/calypso/libstdc++/bitset/bitset.d
@@ -53,14 +53,12 @@ void main()
     }
     write('\n');
     writeln("b as ulong = \t ", b.to_ulong); // '13' is correct
+    writeln("b = \t\t", b);

 // FAILURE seems like a template argument error due to enum
 //    writeln("A bit is still = ", usedColors[A]);  // false

-// FAILURE in phobos format.d
-//    writeln(b);
-
-// FAILURE on operators again
+// FAILURE on operators
 //    auto d = a&b;

 }
\ No newline at end of file
diff --git a/tests/calypso/libstdc++/deque/deque.d b/tests/calypso/libstdc++/deque/deque.d
index 28c26d7..0b62e2a 100644
--- a/tests/calypso/libstdc++/deque/deque.d
+++ b/tests/calypso/libstdc++/deque/deque.d
@@ -84,24 +84,21 @@ void main()
     dq.assign(10,5);
     auto it = new deque!(int).iterator;

-    // FAILURES
+    auto second = new deque!(int)(4, 100);

-    // Assertion `int_regs + sse_regs <= 2' failed !?!?!?
-    //it = dq5.begin();
-    // Idiomatic C++ iterator usage doesn't work yet. See list.d also
-    //for (int i=0; i < dq.size(); it++, i++)
-      //writeln(*it);
+    *it = dq5.begin();
+    for (int i=0; i < dq.size(); it++, i++)
+      writeln(*it);

+    // FAILURES
     // 'no property popFront' here
     //foreach(deq; dq3) {}

-    //auto second = new deque!(int)(4, 100);
-
     // Doesn't seem to be picking up all template decls
     //immutable int xx = 9;
     //immutable float yy = 8.1;
-    //auto dq5 = new deque!(xx, yy);
+    //auto dq6 = new deque!(xx, yy);

     // deque iterators need to work for this to work
-    // dq.insert(it, 2, 20);
+    // dq.insert(*it, 2, 20);
 }
\ No newline at end of file
diff --git a/tests/calypso/libstdc++/map/map.d b/tests/calypso/libstdc++/map/map.d
index 00c9b62..770792f 100644
--- a/tests/calypso/libstdc++/map/map.d
+++ b/tests/calypso/libstdc++/map/map.d
@@ -18,7 +18,7 @@ void main()

     immutable char a = '0';
     immutable char b = 'z';
-    m[a] = /+cppstring(+/"Sedna"/+)+/; // FIXME copy ctor instead of memcpy
+    m[a] = cppstring("Sedna");
     m[b] = "90377";

     writeln(m[b].c_str.to!string, " ", m[a].c_str.to!string);
diff --git a/tests/calypso/libstdc++/set/set.d b/tests/calypso/libstdc++/set/set.d
index 90a0440..a79f65f 100644
--- a/tests/calypso/libstdc++/set/set.d
+++ b/tests/calypso/libstdc++/set/set.d
@@ -17,15 +17,14 @@ void main()
     auto ms1 = new multiset!int;
     auto ms2 = new multiset!int;

-    multiset!(int).iterator it;
+    multiset!(int).iterator it = ms1.begin();

     int[] ints = [1,9,55,77,99,33];

-    //auto ms3 = new multiset!(int)(ints, ints.ptr+3);  // Unhandled D->Clang conversion
-    //auto ms3 = new multiset!(int)(ints, ints.ptr+3);  // non-canonical or dependent type in IR
+    auto ms3 = new multiset!(int)(ints, ints.ptr+3); //None of the overloads of '__ctor' are cal

     const int x = 7;
-    //ms21.insert(it, x);    // doesn't work, assert in dmd
+    ms1.insert(it, x);

     for (int i = 0; i < 5; i++)
         ms1.insert(i);
diff --git a/tests/calypso/libstdc++/vector/vector.d b/tests/calypso/libstdc++/vector/vector.d
index 00bf271..a3de4f5 100644
--- a/tests/calypso/libstdc++/vector/vector.d
+++ b/tests/calypso/libstdc++/vector/vector.d
@@ -53,11 +53,8 @@ void main()
         write(*it);
     writeln(*it);

-    // FAILURE
-    // classes.cpp:256: DValue* DtoCastClass(Loc&, DValue*, Type*):
-    // Assertion `to->ty == Tclass' failed.
-    //const char x = '5';
-    //write("inserting character into first vector: ");
-    //it = v.begin();
-    //v.insert(it, x);
+    const char x = '5';
+    write("inserting character into first vector: \n");
+    it = v.begin();
+    v.insert(it, x);

Qt5 demo

Hello Elie,

Spectacular job on getting far enough to get a Qt demo to work. Unfortunately I can't quite get it to build here :(

I am also getting a couple new errors in the libstdc++ tests, and the pertinent one is when compiling the 'set' example. The reason this is pertinent is that I get the exact same error with the Qt5 demo, but the example is so simple with set.d that it might be easier to track down. When compiling set.d with "ldc2 -L-lstdc++ set.d" I get this error:

.
.
.
semantic3 multiset
semantic3 allocator
semantic3 new_allocator
semantic3 less
semantic3 _Rb_tree_const_iterator
semantic3 _Rb_tree_node
semantic3 _Rb_tree_iterator
code      set
code      set
ldc2: /home/wilsonk/Downloads/llvm-3.6/llvm/tools/clang/lib/CodeGen/CGClass.cpp:1524: void clang::CodeGen::CodeGenFunction::EnterDtorCleanups(const clang::CXXDestructorDecl*, clang::CXXDtorType): Assertion `(!DD->isTrivial() || DD->hasAttr<DLLExportAttr>()) && "Should not emit dtor epilogue for non-exported trivial dtor!"' failed.
#0 0x3aeecca llvm::sys::PrintStackTrace(_IO_FILE*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x3aeecca)
#1 0x3aeef65 PrintStackTraceSignalHandler(void*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x3aeef65)
#2 0x3aedb87 SignalHandler(int) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x3aedb87)
#3 0x7f00f85fb340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x7f00f73f6cc9 gsignal /build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x7f00f73fa0d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#6 0x7f00f73efb86 __assert_fail_base /build/buildd/eglibc-2.19/assert/assert.c:92:0
#7 0x7f00f73efc32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x16789e4 clang::CodeGen::CodeGenFunction::EnterDtorCleanups(clang::CXXDestructorDecl const*, clang::CXXDtorType) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x16789e4)
#9 0x167803f clang::CodeGen::CodeGenFunction::EmitDestructorBody(clang::CodeGen::FunctionArgList&) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x167803f)
#10 0x176f470 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x176f470)
#11 0x164c966 clang::CodeGen::CodeGenModule::codegenCXXStructor(clang::CXXMethodDecl const*, clang::CodeGen::StructorType) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x164c966)
#12 0x1831dd8 (anonymous namespace)::ItaniumCXXABI::emitCXXStructor(clang::CXXMethodDecl const*, clang::CodeGen::StructorType) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x1831dd8)
#13 0x177e5c0 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x177e5c0)
#14 0x177cd96 clang::CodeGen::CodeGenModule::EmitDeferred() (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x177cd96)
#15 0x1779615 clang::CodeGen::CodeGenModule::Release() (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x1779615)
#16 0x13eb180 cpp::LangPlugin::leaveModule() (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x13eb180)
#17 0x137a3af codegenModule(Module*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x137a3af)
#18 0x137ab28 Module::genLLVMModule(llvm::LLVMContext&) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x137ab28)
#19 0x112a7a5 genModules(Array<Module*>&, std::vector<llvm::Module*, std::allocator<llvm::Module*> >&) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x112a7a5)
#20 0x112bf8c main (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x112bf8c)
#21 0x7f00f73e1ec5 __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#22 0x1100f99 _start (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x1100f99)
Aborted

And I also see that 'trivial dtor' error above when compiling the Qt5 demo (right after Calypso tries to output the code for 'allocator').

So I am not sure if you were seeing this error for set.d or qt5demo.d or not, but I am seeing it here. I don't have any extra modulemap_d files anywhere or anything...everything is the same as a few days ago when set.d worked, so I don't know what is going on.

Have you run into this before? Any ideas on how to fix it?

Thanks,
Kelly

Qt 5 simple demo compiles but fails to start

Executing qt5demo_simple fails with:

This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "".

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, xcb.

Reinstalling the application may fix this problem.
Aborted

Need binary to test

Hi! I am Suliman, who asked about help with GDAL lib. Could you build new release new binaries for Windows. I would like to test GDAL again, you said that it's shout work now, but as you know I have only basic knolages in programming.

Maybe you could example of using GDAL to Calypso examples, to get more people to be able use GDAL with D?

Qt demo issue

Hey Elie,

I am building against Qt5.5.1 downloaded straight from the Qt website (ie. not compiled by me) and I have found that the only way to get the demo to compile is with these changes:

diff --git a/tests/calypso/qt5/moc/moc_.d b/tests/calypso/qt5/moc/moc_.d
index 17f6a6a..ccb34f9 100644
--- a/tests/calypso/qt5/moc/moc_.d
+++ b/tests/calypso/qt5/moc/moc_.d
@@ -25,7 +25,8 @@ public import (C++)
     QMetaObjectPrivate,
     MetaDataFlags,
     MethodFlags,
-    QtCore : qRegisterMetaType;
+    _;
+//    QtCore : qRegisterMetaType;

 public alias QByteArrayData = QArrayData;

diff --git a/tests/calypso/qt5/moc/types.d b/tests/calypso/qt5/moc/types.d
index 3e2a0f7..0bed847 100644
--- a/tests/calypso/qt5/moc/types.d
+++ b/tests/calypso/qt5/moc/types.d
@@ -16,8 +16,8 @@ import

 public import (C++)
     QMetaType,
-    QObject,
-    QtCore : qreal;
+    QObject;
+//    QtCore : qreal;

 // Qt expects C++ type names, so we need a map of *differing* builtin types before querying QMetaType.type()
 enum string[string] DtoCXXTypeMap = [
diff --git a/tests/calypso/qt5/qt5demo.d b/tests/calypso/qt5/qt5demo.d
index 50fc224..30a7d3a 100644
--- a/tests/calypso/qt5/qt5demo.d
+++ b/tests/calypso/qt5/qt5demo.d
@@ -21,7 +21,7 @@ import core.runtime;
 import std.stdio, std.conv;

 // Main Qt imports
-import (C++) Qt.QtCore;
+//import (C++) QtCore;
 import (C++) QCoreApplication, QApplication, QString, QPushButton, QAction, QMainWindow;
 import (C++) QWidget, QTextEdit, QLineEdit, QLabel, QLayout, QGridLayout, QTextDocument;
 import (C++) QCloseEvent, QPlainTextEdit, QMenu, QToolBar, QMessageBox, QFlags;

With these changes I could get a working executable about 4 weeks ago, but now I get this error when building the demo:

qt5demo.o:(.data.rel._D7qt5demo12__ModuleInfoZ+0x18): undefined reference to `_D3moc12__ModuleInfoZ'
collect2: error: ld returned 1 exit status
Error: /usr/bin/gcc failed with status: 1

So it almost builds but is now just missing the ModuleInfo for some reason. It would be cool if we could version out that code for version 5.5.1 (and other versions downloaded directly) so that users don't have to build Qt themselves. Or perhaps I am just doing something wrong...download a different version?

Thanks,
Kelly

Strange CMake error

Hey Elie, I ran into this weird error with cmake, after yesterdays updates, when it tries to generate the ldc-druntime.dir/link.txt (and the -debug.dir/link file also).

I was getting build errors where /bin/ar kept saying 'unrecognized file format' but that wasn't the real problem, the real problem was that the link.txt file had some stray backslashes in it like this:

/usr/bin/ar cr ../lib/libdruntime-ldc-debug.a  /home/wilsonk/Downloads/Calypso/build/runtime/_\
_cpp-__cxxabiv1-__base_class_type_info.o /home/wilsonk/Downloads/Calypso/build/runtime/__cpp-_\
_cxxabiv1-__class_type_info.o /home/wilsonk/Downloads/Calypso/build/runtime/\
__cpp-__cxxabiv1-__cxa_dependent_exception.o /home/wilsonk/Downloads/Calypso/build/runtime/__c\
pp-__cxxabiv1-__cxa_eh_globals.o /home/wilsonk/Downloads/Calypso/build/runtime/\
__cpp-__cxxabiv1-__cxa_exception.o /home/wilsonk/Downloads/Calypso/build/runtime/__cpp-__cxxab\
iv1-__cxa_refcounted_exception.o /home/wilsonk/Downloads/Calypso/build/runtime/\
__cpp-__cxxabiv1-_.o /home/wilsonk/Downloads/Calypso/build/runtime/__cpp-std-_.o /home/wilsonk\
/Downloads/Calypso/build/runtime/__cpp-std-type_info.o /home/wilsonk/Downloads/Calypso/build/r\
untime/__cpp-_Unwind_Action.o /home/wilsonk/Downloads/Calypso/build/runtime/\
__cpp-_Unwind_Context.o /home/wilsonk/Downloads/Calypso/build/runtime/__cpp-_Unwind_Exception.\
o /home/wilsonk/Downloads/Calypso/build/runtime/__cpp-_Unwind_Reason_Code.o CMakeFiles/druntim\
e-ldc-debug.dir/druntime/src/core/stdc/errno.c.o

So it almost seems like there is a string copy that is failing after a certain length? Weird. I am using cmake-2.8.12.

It looks like issue #16 is back

Hello Elie,

I am getting the same issue as #16 again after yesterdays commits...or at least I think it is the same issue:

/usr/include/x86_64-linux-gnu/sys/stat.h(209): Error: function cpp.core.sys.posix.sys.stat.stat conflicts with static import cpp.core.sys.posix.sys.stat.stat at /usr/include/x86_64-linux-gnu/bits/stat.h(46)

I ran into this when testing the dlib demo I have again, but it also happened with a couple other test libs I have set up. I just thought I would let you know. The Qt demo also isn't compiling for me:

semantic3 QOpenGLDebugMessagePrivate
semantic3 QBitArray
#0 0x2494828 llvm::sys::PrintStackTrace(_IO_FILE*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x2494828)
#1 0x2495dab SignalHandler(int) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x2495dab)
#2 0x7f5134072340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#3 0x916a04 cpp::FuncDeclaration::semantic(Scope*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x916a04)
#4 0x7a04b1 TemplateInstance::tryExpandMembers(Scope*) (/home/wilsonk/Downloads/Calypso/build/bin/ldc2+0x7a04b1)
etc...

Maybe it works for you still? just wanted you make sure you knew about this stuff and that we have a record of it.

Thanks,
Kelly

Calypso won't link after ldc-0.16.1 update

Hey Elie,

I just did a pull (which went fine) and a submodule update and then tried to remake Calypso by removing the entire bulid dir and running cmake. It all compiles but it just won't link. I get dozens of undefined references when trying to link ldc2? Some examples:

deps/clang/lib/libclangLex.a(Lexer.cpp.o): In function `llvm::sys::UnicodeCharSet::rangesAreValid() const':
Lexer.cpp:(.text._ZNK4llvm3sys14UnicodeCharSet14rangesAreValidEv[_ZNK4llvm3sys14UnicodeCharSet14rangesAreValidEv]+0x6d): undefined reference to `llvm::DebugFlag'
deps/clang/lib/libclangCodeGen.a(CoverageMappingGen.cpp.o): In function `(anonymous namespace)::CounterCoverageMappingBuilder::subtractCounters(llvm::coverage::Counter, llvm::coverage::Counter)':
CoverageMappingGen.cpp:(.text._ZN12_GLOBAL__N_129CounterCoverageMappingBuilder16subtractCountersEN4llvm8coverage7CounterES3_+0x2e): undefined reference to `llvm::coverage::CounterExpressionBuilder::subtract(llvm::coverage::Counter, llvm::coverage::Counter)'
deps/clang/lib/libclangCodeGen.a(CoverageMappingGen.cpp.o): In function `(anonymous namespace)::CounterCoverageMappingBuilder::addCounters(llvm::coverage::Counter, llvm::coverage::Counter)':
CoverageMappingGen.cpp:(.text._ZN12_GLOBAL__N_129CounterCoverageMappingBuilder11addCountersEN4llvm8coverage7CounterES3_+0x2e): undefined reference to `llvm::coverage::CounterExpressionBuilder::add(llvm::coverage::Counter, llvm::coverage::Counter)'
deps/clang/lib/libclangCodeGen.a(CoverageMappingGen.cpp.o): In function `(anonymous namespace)::CounterCoverageMappingBuilder::write(llvm::raw_ostream&)':
CoverageMappingGen.cpp:(.text._ZN12_GLOBAL__N_129CounterCoverageMappingBuilder5writeERN4llvm11raw_ostreamE+0x116): undefined reference to `llvm::coverage::CoverageMappingWriter::write(llvm::raw_ostream&)'

Missing libs? I wonder how your version built? I am still on llvm-3.6.2 if that matters?

import cstddef error and compiler hangs

% cat calypsoTest.d
modmap (C++) "ql/quantlib.hpp";

import (C++) quantlib;
% ~/Git/Calypso/build/bin/ldc2 -cpp-args -std=c++11 -L-lquantlib -L-lstdc++ calypsoTest.d
In file included from calypso_cache.h:1:
In file included from /usr/local/include/ql/quantlib.hpp:4:
In file included from /usr/local/include/ql/qldefines.hpp:38:
In file included from /usr/local/include/boost/config.hpp:44:
/usr/local/include/boost/config/select_stdlib_config.hpp:18:12: fatal error: 'cstddef' file not found
#  include <cstddef>
           ^

then the compiler hangs indefinitely. OS X 10.11.1, LLVM 3.6.2

OSX: running binary produced by ldc2 crashes immediately if a `import (C++) ...` is there

FYI @Syniurge @John-Colvin @wilsonk @mardukbp
on OSX I can't make even the most basic program built by ldc2/calypso to run. Any help would be much appreciated

main.d:

modmap (C++) "util.h";
import (C++) tims._; // commenting will make things not crash
void main(){}

util.h: namespace tims{void fun();}
util.pp : namespace tims{void fun(){}}

clang++ -std=c++11 -I . -c util.cpp -o /tmp/util.cpp.o
ldc2 -of=/tmp/main -v -cpp-args=-std=c++11 -cpp-args=-I. /tmp/util.cpp.o -L-lstdc++ main.d
/tmp/main #crashes

I tried adding these but didn't help:

-defaultlib=phobos2-ldc,druntime-ldc
-cpp-verbosediags
-g
-L-lcalypso-ldc-debug
lldb /tmp/main

(lldb) r
Process 33410 launched: '/tmp/main' (x86_64)
Process 33410 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x0000000100049ffe main`_d_dso_registry + 1086
main`_d_dso_registry:
->  0x100049ffe <+1086>: ud2

main`_D2rt4util9container5array41__T5ArrayTPS2rt19sections_elf_shared3DSOZ5Array5emptyMxFNaNbNdNiNfZb:
    0x10004a000 <+0>:    cmpq   $0x0, 0x8(%rdi)
    0x10004a005 <+5>:    sete   %al
    0x10004a008 <+8>:    retq
Target 0: (main) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
  * frame #0: 0x0000000100049ffe main`_d_dso_registry + 1086
    frame #1: 0x0000000100001e20 main`ldc.register_dso + 128
    frame #2: 0x0000000100001e52 main`ldc.dso_ctor.6ℂcpp_Cpp14_Unwind_Action + 18
    frame #3: 0x000000010012da0a dyld`ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 420
    frame #4: 0x000000010012dc3a dyld`ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 40
    frame #5: 0x0000000100129170 dyld`ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 330
    frame #6: 0x00000001001282a6 dyld`ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 134
    frame #7: 0x000000010012833a dyld`ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) + 74
    frame #8: 0x0000000100119567 dyld`dyld::initializeMainExecutable() + 196
    frame #9: 0x000000010011e239 dyld`dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 7242
    frame #10: 0x00000001001183d4 dyld`dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*, unsigned long*) + 453
    frame #11: 0x00000001001181d2 dyld`_dyld_start + 54



Running with -v shows:

/usr/bin/gcc /tmp//util.cpp.o /tmp//main.o .calypso_cache/__cpp-_.o .calypso_cache/__cpp-__va_list_tag.o .calypso_cache/__cpp-__NSConstantString_tag.o -o /tmp//main -Lbuild/lib -lcalypso-ldc-debug -lphobos2-ldc -lcalypso-ldc -ldruntime-ldc -ldl -lc++ -lpthread -lm -m64

Running with -defaultlib=phobos2-ldc-shared,druntime-ldc-shared gives:

Fatal Error while loading '/tmp//main':
        The module 'test_calypso' is already defined in '/tmp//main'.

Build failure problem with CLANG_INCLUDE_DIRS

After the problem I reported in issue #23 I am still having problems building. That issue only solved the cmake execution, but when I run make, I got:

[samjnaa:~/sr/_repos/git/_dlang/calypso/build] make
...
[  8%] Building CXX object CMakeFiles/LDCShared.dir/dmd2/cpp/cppexpression.cpp.o
In file included from /home/samjnaa/sr/_repos/svn/_llvm/llvm-3.6/tools/clang/include/clang/AST/ASTTypeTraits.h:19:0,
                from /home/samjnaa/sr/_repos/svn/_llvm/llvm-3.6/tools/clang/include/clang/AST/ASTContext.h:18,
                from /home/samjnaa/sr/_repos/git/_dlang/calypso/dmd2/cpp/astunit.h:18,
                from /home/samjnaa/sr/_repos/git/_dlang/calypso/dmd2/cpp/cppexpression.cpp:3:
/home/samjnaa/sr/_repos/svn/_llvm/llvm-3.6/tools/clang/include/clang/AST/ASTFwd.h:22:35: fatal error: clang/AST/DeclNodes.inc: No such file or directory
#include "clang/AST/DeclNodes.inc"
                                ^
compilation terminated.

So I look for the required file:

[samjnaa:~/sr/_repos/git/_dlang/calypso/build] find /home/samjnaa/sr/_repos/svn/_llvm/ -name "DeclNodes.inc"
/home/samjnaa/sr/_repos/svn/_llvm/build/tools/clang/include/clang/AST/DeclNodes.inc

Then I changed the CLANG_INCLUDE_DIRS in the cmake command to use the built include dirs:

[samjnaa:~/sr/_repos/git/_dlang/calypso/build] cmake .. -DLLVM_SOURCE_PATH="/home/samjnaa/sr/_repos/svn/_llvm/llvm-3.6" -DCLANG_INCLUDE_DIRS="/home/samjnaa/sr/_repos/svn/_llvm/llvm-3.6/build/tools/clang/include"
-- LDC version identifier: cfcae2
-- Using path for Intrinsics.td: /usr/lib/llvm-3.7/include
-- Configuring done
-- Generating done
-- Build files have been written to: /home/samjnaa/sr/_repos/git/_dlang/calypso/build

But now the make is looking for a header which is in the source include dirs:

[samjnaa:~/sr/_repos/git/_dlang/calypso/build] make
...
[  8%] Building CXX object CMakeFiles/LDCShared.dir/dmd2/cpp/cppexpression.cpp.o
In file included from /home/samjnaa/sr/_repos/git/_dlang/calypso/dmd2/cpp/cppexpression.cpp:3:0:
/home/samjnaa/sr/_repos/git/_dlang/calypso/dmd2/cpp/astunit.h:18:34: fatal error: clang/AST/ASTContext.h: No such file or directory
#include "clang/AST/ASTContext.h"
                                ^
compilation terminated.
...
[samjnaa:~/sr/_repos/git/_dlang/calypso/build] find /home/samjnaa/sr/_repos/svn/_llvm/ -name "ASTContext.h"
/home/samjnaa/sr/_repos/svn/_llvm/llvm-3.6/tools/clang/include/clang/AST/ASTContext.h

Then I try to specify both, using : (colon) as the path separator on my platform:

[samjnaa:~/sr/_repos/git/_dlang/calypso/build] cmake .. -DLLVM_SOURCE_PATH="/home/samjnaa/sr/_repos/svn/_llvm/llvm-3.6" -DCLANG_INCLUDE_DIRS="/home/samjnaa/sr/_repos/svn/_llvm/llvm-3.6/build/tools/clang/include:/home/samjnaa/sr/_repos/svn/_llvm/llvm-3.6/tools/clang/include"
-- LDC version identifier: cfcae2
-- Using path for Intrinsics.td: /usr/lib/llvm-3.7/include
-- Configuring done
-- Generating done
-- Build files have been written to: /home/samjnaa/sr/_repos/git/_dlang/calypso/build

But still no fruit and I'm getting the same error. I tried using the semicolon and curiously I get the previous error. I'm not sure what else to try...

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.