Skip to content

Conversation

@gnh1201
Copy link
Contributor

@gnh1201 gnh1201 commented Feb 17, 2022

Fixed: Error ‘MADV_HUGEPAGE’ undeclared (first use in this function)

Error log

[root@centos6 build]# cmake ..
CMake Deprecation Warning at CMakeLists.txt:4 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is GNU 4.9.1
-- The CXX compiler identification is GNU 4.9.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/rh/devtoolset-3/root/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/rh/devtoolset-3/root/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build Configurations:
     Build as target X86_64
     CMAKE_BUILD_TYPE Release
     WAMR Interpreter enabled
     WAMR AOT disabled
     WAMR JIT disabled
     Libc builtin enabled
     Libc WASI enabled
     Fast interpreter enabled
     Multiple modules disabled
     SIMD enabled
     Reference types disabled
-- The ASM compiler identification is GNU
-- Found assembler: /opt/rh/devtoolset-3/root/usr/bin/cc
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/src/wasm-micro-runtime/product-mini/platforms/linux/build
[root@centos6 build]# make
Scanning dependencies of target vmlib
[  1%] Building C object CMakeFiles/vmlib.dir/usr/src/wasm-micro-runtime/core/shared/platform/linux/platform_init.c.o
[  2%] Building C object CMakeFiles/vmlib.dir/usr/src/wasm-micro-runtime/core/shared/platform/common/posix/posix_malloc.c.o
[  4%] Building C object CMakeFiles/vmlib.dir/usr/src/wasm-micro-runtime/core/shared/platform/common/posix/posix_memmap.c.o
/usr/src/wasm-micro-runtime/core/shared/platform/common/posix/posix_memmap.c: In function ‘os_mmap’:
/usr/src/wasm-micro-runtime/core/shared/platform/common/posix/posix_memmap.c:193:31: error: ‘MADV_HUGEPAGE’ undeclared (first use in this function)
                               MADV_HUGEPAGE);
                               ^
/usr/src/wasm-micro-runtime/core/shared/platform/common/posix/posix_memmap.c:193:31: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [CMakeFiles/vmlib.dir/usr/src/wasm-micro-runtime/core/shared/platform/common/posix/posix_memmap.c.o] Error 1
make[1]: *** [CMakeFiles/vmlib.dir/all] Error 2
make: *** [all] Error 2

Related articles

Fixed: Error ‘MADV_HUGEPAGE’ undeclared (first use in this function)
@wenyongh wenyongh merged commit 0d1060b into bytecodealliance:main Feb 18, 2022
xujuntwt95329 pushed a commit to xujuntwt95329/wasm-micro-runtime that referenced this pull request Mar 13, 2022
In some Linux systems whose kernel version is smaller than 2.6.38, the macro
MADV_HUGEPAGE isn't introduced yet which causes compilation error.
Add macro control to fix the compilation error.
vickiegpt pushed a commit to vickiegpt/wamr-aot-gc-checkpoint-restore that referenced this pull request May 27, 2024
In some Linux systems whose kernel version is smaller than 2.6.38, the macro
MADV_HUGEPAGE isn't introduced yet which causes compilation error.
Add macro control to fix the compilation error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants