OpenVPN / OpenVPN/openvpn3

Compiling java on windows, linking fails

Open
#224 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.2k
Forks
467
PR merge metrics
No merged PRs in 30d

Description

HI!

I'm on windows, compiling the java interface
First I changed client/CMakeLists.txt

    add_custom_command(
            OUTPUT ovpncli_wrap.cxx ovpncli_wrap.h
            COMMENT "Generating ovpncli Python swig files"
            COMMAND ${SWIG_EXECUTABLE} -c++ -java -package net.vpn.ovpn3 -outcurrentdir -I${CORE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/ovpncli.i
            DEPENDS ovpncli.i
    )

	target_include_directories(ovpnclilib PRIVATE $ENV{JAVA_HOME}/include/)
	target_include_directories(ovpnclilib PRIVATE $ENV{JAVA_HOME}/include/win32/)

then

    > git clone https://github.com/OpenVPN/openvpn3.git core && cd core
    > cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=<path_to_vcpkg>\scripts\buildsystems\vcpkg.cmake -DVCPKG_OVERLAY_PORTS=deps\vcpkg-ports
    > cmake --build build --config Release --target ovpncli

compile link error

ovpncli_wrap.obj : error LNK2001: unresolved external symbol "private: virtual void __cdecl openvpn::ClientAPI::OpenVPNClient::connect_attach(void)" (?connect_attach@OpenVPNClient@ClientAPI@openvpn@@EEAA
XXZ) [D:\workspace\openvpn3-win\openvpn3\core\build\client\ovpnclilib.vcxproj]
ovpncli_wrap.obj : error LNK2001: unresolved external symbol "private: virtual void __cdecl openvpn::ClientAPI::OpenVPNClient::connect_pre_run(void)" (?connect_pre_run@OpenVPNClient@ClientAPI@openvpn@@EE
AAXXZ) [D:\workspace\openvpn3-win\openvpn3\core\build\client\ovpnclilib.vcxproj]
ovpncli_wrap.obj : error LNK2001: unresolved external symbol "private: virtual void __cdecl openvpn::ClientAPI::OpenVPNClient::connect_run(void)" (?connect_run@OpenVPNClient@ClientAPI@openvpn@@EEAAXXZ) [
D:\workspace\openvpn3-win\openvpn3\core\build\client\ovpnclilib.vcxproj]
ovpncli_wrap.obj : error LNK2001: unresolved external symbol "private: virtual void __cdecl openvpn::ClientAPI::OpenVPNClient::connect_session_stop(void)" (?connect_session_stop@OpenVPNClient@ClientAPI@o
penvpn@@EEAAXXZ) [D:\workspace\openvpn3-win\openvpn3\core\build\client\ovpnclilib.vcxproj]
ovpncli_wrap.obj : error LNK2001: unresolved external symbol "private: virtual class openvpn::Stop * __cdecl openvpn::ClientAPI::OpenVPNClient::get_async_stop(void)" (?get_async_stop@OpenVPNClient@Client
API@openvpn@@EEAAPEAVStop@3@XZ) [D:\workspace\openvpn3-win\openvpn3\core\build\client\ovpnclilib.vcxproj]
D:\workspace\openvpn3-win\openvpn3\core\build\client\Debug_ovpncli.dll : fatal error LNK1120: 5 unresolved external commands [D:\workspace\openvpn3-win\openvpn3\core\build\client\ovpnclilib.vcxproj]

5 ports included

      virtual void connect_attach();
      virtual void connect_pre_run();
      virtual void connect_run();
      virtual void connect_session_stop();
      virtual Stop* get_async_stop();

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in client/CMakeLists.txt and inspect how ovpncli_wrap.cxx and the ovpnclilib target are generated and linked for the Java interface. Reproduce the shown CMake configure and build commands on Windows, then verify that the Release build completes without the listed unresolved OpenVPNClient symbols.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.