Giter Club home page Giter Club logo

Comments (22)

bet4it avatar bet4it commented on May 24, 2024

You may use mingw64 to compile it on Windows ( Which is mentioned in #5, but I not try it, suggest you to use it on Linux )

from udbserver.

CypherpunkSamurai avatar CypherpunkSamurai commented on May 24, 2024

suggest you to use it on Linux

cross compile for windows with mingw on linux?

from udbserver.

bet4it avatar bet4it commented on May 24, 2024

I guess you can compile it directly on Windows with MSYS2 or something?

from udbserver.

CypherpunkSamurai avatar CypherpunkSamurai commented on May 24, 2024

Ok I'll try MSYS2.

I've also made a fork for using CI to compile for Windows using MSVC, can you check out why pkg-config is not finding unicorn2 even after compiling it :)

Workflow File
Run

from udbserver.

bet4it avatar bet4it commented on May 24, 2024

Because the command pkg-config only exists on Linux.
I suggest you to take a look at #4, which use the dev branch of unicorn that can deal with the situation that pkg-config doesn't exist.

from udbserver.

CypherpunkSamurai avatar CypherpunkSamurai commented on May 24, 2024

Ah right. he also faces the same error. Should we try using mingw then?

from udbserver.

bet4it avatar bet4it commented on May 24, 2024

You can build udbserver in your CI after applying this patch:

diff --git a/Cargo.toml b/Cargo.toml
index fa78420..3870acd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,7 +18,7 @@ capi = []
 
 [dependencies]
 gdbstub = "0.6"
-unicorn-engine = { version = "2.0.0-rc7", features = ["use_system_unicorn"] }
+unicorn-engine = { git = "https://github.com/unicorn-engine/unicorn", branch="dev", features = ["dynamic_linkage"] }
 singlyton = "*"
 
 [package.metadata.capi.header]

It seems that unicorn is statically embedded in udbserver.dll rather than dynamic linkage, but it also may work?

from udbserver.

CypherpunkSamurai avatar CypherpunkSamurai commented on May 24, 2024

Ohh. Thanks a lot, I'll try this :)

from udbserver.

CypherpunkSamurai avatar CypherpunkSamurai commented on May 24, 2024

@bet4it Thanks a lot. It worked :D 👍🏼

from udbserver.

CypherpunkSamurai avatar CypherpunkSamurai commented on May 24, 2024

Btw, the python bindings cant find the header during compilation.

Edit:
Added the following lines to fix the missing header, but now i'm getting linker errors:

https://github.com/CypherpunkSamurai/udbserver/runs/7081587661?check_suite_focus=true#step:14:158

library_dirs=['../../build/win/lib','../../unicorn', '../../unicorn/'],
include_dirs=['../../build/win/include', '../../unicorn/include', '../../unicorn/include/unicorn', '../../unicorn/build/Release/include'],

Error:

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:../../build/win/lib /LIBPATH:../../unicorn /LIBPATH:../../unicorn/ "/LIBPATH:C:\Program Files\Python37\libs" "/LIBPATH:C:\Program Files\Python37\PCbuild\amd64" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.19041.0\\um\x64" udbserver.lib /EXPORT:PyInit_udbserver build\temp.win-amd64-3.7\Release\udbserver.obj /OUT:build\lib.win-amd64-3.7\udbserver.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\udbserver.cp37-win_amd64.lib
   Creating library build\temp.win-amd64-3.7\Release\udbserver.cp37-win_amd64.lib and object build\temp.win-amd64-3.7\Release\udbserver.cp37-win_amd64.exp
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.12.rcgu.o) : error LNK2001: unresolved external symbol uc_close
udbserver.lib(unicorn_engine-f200a5afdac62d7f.unicorn_engine.fefc9264-cgu.11.rcgu.o) : error LNK2001: unresolved external symbol uc_close
udbserver.lib(unicorn_engine-f200a5afdac62d7f.unicorn_engine.fefc9264-cgu.15.rcgu.o) : error LNK2001: unresolved external symbol uc_close
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.4.rcgu.o) : error LNK2001: unresolved external symbol uc_close
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_WSAStartup
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_WSACleanup
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_freeaddrinfo
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.9.rcgu.o) : error LNK2001: unresolved external symbol __imp_closesocket
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_closesocket
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.10.rcgu.o) : error LNK2001: unresolved external symbol __imp_closesocket
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.13.rcgu.o) : error LNK2001: unresolved external symbol __imp_closesocket
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.15.rcgu.o) : error LNK2001: unresolved external symbol __imp_closesocket
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_BCryptGenRandom
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_OpenProcessToken
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_GetUserProfileDirectoryW
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_shutdown
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_WSAGetLastError
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_setsockopt
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_getsockopt
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_recv
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_WSARecv
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_WSASend
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_send
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_accept
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_ioctlsocket
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_getpeername
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_WSADuplicateSocketW
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_WSASocketW
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_connect
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_select
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_recvfrom
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_getaddrinfo
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_getsockname
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_bind
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_listen
udbserver.lib(std-c2061a8c4363ad39.std.902cd472-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp_sendto
udbserver.lib(unicorn_engine-f200a5afdac62d7f.unicorn_engine.fefc9264-cgu.11.rcgu.o) : error LNK2001: unresolved external symbol uc_context_free
udbserver.lib(unicorn_engine-f200a5afdac62d7f.unicorn_engine.fefc9264-cgu.11.rcgu.o) : error LNK2001: unresolved external symbol uc_open
udbserver.lib(unicorn_engine-f200a5afdac62d7f.unicorn_engine.fefc9264-cgu.11.rcgu.o) : error LNK2001: unresolved external symbol uc_query
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.2.rcgu.o) : error LNK2001: unresolved external symbol uc_query
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.4.rcgu.o) : error LNK2001: unresolved external symbol uc_query
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.2.rcgu.o) : error LNK2001: unresolved external symbol uc_hook_del
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.4.rcgu.o) : error LNK2001: unresolved external symbol uc_hook_del
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.2.rcgu.o) : error LNK2001: unresolved external symbol uc_reg_read
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.4.rcgu.o) : error LNK2001: unresolved external symbol uc_reg_read
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.2.rcgu.o) : error LNK2001: unresolved external symbol uc_reg_write
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.4.rcgu.o) : error LNK2001: unresolved external symbol uc_reg_write
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.2.rcgu.o) : error LNK2001: unresolved external symbol uc_mem_read
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.4.rcgu.o) : error LNK2001: unresolved external symbol uc_mem_read
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.2.rcgu.o) : error LNK2001: unresolved external symbol uc_mem_write
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.4.rcgu.o) : error LNK2001: unresolved external symbol uc_mem_write
udbserver.lib(udbserver.udbserver.c2c00f5b-cgu.4.rcgu.o) : error LNK2001: unresolved external symbol uc_hook_add
build\lib.win-amd64-3.7\udbserver.cp37-win_amd64.pyd : fatal error LNK1120: 38 unresolved externals
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.30.30705\\bin\\HostX86\\x64\\link.exe' failed with exit status 1120

from udbserver.

bet4it avatar bet4it commented on May 24, 2024

#4 is the promising way to build python bindings on Windows, let's wait until it lands, or you can change base on it.

By the way, can the C bindings work on your computer?

from udbserver.

CypherpunkSamurai avatar CypherpunkSamurai commented on May 24, 2024

By the way, can the C bindings work on your computer?

Nope, even the C bindings give symbol errors

n/ld.exe: lib/udbserver.lib(gdbstub-3323238ae3d9c88b.gdbstub.0ea11fd1-cgu.12.rcgu.o):gdbstub.0ea11fd1-c:(.xdata[$cppxdata$_ZN4core3ptr42drop_in_place$LT$std..io..error..Error$GT$17hb2c9ac909102a556E]+0xc): undefined reference to `__CxxFrameHandler3'
e:/mytools/c/winlibs/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: lib/udbserver.lib(gdbstub-3323238ae3d9c88b.gdbstub.0ea11fd1-cgu.12.rcgu.o):gdbstub.0ea11fd1-c:(.xdata[$cppxdata$_ZN7gdbstub4conn5impls9tcpstream83_$LT$impl$u20$gdbstub..conn..ConnectionExt$u20$for$u20$std..net..tcp..TcpStream$GT$4peek17hc41013a9c5bab834E]+0x10): undefined reference to `__CxxFrameHandler3'
e:/mytools/c/winlibs/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: lib/udbserver.lib(gdbstub-3323238ae3d9c88b.gdbstub.0ea11fd1-cgu.15.rcgu.o):gdbstub.0ea11fd1-c:(.xdata[$cppxdata$_ZN3std2io18default_read_exact17h24da8919fa0050e0E]+0x18): more undefined references to `__CxxFrameHandler3' follow
collect2.exe: error: ld returned 1 exit status

from udbserver.

CypherpunkSamurai avatar CypherpunkSamurai commented on May 24, 2024

If you don't mind, are you on telegram / discord / matrix? That way it would be a bit more easy to debug the errors.

from udbserver.

bet4it avatar bet4it commented on May 24, 2024

I just built udbserver on mingw64 and everything works fine like on Linux.
As for the __CxxFrameHandler3 error, do you mix the use of mingw64 and MSVC? And could you try to set panic = "abort"? (rust-lang/rust#45492 (comment))

If you don't mind, are you on telegram / discord / matrix? That way it would be a bit more easy to debug the errors.

I'm sorry I don't have such accounts. Maybe we can use something like gitter? But it seems that it has little difference with chatting on Github😅

from udbserver.

CypherpunkSamurai avatar CypherpunkSamurai commented on May 24, 2024

Yeah sure. I'm on gitter as well :)

from udbserver.

CypherpunkSamurai avatar CypherpunkSamurai commented on May 24, 2024

Hello 👋🏼. I just managed to run the udbserver under msys2, but how can i use it under windows python?

Can i package the python module with the dependencies somehow?

from udbserver.

bet4it avatar bet4it commented on May 24, 2024

Oh, I really don't know how to do it, but as I said before, if you want to do it, remember to base on the work #4 had done.

from udbserver.

CypherpunkSamurai avatar CypherpunkSamurai commented on May 24, 2024

I just extracted the unicorn package from MSYS2 and the build folder from msys2 udbserver and pasted it into my windows Mingw64, and added compiler=mingw32 to distutils.conf file. Then compiled the python and c bindings, and it works :)

from udbserver.

bet4it avatar bet4it commented on May 24, 2024

Great! So this can only be used in MSYS2/Mingw64? Or you can use it directly on Windows?

from udbserver.

CypherpunkSamurai avatar CypherpunkSamurai commented on May 24, 2024

Great! So this can only be used in MSYS2/Mingw64? Or you can use it directly on Windows?

It can be used in Windows Python installation! however, I had to copy the include folder to my python install path, and libs to python libs folder.

This can also be done by packaging these files inside the .egg file. You need to edit setup.py to include folders and add them to path. Like unicorn does for its windows pip package. On extracting the unicorn Windows pip package i found "include" "lib" and dll files. I tried to edit the setup.py to do it myself, but it doesn't work for some reason.

from udbserver.

bet4it avatar bet4it commented on May 24, 2024

Hope you can send a PR on build python package for Windows by Github Action!

from udbserver.

CypherpunkSamurai avatar CypherpunkSamurai commented on May 24, 2024

Hope you can send a PR on build python package for Windows by Github Action!

Sure I will try :D

from udbserver.

Related Issues (12)

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.