Closed rgcv closed 6 years ago
Can you try adding this before the add_library
line in your CMake:
get_target_property(JlCxx_location JlCxx::cxxwrap_julia LOCATION)
get_filename_component(JlCxx_location ${JlCxx_location} DIRECTORY)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${JlCxx_location}")
Also, it should not be needed to explicitly link in the ${Julia_LIBRARY}
, it is inherited from libcxxwrap-julia. Note that I tested on VS2015, I got a different error there, but adding the RPATH command fixed it.
I figured I should clear up CMakeCache.txt and other build generated files and build from a fresh clean slate, with the addition of the appendage in the RPATH
. Unfortunately, the issue persists :disappointed:
EDIT: Removed identical log transcript for brevity's sake.
EDIT: I've managed to observe an interesting change in behaviour regarding the warnings. Sometimes, after a build, VS picks up on file changes, prompts for a reload from disk, and the warnings disappear on a successive build, leaving only the linking errors, which, sadly, are the main issue here. The log is reduced to the following excerpt:
1>------ Build started: Project: hello_world, Configuration: Release x64 ------
1> Creating library C:/Path/To/Project/Release/hello_world.lib and object C:/Path/To/Project/Release/hello_world.exp
1>hello_world.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl jlcxx::FunctionWrapperBase::~FunctionWrapperBase(void)" (__imp_??1FunctionWrapperBase@jlcxx@@UEAA@XZ) referenced in function "public: virtual void * __cdecl jlcxx::FunctionPtrWrapper<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::`scalar deleting destructor'(unsigned int)" (??_G?$FunctionPtrWrapper@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@$$V@jlcxx@@UEAAPEAXI@Z)
1>hello_world.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl jlcxx::FunctionWrapperBase::set_name(struct _jl_value_t *)" (__imp_?set_name@FunctionWrapperBase@jlcxx@@QEAAXPEAU_jl_value_t@@@Z) referenced in function define_julia_module
1>hello_world.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) protected: void __cdecl jlcxx::FunctionWrapperBase::set_pointer_indices(void)" (__imp_?set_pointer_indices@FunctionWrapperBase@jlcxx@@IEAAXXZ) referenced in function define_julia_module
1>hello_world.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl jlcxx::Module::append_function(class jlcxx::FunctionWrapperBase *)" (__imp_?append_function@Module@jlcxx@@QEAAXPEAVFunctionWrapperBase@2@@Z) referenced in function define_julia_module
1>C:\Path\To\Project\Release\hello_world.dll : fatal error LNK1120: 4 unresolved externals
1>Done building project "hello_world.vcxproj" -- FAILED.
2>------ Skipped Build: Project: INSTALL, Configuration: Release x64 ------
2>Project not selected to build for this solution configuration
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 1 skipped ==========
Just to be sure: could you post the full CMake configure stage output? You are building against a libcxxwrap-julia that is built using MSVC too, right?
cmake_minimum_required(VERSION 2.8.12)
project(hello_world)
include(.env.cmake) # sets JlCxx_DIR
find_package(JlCxx)
get_target_property(JlCxx_location JlCxx::cxxwrap_julia LOCATION)
get_filename_component(JlCxx_location ${JlCxx_location} DIRECTORY)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${JlCxx_location}")
add_library(hello_world SHARED src/hello_world.cpp)
target_link_libraries(hello_world JlCxx::cxxwrap_julia)
install(TARGETS
hello_world
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION lib)
I'm assuming as much, yes. The libcxxwrap-julia bins I'm using were installed with CxxWrap when I added the package, which I assume compiles the lib upon addition using the target machine's compiler toolchain (in case of Windows, MSVC).
Aha, no, it doesn't in fact, standard behavior now is to download the cross-compiled (mingw) binaries. This explains all your trouble. The best way forward is to compile libcxxwrap-julia from source, set the JLCXX_DIR
environment variable in Julia to the build directory (the dir containing the JlCxxConfig.cmake file) and then Pkg.build CxxWrap again.
That.. does make sense, woops.. I'm guessing CxxWrap's README should include a note then, maybe? Warning not to develop the wrapper code using the libs and includes that come bundled with it when using Visual Studio, I suppose. Maybe, might be wrong on that one.
Definitely good to know the best way for developing wrapper code going forward :+1:
Issue's been resolved, I'll be closing this now. Thanks for the support! :smiley:
@barche Thank you from pointing me from JuliaInterop/CxxWrap.jl#29 According to your advice I'm trying to compile the libcxxwrap-julia library using cmake with MSVC2017 toolchain. I think I see a linker mismatch between the julia libraries (1.1.0 official binary win64 installer) that use the C calling convention with exported function names, e.g. jl_get_ptls_states
but the linker looks for a function decorated as __imp__jl_get_ptls_states
. Is there something at the side of cmake that fixes this issue?
cmake output:
Found Julia executable: C:/Users/petr.hlavenka/AppData/Local/Julia-1.1.0/bin/julia.exe
Julia_VERSION_STRING: 1.1.0
Julia_INCLUDE_DIRS: C:\\Users\\petr.hlavenka\\AppData\\Local\\Julia-1.1.0\\include\\julia
Julia_LIBRARY_DIR: C:\\Users\\petr.hlavenka\\AppData\\Local\\Julia-1.1.0\\bin
Julia_LIBRARY: C:/Users/petr.hlavenka/AppData/Local/Julia-1.1.0/lib/libjulia.dll.a
JULIA_HOME: C:\\Users\\petr.hlavenka\\AppData\\Local\\Julia-1.1.0\\bin
Julia_LLVM_VERSION: v6.0.1
Julia_WORD_SIZE: 64
JlCxx version: v0.5.3
Configuring done
Generating done
Compilation output:
1>------ Rebuild All started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
1>Checking Build System
1>CMake does not need to re-run because C:/Users/petr.hlavenka/source/repos/libcxxwrap-julia/build/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/petr.hlavenka/source/repos/libcxxwrap-julia/build/examples/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/petr.hlavenka/source/repos/libcxxwrap-julia/build/test/CMakeFiles/generate.stamp is up-to-date.
2>------ Rebuild All started: Project: cxxwrap_julia, Configuration: Debug Win32 ------
2>Building Custom Rule C:/Users/petr.hlavenka/source/repos/libcxxwrap-julia/CMakeLists.txt
2>CMake does not need to re-run because C:/Users/petr.hlavenka/source/repos/libcxxwrap-julia/build/CMakeFiles/generate.stamp is up-to-date.
2>c_interface.cpp
2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\ucrt\signal.h(22): warning C4005: 'NSIG': macro redefinition
2>c:\users\petr.hlavenka\appdata\local\julia-1.1.0\include\julia\uv/win.h(67): note: see previous definition of 'NSIG'
2>C:\Users\petr.hlavenka\AppData\Local\Julia-1.1.0\include\julia\julia.h(892): warning C4146: unary minus operator applied to unsigned type, result still unsigned
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(585): warning C4251: 'jlcxx::Module::m_pointer_array': class 'jlcxx::ArrayRef<void *,1>' needs to have dll-interface to be used by clients of class 'jlcxx::Module'
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(585): note: see declaration of 'jlcxx::ArrayRef<void *,1>'
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(586): warning C4251: 'jlcxx::Module::m_functions': class 'std::vector<std::shared_ptr<jlcxx::FunctionWrapperBase>,std::allocator<_Ty>>' needs to have dll-interface to be used by clients of class 'jlcxx::Module'
2> with
2> [
2> _Ty=std::shared_ptr<jlcxx::FunctionWrapperBase>
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(586): note: see declaration of 'std::vector<std::shared_ptr<jlcxx::FunctionWrapperBase>,std::allocator<_Ty>>'
2> with
2> [
2> _Ty=std::shared_ptr<jlcxx::FunctionWrapperBase>
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(587): warning C4251: 'jlcxx::Module::m_jl_constants': class 'std::map<std::string,jl_value_t *,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>' needs to have dll-interface to be used by clients of class 'jlcxx::Module'
2> with
2> [
2> _Kty=std::string,
2> _Ty=jl_value_t *
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(587): note: see declaration of 'std::map<std::string,jl_value_t *,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>'
2> with
2> [
2> _Kty=std::string,
2> _Ty=jl_value_t *
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(588): warning C4251: 'jlcxx::Module::m_reference_types': class 'std::vector<jl_datatype_t *,std::allocator<_Ty>>' needs to have dll-interface to be used by clients of class 'jlcxx::Module'
2> with
2> [
2> _Ty=jl_datatype_t *
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(85): note: see declaration of 'std::vector<jl_datatype_t *,std::allocator<_Ty>>'
2> with
2> [
2> _Ty=jl_datatype_t *
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(589): warning C4251: 'jlcxx::Module::m_allocated_types': class 'std::vector<jl_datatype_t *,std::allocator<_Ty>>' needs to have dll-interface to be used by clients of class 'jlcxx::Module'
2> with
2> [
2> _Ty=jl_datatype_t *
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(85): note: see declaration of 'std::vector<jl_datatype_t *,std::allocator<_Ty>>'
2> with
2> [
2> _Ty=jl_datatype_t *
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(1105): warning C4251: 'jlcxx::ModuleRegistry::m_modules': class 'std::map<jl_module_t *,std::shared_ptr<jlcxx::Module>,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>' needs to have dll-interface to be used by clients of class 'jlcxx::ModuleRegistry'
2> with
2> [
2> _Kty=jl_module_t *,
2> _Ty=std::shared_ptr<jlcxx::Module>
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(1105): note: see declaration of 'std::map<jl_module_t *,std::shared_ptr<jlcxx::Module>,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>'
2> with
2> [
2> _Kty=jl_module_t *,
2> _Ty=std::shared_ptr<jlcxx::Module>
2> ]
2>C:\Users\petr.hlavenka\source\repos\libcxxwrap-julia\src\c_interface.cpp(17): warning C4297: 'initialize': function assumed not to throw an exception but does
2>C:\Users\petr.hlavenka\source\repos\libcxxwrap-julia\src\c_interface.cpp(17): note: The function is extern "C" and /EHc was specified
2>jlcxx.cpp
2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\ucrt\signal.h(22): warning C4005: 'NSIG': macro redefinition
2>c:\users\petr.hlavenka\appdata\local\julia-1.1.0\include\julia\uv/win.h(67): note: see previous definition of 'NSIG'
2>C:\Users\petr.hlavenka\AppData\Local\Julia-1.1.0\include\julia\julia.h(892): warning C4146: unary minus operator applied to unsigned type, result still unsigned
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(585): warning C4251: 'jlcxx::Module::m_pointer_array': class 'jlcxx::ArrayRef<void *,1>' needs to have dll-interface to be used by clients of class 'jlcxx::Module'
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(585): note: see declaration of 'jlcxx::ArrayRef<void *,1>'
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(586): warning C4251: 'jlcxx::Module::m_functions': class 'std::vector<std::shared_ptr<jlcxx::FunctionWrapperBase>,std::allocator<_Ty>>' needs to have dll-interface to be used by clients of class 'jlcxx::Module'
2> with
2> [
2> _Ty=std::shared_ptr<jlcxx::FunctionWrapperBase>
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(586): note: see declaration of 'std::vector<std::shared_ptr<jlcxx::FunctionWrapperBase>,std::allocator<_Ty>>'
2> with
2> [
2> _Ty=std::shared_ptr<jlcxx::FunctionWrapperBase>
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(587): warning C4251: 'jlcxx::Module::m_jl_constants': class 'std::map<std::string,jl_value_t *,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>' needs to have dll-interface to be used by clients of class 'jlcxx::Module'
2> with
2> [
2> _Kty=std::string,
2> _Ty=jl_value_t *
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(587): note: see declaration of 'std::map<std::string,jl_value_t *,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>'
2> with
2> [
2> _Kty=std::string,
2> _Ty=jl_value_t *
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(588): warning C4251: 'jlcxx::Module::m_reference_types': class 'std::vector<jl_datatype_t *,std::allocator<_Ty>>' needs to have dll-interface to be used by clients of class 'jlcxx::Module'
2> with
2> [
2> _Ty=jl_datatype_t *
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(85): note: see declaration of 'std::vector<jl_datatype_t *,std::allocator<_Ty>>'
2> with
2> [
2> _Ty=jl_datatype_t *
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(589): warning C4251: 'jlcxx::Module::m_allocated_types': class 'std::vector<jl_datatype_t *,std::allocator<_Ty>>' needs to have dll-interface to be used by clients of class 'jlcxx::Module'
2> with
2> [
2> _Ty=jl_datatype_t *
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(85): note: see declaration of 'std::vector<jl_datatype_t *,std::allocator<_Ty>>'
2> with
2> [
2> _Ty=jl_datatype_t *
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(1105): warning C4251: 'jlcxx::ModuleRegistry::m_modules': class 'std::map<jl_module_t *,std::shared_ptr<jlcxx::Module>,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>' needs to have dll-interface to be used by clients of class 'jlcxx::ModuleRegistry'
2> with
2> [
2> _Kty=jl_module_t *,
2> _Ty=std::shared_ptr<jlcxx::Module>
2> ]
2>c:\users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx\module.hpp(1105): note: see declaration of 'std::map<jl_module_t *,std::shared_ptr<jlcxx::Module>,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>'
2> with
2> [
2> _Kty=jl_module_t *,
2> _Ty=std::shared_ptr<jlcxx::Module>
2> ]
2>functions.cpp
2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\ucrt\signal.h(22): warning C4005: 'NSIG': macro redefinition
2>c:\users\petr.hlavenka\appdata\local\julia-1.1.0\include\julia\uv/win.h(67): note: see previous definition of 'NSIG'
2>C:\Users\petr.hlavenka\AppData\Local\Julia-1.1.0\include\julia\julia.h(892): warning C4146: unary minus operator applied to unsigned type, result still unsigned
2>C:\Users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx/module.hpp(585): warning C4251: 'jlcxx::Module::m_pointer_array': class 'jlcxx::ArrayRef<void *,1>' needs to have dll-interface to be used by clients of class 'jlcxx::Module'
2>C:\Users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx/module.hpp(585): note: see declaration of 'jlcxx::ArrayRef<void *,1>'
2>C:\Users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx/module.hpp(586): warning C4251: 'jlcxx::Module::m_functions': class 'std::vector<std::shared_ptr<jlcxx::FunctionWrapperBase>,std::allocator<_Ty>>' needs to have dll-interface to be used by clients of class 'jlcxx::Module'
2> with
2> [
2> _Ty=std::shared_ptr<jlcxx::FunctionWrapperBase>
2> ]
2>C:\Users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx/module.hpp(586): note: see declaration of 'std::vector<std::shared_ptr<jlcxx::FunctionWrapperBase>,std::allocator<_Ty>>'
2> with
2> [
2> _Ty=std::shared_ptr<jlcxx::FunctionWrapperBase>
2> ]
2>C:\Users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx/module.hpp(587): warning C4251: 'jlcxx::Module::m_jl_constants': class 'std::map<std::string,jl_value_t *,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>' needs to have dll-interface to be used by clients of class 'jlcxx::Module'
2> with
2> [
2> _Kty=std::string,
2> _Ty=jl_value_t *
2> ]
2>C:\Users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx/module.hpp(587): note: see declaration of 'std::map<std::string,jl_value_t *,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>'
2> with
2> [
2> _Kty=std::string,
2> _Ty=jl_value_t *
2> ]
2>C:\Users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx/module.hpp(588): warning C4251: 'jlcxx::Module::m_reference_types': class 'std::vector<jl_datatype_t *,std::allocator<_Ty>>' needs to have dll-interface to be used by clients of class 'jlcxx::Module'
2> with
2> [
2> _Ty=jl_datatype_t *
2> ]
2>C:\Users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx/functions.hpp(146): note: see declaration of 'std::vector<jl_datatype_t *,std::allocator<_Ty>>'
2> with
2> [
2> _Ty=jl_datatype_t *
2> ]
2>C:\Users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx/module.hpp(589): warning C4251: 'jlcxx::Module::m_allocated_types': class 'std::vector<jl_datatype_t *,std::allocator<_Ty>>' needs to have dll-interface to be used by clients of class 'jlcxx::Module'
2> with
2> [
2> _Ty=jl_datatype_t *
2> ]
2>C:\Users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx/functions.hpp(146): note: see declaration of 'std::vector<jl_datatype_t *,std::allocator<_Ty>>'
2> with
2> [
2> _Ty=jl_datatype_t *
2> ]
2>C:\Users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx/module.hpp(1105): warning C4251: 'jlcxx::ModuleRegistry::m_modules': class 'std::map<jl_module_t *,std::shared_ptr<jlcxx::Module>,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>' needs to have dll-interface to be used by clients of class 'jlcxx::ModuleRegistry'
2> with
2> [
2> _Kty=jl_module_t *,
2> _Ty=std::shared_ptr<jlcxx::Module>
2> ]
2>C:\Users\petr.hlavenka\source\repos\libcxxwrap-julia\include\jlcxx/module.hpp(1105): note: see declaration of 'std::map<jl_module_t *,std::shared_ptr<jlcxx::Module>,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>'
2> with
2> [
2> _Kty=jl_module_t *,
2> _Ty=std::shared_ptr<jlcxx::Module>
2> ]
2>Generating Code...
2> Creating library C:/Users/petr.hlavenka/source/repos/libcxxwrap-julia/build/Debug/cxxwrap_julia.lib and object C:/Users/petr.hlavenka/source/repos/libcxxwrap-julia/build/Debug/cxxwrap_julia.exp
2>c_interface.obj : error LNK2019: unresolved external symbol __imp__jl_get_ptls_states referenced in function __catch$_register_julia_module$0
2>jlcxx.obj : error LNK2001: unresolved external symbol __imp__jl_get_ptls_states
2>c_interface.obj : error LNK2019: unresolved external symbol __imp__jl_new_struct referenced in function "public: void __thiscall <lambda_fe7ccfb74fc10f03cc5120c6aa54d4ad>::operator()(class jlcxx::FunctionWrapperBase &)const " (??R<lambda_fe7ccfb74fc10f03cc5120c6aa54d4ad>@@QBEXAAVFunctionWrapperBase@jlcxx@@@Z)
2>c_interface.obj : error LNK2019: unresolved external symbol __imp__jl_box_int32 referenced in function "struct _jl_value_t * __cdecl jlcxx::box<int>(int const &)" (??$box@H@jlcxx@@YAPAU_jl_value_t@@ABH@Z)
2>jlcxx.obj : error LNK2001: unresolved external symbol __imp__jl_box_int32
2>c_interface.obj : error LNK2019: unresolved external symbol __imp__jl_alloc_array_1d referenced in function "public: __thiscall jlcxx::Array<struct _jl_datatype_t *>::Array<struct _jl_datatype_t *>(unsigned int)" (??0?$Array@PAU_jl_datatype_t@@@jlcxx@@QAE@I@Z)
2>c_interface.obj : error LNK2019: unresolved external symbol __imp__jl_arrayset referenced in function "public: void __thiscall jlcxx::Array<struct _jl_datatype_t *>::push_back(struct _jl_datatype_t * const &)" (?push_back@?$Array@PAU_jl_datatype_t@@@jlcxx@@QAEXABQAU_jl_datatype_t@@@Z)
2>jlcxx.obj : error LNK2001: unresolved external symbol __imp__jl_arrayset
2>c_interface.obj : error LNK2019: unresolved external symbol __imp__jl_array_grow_end referenced in function "public: void __thiscall jlcxx::Array<struct _jl_datatype_t *>::push_back(struct _jl_datatype_t * const &)" (?push_back@?$Array@PAU_jl_datatype_t@@@jlcxx@@QAEXABQAU_jl_datatype_t@@@Z)
2>jlcxx.obj : error LNK2001: unresolved external symbol __imp__jl_array_grow_end
2>c_interface.obj : error LNK2019: unresolved external symbol __imp__jl_apply_array_type referenced in function "struct _jl_value_t * __cdecl jlcxx::apply_array_type<struct _jl_datatype_t>(struct _jl_datatype_t *,unsigned int)" (??$apply_array_type@U_jl_datatype_t@@@jlcxx@@YAPAU_jl_value_t@@PAU_jl_datatype_t@@I@Z)
2>c_interface.obj : error LNK2019: unresolved external symbol __imp__jl_error referenced in function __catch$_register_julia_module$0
2>c_interface.obj : error LNK2001: unresolved external symbol __imp__jl_datatype_type
2>jlcxx.obj : error LNK2001: unresolved external symbol __imp__jl_datatype_type
2>functions.obj : error LNK2001: unresolved external symbol __imp__jl_datatype_type
2>c_interface.obj : error LNK2001: unresolved external symbol __imp__jl_any_type
2>jlcxx.obj : error LNK2019: unresolved external symbol __imp__jl_typename_str referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl jlcxx::julia_type_name(struct _jl_value_t *)" (?julia_type_name@jlcxx@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAU_jl_value_t@@@Z)
2>jlcxx.obj : error LNK2019: unresolved external symbol __imp__jl_apply_type referenced in function "struct _jl_value_t * __cdecl jlcxx::apply_type(struct _jl_value_t *,struct jl_svec_t *)" (?apply_type@jlcxx@@YAPAU_jl_value_t@@PAU2@PAUjl_svec_t@@@Z)
2>jlcxx.obj : error LNK2019: unresolved external symbol __imp__jl_new_datatype referenced in function "struct _jl_datatype_t * __cdecl jlcxx::new_datatype(struct _jl_sym_t *,struct _jl_module_t *,struct _jl_datatype_t *,struct jl_svec_t *,struct jl_svec_t *,struct jl_svec_t *,int,int,int)" (?new_datatype@jlcxx@@YAPAU_jl_datatype_t@@PAU_jl_sym_t@@PAU_jl_module_t@@PAU2@PAUjl_svec_t@@33HHH@Z)
2>jlcxx.obj : error LNK2019: unresolved external symbol __imp__jl_new_primitivetype referenced in function "struct _jl_datatype_t * __cdecl jlcxx::new_bitstype(struct _jl_sym_t *,struct _jl_module_t *,struct _jl_datatype_t *,struct jl_svec_t *,unsigned int)" (?new_bitstype@jlcxx@@YAPAU_jl_datatype_t@@PAU_jl_sym_t@@PAU_jl_module_t@@PAU2@PAUjl_svec_t@@I@Z)
2>jlcxx.obj : error LNK2019: unresolved external symbol __imp__jl_new_bits referenced in function "struct _jl_value_t * __cdecl jlcxx::box<wchar_t const >(wchar_t const * const &)" (??$box@$$CB_W@jlcxx@@YAPAU_jl_value_t@@ABQB_W@Z)
2>jlcxx.obj : error LNK2019: unresolved external symbol __imp__jl_svec1 referenced in function "public: static struct _jl_datatype_t * __cdecl jlcxx::static_type_mapping<wchar_t *,void>::julia_type(void)" (?julia_type@?$static_type_mapping@PA_WX@jlcxx@@SAPAU_jl_datatype_t@@XZ)
2>jlcxx.obj : error LNK2019: unresolved external symbol __imp__jl_symbol referenced in function _jl_get_function
2>functions.obj : error LNK2001: unresolved external symbol __imp__jl_symbol
2>jlcxx.obj : error LNK2019: unresolved external symbol __imp__jl_get_global referenced in function _jl_get_function
2>functions.obj : error LNK2001: unresolved external symbol __imp__jl_get_global
2>jlcxx.obj : error LNK2019: unresolved external symbol __imp__jl_set_const referenced in function "public: void __thiscall jlcxx::Module::bind_constants(struct _jl_module_t *)" (?bind_constants@Module@jlcxx@@QAEXPAU_jl_module_t@@@Z)
2>jlcxx.obj : error LNK2019: unresolved external symbol __imp__jl_exception_occurred referenced in function "public: struct _jl_value_t * __thiscall jlcxx::JuliaFunction::operator()<struct _jl_value_t * &>(struct _jl_value_t * &)const " (??$?RAAPAU_jl_value_t@@@JuliaFunction@jlcxx@@QBEPAU_jl_value_t@@AAPAU2@@Z)
2>jlcxx.obj : error LNK2019: unresolved external symbol __imp__jl_call referenced in function "public: struct _jl_value_t * __thiscall jlcxx::JuliaFunction::operator()<struct _jl_value_t * &>(struct _jl_value_t * &)const " (??$?RAAPAU_jl_value_t@@@JuliaFunction@jlcxx@@QBEPAU_jl_value_t@@AAPAU2@@Z)
2>jlcxx.obj : error LNK2019: unresolved external symbol __imp__jl_call2 referenced in function "public: struct _jl_value_t * __thiscall jlcxx::JuliaFunction::operator()<struct _jl_value_t * &>(struct _jl_value_t * &)const " (??$?RAAPAU_jl_value_t@@@JuliaFunction@jlcxx@@QBEPAU_jl_value_t@@AAPAU2@@Z)
2>jlcxx.obj : error LNK2019: unresolved external symbol __imp__jl_printf referenced in function "public: struct _jl_value_t * __thiscall jlcxx::JuliaFunction::operator()<struct _jl_value_t * &>(struct _jl_value_t * &)const " (??$?RAAPAU_jl_value_t@@@JuliaFunction@jlcxx@@QBEPAU_jl_value_t@@AAPAU2@@Z)
2>jlcxx.obj : error LNK2019: unresolved external symbol __imp__jl_stderr_stream referenced in function "public: struct _jl_value_t * __thiscall jlcxx::JuliaFunction::operator()<struct _jl_value_t * &>(struct _jl_value_t * &)const " (??$?RAAPAU_jl_value_t@@@JuliaFunction@jlcxx@@QBEPAU_jl_value_t@@AAPAU2@@Z)
2>jlcxx.obj : error LNK2019: unresolved external symbol __imp__jl_stderr_obj referenced in function "public: struct _jl_value_t * __thiscall jlcxx::JuliaFunction::operator()<struct _jl_value_t * &>(struct _jl_value_t * &)const " (??$?RAAPAU_jl_value_t@@@JuliaFunction@jlcxx@@QBEPAU_jl_value_t@@AAPAU2@@Z)
2>jlcxx.obj : error LNK2019: unresolved external symbol __imp__jlbacktrace referenced in function "public: struct _jl_value_t * __thiscall jlcxx::JuliaFunction::operator()<struct _jl_value_t * &>(struct _jl_value_t * &)const " (??$?RAAPAU_jl_value_t@@@JuliaFunction@jlcxx@@QBEPAU_jl_value_t@@AAPAU2@@Z)
2>jlcxx.obj : error LNK2001: unresolved external symbol __imp__jl_unionall_type
2>jlcxx.obj : error LNK2001: unresolved external symbol __imp__jl_voidpointer_type
2>jlcxx.obj : error LNK2001: unresolved external symbol __imp__jl_pointer_type
2>jlcxx.obj : error LNK2001: unresolved external symbol __imp__jl_main_module
2>functions.obj : error LNK2001: unresolved external symbol __imp__jl_main_module
2>jlcxx.obj : error LNK2001: unresolved external symbol __imp__jl_base_module
2>jlcxx.obj : error LNK2001: unresolved external symbol __imp__jl_top_module
2>C:\Users\petr.hlavenka\AppData\Local\Julia-1.1.0\lib\libjulia.dll.a : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
2>C:\Users\petr.hlavenka\source\repos\libcxxwrap-julia\build\Debug\cxxwrap_julia.dll : fatal error LNK1120: 32 unresolved externals
2>Done building project "cxxwrap_julia.vcxproj" -- FAILED.
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
@phlavenk I have updated the build instructions for MSVC on the main libcxxwrap readme, though it is only tested on MSVC2019, probably C++17 support is too limited on MSVC2017 to compile the lates version.
@barche you are the king! And I'm also amazed by the MSVC2019 integration of cmake - finally it is super easy to compile cmake-made code. Thank you again for this great work.
Thanks, glad to hear it's working :)
I've managed to generate a Visual Studio solution through cmake via
cmake -G "Visual Studio 15 2017 Win64
, which worked apparently seamlessly. My objective was to produce adll
out of the hello world example in the readme, i.e., Boost's hello world.However, once I try to build the project, linking errors start to pop up, along with some warnings mentioning some declarations "need(s) to have a dll-interface to be used by" some class.
Here's my CMakeLists.txt
Build output in VS15 2017
I'm not really sure what to do, I'm new to building DLLs, meaning I know nearly nothing about it. I've tried setting up a solution manually as well with no success found there. Hoping I'm just doing something silly and this actually has a dead obvious solution.
Also, my end goal, which might seem obvious, would be to have a codebase for the wrapper and be able to generate both shared objects and DLLs. Ultimately, if I could eventually get there, create a single shared library that would be generated and used upon package installation/compilation, for example. But that's another issue altogether.