Skip to content

Linker errors during Julia bindings #7644

@songkomkrit

Description

@songkomkrit

I attempted to build Z3 in release mode using CMake and NMake on Windows. Everything seemed successful during build except Julia bindings. The following linker errors LNK2001 and LNK1120 regarding unresolved external symbols occurred.

[ 98%] Linking CXX shared library ..\..\..\z3jl.dll
LINK: command "C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1443~1.348\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\z3jl.dir\objects1.rsp /out:..\..\..\z3jl.dll /implib:..\..\..\z3jl.lib /pdb:E:\Objdir\Windows\z3\cmake\z3jl.pdb /dll /version:0.0 /machine:x64 /SUBSYSTEM:WINDOWS /RELEASE /INCREMENTAL:NO /LTCG /GUARD:CF C:\Dev\julia\artifacts\5016ccec96368c99a5a678ab3319d1da7bb9a2c7\lib\libcxxwrap_julia.dll.a ..\..\..\libz3.lib C:\Binaries\julia\juliaup\julia-1.11.5+0.x64.w64.mingw32\lib\libjulia.dll.a kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST:EMBED,ID=2" failed (exit code 1120) with the following output:
   Creating library ..\..\..\z3jl.lib and object ..\..\..\z3jl.exp
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) struct jlcxx::CachedDatatype & __cdecl jlcxx::jlcxx_type(class std::type_index)" (__imp_?jlcxx_type@jlcxx@@YAAEAUCachedDatatype@1@Vtype_index@std@@@Z)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: struct _jl_value_t * __cdecl jlcxx::Module::get_constant(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?get_constant@Module@jlcxx@@AEAAPEAU_jl_value_t@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: void __cdecl jlcxx::Module::set_constant(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct _jl_value_t *)" (__imp_?set_constant@Module@jlcxx@@AEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAU_jl_value_t@@@Z)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) struct jlcxx::CachedDatatype & __cdecl jlcxx::jlcxx_constreftype(class std::type_index)" (__imp_?jlcxx_constreftype@jlcxx@@YAAEAUCachedDatatype@1@Vtype_index@std@@@Z)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl jlcxx::protect_from_gc(struct _jl_value_t *)" (__imp_?protect_from_gc@jlcxx@@YAXPEAU_jl_value_t@@@Z)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) struct jlcxx::CachedDatatype & __cdecl jlcxx::jlcxx_reftype(class std::type_index)" (__imp_?jlcxx_reftype@jlcxx@@YAAEAUCachedDatatype@1@Vtype_index@std@@@Z)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) 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 __int64)" (__imp_?new_bitstype@jlcxx@@YAPEAU_jl_datatype_t@@PEAU_jl_sym_t@@PEAU_jl_module_t@@PEAU2@PEAUjl_svec_t@@_K@Z)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) struct _jl_value_t * __cdecl jlcxx::julia_type(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?julia_type@jlcxx@@YAPEAU_jl_value_t@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) 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)" (__imp_?new_datatype@jlcxx@@YAPEAU_jl_datatype_t@@PEAU_jl_sym_t@@PEAU_jl_module_t@@PEAU2@PEAUjl_svec_t@@33HHH@Z)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl jlcxx::FunctionWrapperBase::FunctionWrapperBase(class jlcxx::Module *,struct std::pair<struct _jl_datatype_t *,struct _jl_datatype_t *>)" (__imp_??0FunctionWrapperBase@jlcxx@@QEAA@PEAVModule@1@U?$pair@PEAU_jl_datatype_t@@PEAU1@@std@@@Z)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) struct _jl_value_t * __cdecl jlcxx::apply_type(struct _jl_value_t *,struct jl_svec_t *)" (__imp_?apply_type@jlcxx@@YAPEAU_jl_value_t@@PEAU2@PEAUjl_svec_t@@@Z)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) struct _jl_datatype_t * __cdecl jlcxx::apply_type(struct _jl_value_t *,struct _jl_datatype_t *)" (__imp_?apply_type@jlcxx@@YAPEAU_jl_datatype_t@@PEAU_jl_value_t@@PEAU2@@Z)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl jlcxx::Module::unset_override_module(void)" (__imp_?unset_override_module@Module@jlcxx@@QEAAXXZ)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl jlcxx::Module::set_override_module(struct _jl_module_t *)" (__imp_?set_override_module@Module@jlcxx@@QEAAXPEAU_jl_module_t@@@Z)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl jlcxx::Module::register_type(struct _jl_datatype_t *)" (__imp_?register_type@Module@jlcxx@@QEAAXPEAU_jl_datatype_t@@@Z)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl jlcxx::Module::append_function(class jlcxx::FunctionWrapperBase *)" (__imp_?append_function@Module@jlcxx@@QEAAXPEAVFunctionWrapperBase@2@@Z)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl jlcxx::FunctionWrapperBase::set_extra_argument_data(class std::vector<struct jlcxx::detail::BasicArg<0>,class std::allocator<struct jlcxx::detail::BasicArg<0> > > &&,class std::vector<struct jlcxx::detail::BasicArg<1>,class std::allocator<struct jlcxx::detail::BasicArg<1> > > &&)" (__imp_?set_extra_argument_data@FunctionWrapperBase@jlcxx@@QEAAX$$QEAV?$vector@U?$BasicArg@$0A@@detail@jlcxx@@V?$allocator@U?$BasicArg@$0A@@detail@jlcxx@@@std@@@std@@$$QEAV?$vector@U?$BasicArg@$00@detail@jlcxx@@V?$allocator@U?$BasicArg@$00@detail@jlcxx@@@std@@@4@@Z)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl jlcxx::FunctionWrapperBase::set_doc(struct _jl_value_t *)" (__imp_?set_doc@FunctionWrapperBase@jlcxx@@QEAAXPEAU_jl_value_t@@@Z)
z3jl.cpp.obj : error LNK2001: 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)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl jlcxx::FunctionWrapperBase::~FunctionWrapperBase(void)" (__imp_??1FunctionWrapperBase@jlcxx@@UEAA@XZ)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct _jl_datatype_t * __cdecl jlcxx::CachedDatatype::get_dt(void)" (__imp_?get_dt@CachedDatatype@jlcxx@@QEAAPEAU_jl_datatype_t@@XZ)
z3jl.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl jlcxx::CachedDatatype::set_dt(struct _jl_datatype_t *,bool)" (__imp_?set_dt@CachedDatatype@jlcxx@@QEAAXPEAU_jl_datatype_t@@_N@Z)
..\..\..\z3jl.dll : fatal error LNK1120: 22 unresolved externals
NMAKE : fatal error U1077: 'C:\Binaries\cmake-4.0.2\bin\cmake.exe -E vs_link_dll --msvc-ver=1943 --intdir=CMakeFiles\z3jl.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x64\mt.exe --manifests -- C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1443~1.348\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\z3jl.dir\objects1.rsp @C:\Users\songk\AppData\Local\Temp\nm7A66.tmp' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\HostX64\x64\nmake.exe" -s -f src\api\julia\CMakeFiles\z3jl.dir\build.make /nologo -SL                 src\api\julia\CMakeFiles\z3jl.dir\build' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\HostX64\x64\nmake.exe" -s -f CMakeFiles\Makefile2 /nologo -S                  all' : return code '0x2'
Stop.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions