smadaminov / ovs-dpdk-meson-issues

VMware Summer 2021
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

windows dpdk: linker cannot find rte_version #41

Open williamtu opened 3 years ago

williamtu commented 3 years ago

[1/8] Linking target ovsdb/ovsdb-server.exe FAILED: ovsdb/ovsdb-server.exe ovsdb/ovsdb-server.pdb "clang" -Wl,/MACHINE:X64 -Wl,/OUT:ovsdb/ovsdb-server.exe ovsdb/ovsdb-server.exe.p/ovsdb-server.c.obj "-Wl,/nologo" "-Wl,/release" "-Wl,/nolo go" "-Wl,/DEBUG" "-Wl,/PDB:ovsdb\ovsdb-server.pdb" "ovsdb\libovsdb.a" "lib\libopenvswitch.a" "C:/temp/dpdk/lib/rte_eal.lib" "C:/temp/dpdk/lib /rte_ethdev.lib" "C:/temp/dpdk/lib/rte_mempool.lib" "C:/temp/dpdk/lib/rte_mbuf.lib" "C:/temp/dpdk/lib/rte_meter.lib" "C:/pthread/libpthreadVC 3.lib" "-lws2_32" "-lshlwapi" "-liphlpapi" "-lwbemuuid" "-mconsole" "-lkernel32" "-luser32" "-lgdi32" "-lwinspool" "-lshell32" "-lole32" "-lo leaut32" "-luuid" "-lcomdlg32" "-ladvapi32" libopenvswitch.a(netdev-dpdk.c.obj) : error LNK2019: unresolved external symbol rte_version referenced in function netdev_dpdk_get_status ovsdb\ovsdb-server.exe : fatal error LNK1120: 1 unresolved externals clang: error: linker command failed with exit code 1120 (use -v to see invocation)

c:\Temp\dpdk\lib>dumpbin /SYMBOLS librte_eal.a | grep rte_version 2E5 00000000 UNDEF notype External | rte_version 022 00000000 SECT4 notype () External | rte_version_prefix 023 00000010 SECT4 notype () External | rte_version_year 024 00000020 SECT4 notype () External | rte_version_month 025 00000030 SECT4 notype () External | rte_version_minor 026 00000040 SECT4 notype () External | rte_version_suffix 027 00000050 SECT4 notype () External | rte_version_release 028 00000000 SECT1 notype () External | rte_version 029 00000000 SECT3 notype Static | rte_version.version rte_version.c

williamtu commented 3 years ago

the static library has the rte_version, but the dynamic library "rte_eal.lib" does not.

c:\Temp\dpdk\lib>dumpbin /ALL rte_eal.lib | grep rte_ver

williamtu commented 3 years ago

[257/261] Linking target vswitchd/ovs-vswitchd.exe FAILED: vswitchd/ovs-vswitchd.exe vswitchd/ovs-vswitchd.pdb "clang" -Wl,/MACHINE:X64 -Wl,/OUT:vswitchd/ovs-vswitchd.exe vswitchd/ovs-vswitchd.exe.p/bridge.c.obj vswitchd/ovs-vswitchd.exe.p/ovs-vswitch d.c.obj vswitchd/ovs-vswitchd.exe.p/system-stats.c.obj vswitchd/ovs-vswitchd.exe.p/xenserver.c.obj "-Wl,/nologo" "-Wl,/release" "-Wl,/nologo" "-Wl,/DEBUG" "-Wl,/PDB:vswitchd\ovs-vswitchd.pdb" "ofproto\libofproto.a" "lib\libopenvswitch.a" "lib\libsflow.a" "C:/temp/dpdk/lib/rte_eal.l ib" "C:/temp/dpdk/lib/rte_ethdev.lib" "C:/temp/dpdk/lib/rte_mempool.lib" "C:/temp/dpdk/lib/rte_mbuf.lib" "C:/temp/dpdk/lib/rte_meter.lib" "C: /pthread/libpthreadVC3.lib" "-lws2_32" "-lshlwapi" "-liphlpapi" "-lwbemuuid" "-mconsole" "-lkernel32" "-luser32" "-lgdi32" "-lwinspool" "-lsh ell32" "-lole32" "-loleaut32" "-luuid" "-lcomdlg32" "-ladvapi32" libopenvswitch.a(dpdk.c.obj) : error LNK2019: unresolved external symbol rte_version referenced in function dpdk_init libopenvswitch.a(dpdk.c.obj) : error LNK2019: unresolved external symbol open_memstream referenced in function dpdk_init__ libopenvswitch.a(dpdk.c.obj) : error LNK2019: unresolved external symbol netdev_offload_dpdk referenced in function dpdk_init__ vswitchd\ovs-vswitchd.exe : fatal error LNK1120: 3 unresolved externals

williamtu commented 3 years ago

not sure if this is an issue:

Found ninja.EXE-1.10.0 at "C:\Program Files\Meson\ninja.EXE"
Command line for building ['lib\\librte_eal.a'] is long, using a response file
Command line for building ['lib\\rte_eal-21.dll'] is long, using a response file
williamtu commented 3 years ago

There are two issues:

  1. Exporting variables from DLL requires __declspec(dllimport).
  2. Thread-local variables cannot be exported directly.

Hi William,

These functions are marked as non-exported on Windows apparently for no reason. You can quickly fix it by removing WINDOWS_NO_EXPORT for them in lib/eal/version.map.

Please note that shared library build of DPDK is not yet supported on Windows (it will compile, but it won't work properly when linked to the app).

Tyler Retzlaff and me are working on the solution hopefully targeting 21.11.

It is also possible to make DLLs work with MinGW using its features, but Tyler's solution will be for all toolchains.