[PATCH 20.11] eal/common: exclude code unsupported on Windows

Dmitry Kozlyuk dmitry.kozliuk at gmail.com
Tue Dec 7 15:16:44 CET 2021


rte_random.c and hotplug_mp.c are only intended for Unix targets,
but were compiled on Windows due to backporting mistake,
causing an error:

    In file included from ../lib/librte_eal/common/rte_random.c:13:
    [...]
    C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winnt.h:3275:1:
            error: conflicting types for '_m_prefetchw'
    _m_prefetchw (
    ^
    C:\Program Files\LLVM\lib\clang\8.0.0\include\prfchwintrin.h:64:1:
            note: previous definition is here
    _m_prefetchw(void *__P)
    ^
    1 error generated.

hotplug_mp.c was compiled twice, which also caused a link-time error:

    [43/146] Linking target lib/rte_eal-21.dll
    FAILED: lib/rte_eal-21.dll lib/rte_eal-21.pdb
    "clang" @lib/rte_eal-21.dll.rsp
    librte_eal_windows_eal_mp.c.obj : error LNK2005:
            eal_dev_hotplug_request_to_primary already defined
            in librte_eal_common_hotplug_mp.c.obj
    librte_eal_windows_eal_mp.c.obj : error LNK2005:
            eal_dev_hotplug_request_to_secondary already defined
            in librte_eal_common_hotplug_mp.c.obj
       Creating library lib\rte_eal.lib and object lib\rte_eal.exp
    lib\rte_eal-21.dll : fatal error LNK1169:
            one or more multiply defined symbols found
    clang: error: linker command failed with exit code 1169
            (use -v to see invocation)

Compile the files above only for Unix targets.

Bugzilla ID: 894
Fixes: 51a9cd2327f3 ("eal: remove Windows-specific list of common files")

Reported-by: Liang Longfeng <longfengx.liang at intel.com>
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk at gmail.com>
---
 lib/librte_eal/common/meson.build | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index e7ea0fd388..7105e8bc4b 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -29,11 +29,9 @@ sources += files(
 	'eal_common_timer.c',
 	'eal_common_trace_points.c',
 	'eal_common_uuid.c',
-	'hotplug_mp.c',
 	'malloc_elem.c',
 	'malloc_heap.c',
 	'rte_malloc.c',
-	'rte_random.c',
 	'rte_reciprocal.c',
 	'rte_service.c',
 )
@@ -50,6 +48,7 @@ if not is_windows
 		'eal_common_trace_utils.c',
 		'hotplug_mp.c',
 		'malloc_mp.c',
+		'rte_random.c',
 		'rte_keepalive.c',
 	)
 endif
-- 
2.29.3



More information about the stable mailing list