I am trying to learn enough C++ so I can leverage the arrow library to write a ParquetWriter.
I can compile arrow and I can compile JlCxx, and by following the guides in arrow I can build an application that #include <arrow>
and I can build an executable by following the guide in JlCxx
.
So the next step is to compile an app with both libraries included. But I seem to have issues with JlCxx code.
I am quite new to C++ so the question probably sounds stupid, but I am the only person giving it some serious time to get a Parquet writer in Julia up and running, so your help would benefit the community if I succeed. Any help will be much appreciated including things like âu donât have enough background knowledge go read XYZâ.
Here is the issue, I have a test.cpp
file
#include "jlcxx/jlcxx.hpp"
#include <julia.h>
JULIA_DEFINE_FAST_TLS() // only define this once, in an executable (not in a shared library) if you want fast code.
int main(int argc, char *argv[])
{
/* required: setup the Julia context */
jl_init();
/* run Julia commands */
jl_eval_string("print(sqrt(2.0))");
/* strongly recommended: notify Julia that the
program is about to terminate. this allows
Julia time to cleanup pending write requests
and run all finalizers
*/
jl_atexit_hook(0);
return 0;
}
I am on Ubuntu 18.04 and Julia 1.4.1.
So I try to compile it using
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/xiaodai/git/arrow_install_path/lib:/home/xiaodai/julia-1.4.1/lib
g++ test.cpp \
-I/home/xiaodai/git/arrow_install_path/include \
-I/home/xiaodai/julia-1.4.1/include/julia \
-I/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include \
-L/home/xiaodai/git/arrow_install_path/lib \
-L/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/lib \
-L/home/xiaodai/julia-1.4.1/lib \
-lparquet -larrow -ljulia /home/xiaodai/julia-1.4.1/lib/julia/libstdc++.so.6 \
-ljlcxx \
-o test
But I get the below error, which seems to suggest there is some syntax error. Any tip on how to set this up so that I can compile this simple file successfully would be much appreciated!
In file included from /home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/array.hpp:4:0,
from /home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/jlcxx.hpp:13,
from test.cpp:1:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/type_conversion.hpp:204:43: error: expected template-name before â<â token
struct IsMirroredType : std::bool_constant<(!std::is_class<T>::value || (std::is_standard_layout<T>::value && std::is_trivial<T>::value)) && !IsSmartPointerType<T>::value>
^
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/type_conversion.hpp:204:43: error: expected â{â before â<â token
In file included from /home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/array.hpp:5:0,
from /home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/jlcxx.hpp:13,
from test.cpp:1:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/tuple.hpp: In static member function âstatic jl_datatype_t* jlcxx::julia_type_factory<std::tuple<_Tps ...>, jlcxx::TupleTrait>::julia_type()â:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/tuple.hpp:85:38: warning: fold-expressions only available with -std=c++1z or -std=gnu++1z
(create_if_not_exists<TypesT>(), ...);
^~~
In file included from /home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/jlcxx.hpp:13:0,
from test.cpp:1:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/array.hpp: In member function âValueT& jlcxx::ArrayRef<ValueT, Dim>::operator[](std::size_t)â:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/array.hpp:220:8: warning: âif constexprâ only available with -std=c++1z or -std=gnu++1z
if constexpr(std::is_same<julia_t, ValueT>::value)
^~~~~~~~~
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/array.hpp: In member function âconst ValueT& jlcxx::ArrayRef<ValueT, Dim>::operator[](std::size_t) constâ:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/array.hpp:232:8: warning: âif constexprâ only available with -std=c++1z or -std=gnu++1z
if constexpr(std::is_same<julia_t, ValueT>::value)
^~~~~~~~~
In file included from /home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/jlcxx.hpp:14:0,
from test.cpp:1:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp: In constructor âjlcxx::FunctionWrapper<R, Args>::FunctionWrapper(jlcxx::Module*, const functor_t&)â:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp:198:36: warning: fold-expressions only available with -std=c++1z or -std=gnu++1z
(create_if_not_exists<Args>(), ...);
^~~
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp: In constructor âjlcxx::FunctionPtrWrapper<R, Args>::FunctionPtrWrapper(jlcxx::Module*, R (*)(Args ...))â:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp:230:36: warning: fold-expressions only available with -std=c++1z or -std=gnu++1z
(create_if_not_exists<Args>(), ...);
^~~
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp: In member function âvoid jlcxx::detail::ForEachParameterType<F, jlcxx::ParameterList<ParametersT ...> >::operator()(F&&)â:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp:371:40: warning: fold-expressions only available with -std=c++1z or -std=gnu++1z
(f.template apply<ParametersT>(),...);
^~~
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp: At global scope:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp:494:49: error: expected template-name before â<â token
struct DefaultConstructible : std::bool_constant<std::is_default_constructible<T>::value && !std::is_abstract<T>::value>
^
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp:494:49: error: expected â{â before â<â token
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp:500:46: error: expected template-name before â<â token
struct CopyConstructible : std::bool_constant<std::is_copy_constructible<T>::value && !std::is_abstract<T>::value>
^
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp:500:46: error: expected â{â before â<â token
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp: In member function âvoid jlcxx::Module::add_copy_constructor(jl_datatype_t*)â:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp:669:8: warning: âif constexprâ only available with -std=c++1z or -std=gnu++1z
if constexpr (CopyConstructible<T>::value)
^~~~~~~~~
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp: In member function âvoid jlcxx::Module::add_default_constructor(jl_datatype_t*)â:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp:706:6: warning: âif constexprâ only available with -std=c++1z or -std=gnu++1z
if constexpr (DefaultConstructible<T>::value)
^~~~~~~~~
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp: In function âvoid jlcxx::detail::create_parameter_types(jlcxx::ParameterList<ParametersT ...>, std::index_sequence<Indices ...>)â:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp:924:55: warning: fold-expressions only available with -std=c++1z or -std=gnu++1z
(create_parameter_type<N, ParametersT,Indices>(), ...);
^~~
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp: In member function âjlcxx::TypeWrapper<T>& jlcxx::TypeWrapper<T>::constructor(bool)â:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/module.hpp:967:8: warning: âif constexprâ only available with -std=c++1z or -std=gnu++1z
if constexpr (!(DefaultConstructible<T>::value && sizeof...(ArgsT) == 0))
^~~~~~~~~
In file included from /home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/jlcxx.hpp:15:0,
from test.cpp:1:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/smart_pointers.hpp: In static member function âstatic jl_datatype_t* jlcxx::julia_type_factory<T, jlcxx::CxxWrappedTrait<jlcxx::SmartPointerTrait> >::julia_type()â:
/home/xiaodai/.julia/artifacts/b55cd96f4dd60da926644fc18aef04c69f891b7d/include/jlcxx/smart_pointers.hpp:210:8: warning: âif constexprâ only available with -std=c++1z or -std=gnu++1z
if constexpr(!std::is_same<supertype<PointeeT>, PointeeT>::value)
^~~~~~~~~