Open bfatoms opened 7 years ago
The makefile is working here on Arch Linux with GNU Make 4.2.1. Which version of make do you have?
I am using windows 10, there is a make.exe that was included in the package of dmd32...
Yeah, the DigitalMars Make will probably not work. Luckily you can compile capnpc-dlang manually, it is implemented in a single file.
The file is compiler/src/main/cpp/capnpc-dlang.c++. You need to link it to libcapnp and libkj from the Cap'n Proto C++ implementation. Look at what the makefile is doing if you need inspiration.
I tried installing mingw-msys and some of its dependencies, however this is what I get
Package capnp was not found in the pkg-config search path. Perhaps you should add the directory containing `capnp.pc' to the PKG_CONFIG_PATH environment variable No package 'capnp' found Makefile:4: "Warning: pkg-config failed to find compilation configuration for capnp." Makefile:5: "Falling back to a guess based on the location of the capnp executable."
I don't know c++, which compiler do I need to compile that file? is DMC enough or should I just install a c++ compiler? I came from php, and don't know much about makefile. I guess I need more studying before I can use this library...
Your msys+mingw should work fine. Just install C++ Cap'n Proto first. Note that the built D application will not depend on the C++ Cap'n Proto.
This is the error that I get, even if I put the capnp/schema.capnp.h to the same folder, as capnpc-dlang.c++ it doesn't see the file...
Package capnp was not found in the pkg-config search path.
Perhaps you should add the directory containing `capnp.pc'
to the PKG_CONFIG_PATH environment variable
No package 'capnp' found
Makefile:4: "Warning: pkg-config failed to find compilation configuration for capnp."
Makefile:5: "Falling back to a guess based on the location of the capnp executable."
g++ compiler/src/main/cpp/capnpc-dlang.c++ -std=c++11 -I c:/D/dmd2/windows/bin/../include -L c:/D/dmd2/windows/bin/../lib -lkj -lcapnp -g -o capnpc-dlang
compiler/src/main/cpp/capnpc-dlang.c++:26:32: fatal error: capnp/schema.capnp.h: No such file or directory
#include <capnp/schema.capnp.h>
^
compilation terminated.
make: *** [capnpc-dlang] Error 1
You can give the compiler another include directory by passing -I c:\path\to\capnp\header\files to g++. The path you give it must contain the capnp directory.
After passing -I header_path, I now get so many errors, but all of it are undefined references,
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1286): undefined reference to `capnp::SchemaLoader::SchemaLoader()'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1346): undefined reference to `kj::MainBuilder::MainBuilder(kj::ProcessContext&, kj::StringPtr, kj::StringPtr, kj::StringPtr)'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1359): undefined reference to `kj::MainBuilder::callAfterParsing(kj::Function<kj::MainBuilder::Validity ()>)'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x136b): undefined reference to `kj::MainBuilder::build()'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1378): undefined reference to `kj::MainBuilder::~MainBuilder()'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1390): undefined reference to `kj::MainBuilder::~MainBuilder()'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x13fb): undefined reference to `capnp::Schema::getProto() const'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1508): undefined reference to `capnp::SchemaLoader::get(unsigned long long, capnp::schema::Brand::Reader, capnp::Schema) const'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1527): undefined reference to `capnp::Schema::getProto() const'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1613): undefined reference to `capnp::Schema::getProto() const'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1709): undefined reference to `kj::StringTree::StringTree(kj::Array<kj::StringTree>&&, kj::StringPtr)'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x18a1): undefined reference to `kj::_::Debug::Fault::fatal()'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1952): undefined reference to `kj::_::Debug::Fault::~Fault()'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x198c): undefined reference to `capnp::Schema::getProto() const'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1a38): undefined reference to `kj::hex(unsigned long long)'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1b24): undefined reference to `capnp::Schema::getProto() const'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1b54): undefined reference to `capnp::Schema::getBrandArgumentsAtScope(unsigned long long) const'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1bbf): undefined reference to `capnp::Schema::BrandArgumentList::operator[](unsigned int) const'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1c08): undefined reference to `kj::StringTree::flatten() const'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1cde): undefined reference to `capnp::Schema::getProto() const'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1d90): undefined reference to `capnp::SchemaLoader::get(unsigned long long, capnp::schema::Brand::Reader, capnp::Schema) const'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1e00): undefined reference to `capnp::Schema::getBrandArgumentsAtScope(unsigned long long) const'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x1e55): undefined reference to `capnp::Schema::BrandArgumentList::operator[](unsigned int) const'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x2297): undefined reference to `capnp::Type::asEnum() const'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x22e6): undefined reference to `capnp::Type::asStruct() const'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x2302): undefined reference to `capnp::Schema::getProto() const'
C:\Users\foron\AppData\Local\Temp\ccOf6ICa.o:capnpc-dlang.c++:(.text+0x2469): undefined reference to `kj::StringTree::StringTree(kj::Array<kj::StringTree>&&, kj::StringPtr)'
etc....
# last line
collect2.exe: error: ld returned 1 exit status
Those symbols are a part of kj and capnp which are passed to the compiler as "-lkj -lcapnp". Does it say anything about not finding those libraries?
Here are the commands, that I write, if I add -lkj and -lcapnp this is the error, but when I remove them, I get the ones above, all of it are undefined references, but it didn't say anything about not finding them...
C:\D\capnproto-dlang\compiler\src\main\cpp>g++ capnpc-dlang.c++ -o capnpc-dlang -I C:\D\capnp\src -lkj -lcapnp
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lkj
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lcapnp
collect2.exe: error: ld returned 1 exit status
Use -L to set the path to the libkj.a and libcapnp.a libraries.
I cloned this repo, and used make, but make is spewing errors, is it broken? or is the tutorial incomplete?
Error on line 3: expecting target : dependecies
I'm really new to this, I just found capnproto-dlang while looking for alternatives to json..