Skip to content

Commit ff45ece

Browse files
committed
Fix wamrc build failure for 32bit non-x86 targets
1 parent 368906f commit ff45ece

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

wamr-compiler/CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,12 @@ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
143143
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -fPIC")
144144
endif ()
145145
else ()
146-
add_definitions (-m32)
147-
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
148-
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
149-
endif ()
146+
# Add -m32 flag if compiling on 64-bit system for 32-bit x86 target
147+
if (WAMR_BUILD_TARGET STREQUAL "X86_32")
148+
add_definitions (-m32)
149+
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
150+
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
151+
endif ()
150152
endif ()
151153

152154
if (NOT CMAKE_BUILD_TYPE)

0 commit comments

Comments
 (0)