Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross compile for windows not generating .lib file #391

Closed
SourceCodeZone opened this issue Mar 28, 2020 · 7 comments
Closed

Cross compile for windows not generating .lib file #391

SourceCodeZone opened this issue Mar 28, 2020 · 7 comments

Comments

@SourceCodeZone
Copy link

I am using follwing command to cross compile libarary for windows

mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cross-mingw32-linux.cmake ..
cmake --build .

But it's not generating .lib library compatible with windows, I can see the example directory with exe file but the libarary generated is libvncserver.a not libvncserver.lib what could be the issue.

@bk138
Copy link
Member

bk138 commented Mar 28, 2020

It's generating static libraries ending in .a. You should set the BUILD_SHARED_LIBS CMake option to on in order to get shared libraries.

@bk138 bk138 closed this as completed Mar 28, 2020
@SourceCodeZone
Copy link
Author

Thanks for the response, I made BUILD_SHARED_LIBS=ON and now its generate dll file, I migrated the dll to windows and try to run basic example using libvnc server. but getting following error

main.obj:-1: error: LNK2019: unresolved external symbol rfbGetScreen referenced in function main
main.obj:-1: error: LNK2019: unresolved external symbol rfbInitServerWithoutPthreadsButWithZRLE referenced in function main
main.obj:-1: error: LNK2019: unresolved external symbol rfbRunEventLoop referenced in function main
debug\Test.exe:-1: error: LNK1120: 3 unresolved externals

IDE: Qt creator
Compiler: Microsoft visual C++ compiler 2012(Amd64)

What could be the reason.

@bk138
Copy link
Member

bk138 commented Mar 30, 2020

Seems you're not correctly linking to the DLL. Try the .a.

@SourceCodeZone
Copy link
Author

Sorry for the late replay, actually I have linked correctly, but still showing the same error, I have tried with shared library and static library. Also tried with library compiled on windows using VS-2013 and cross compiled from linux, but got same error.

I have uploaded the project here, can you please check it.

https://github.com/SourceCodeZone/Test

@bk138
Copy link
Member

bk138 commented Apr 1, 2020

I am sure you will understand that the priorities for my free time are with other projects, sorry. I can provide general advice, but no debugging of other projects. I provide freelance services for that, though.

@SourceCodeZone
Copy link
Author

Ok no problem I understand, do you any reference to pre-built libvnc server for windows.

@bk138
Copy link
Member

bk138 commented Apr 1, 2020

Ok no problem I understand, do you any reference to pre-built libvnc server for windows.

I can point you at our CI provider: https://ci.appveyor.com/project/bk138/libvncserver/branch/master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants