Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A compile error on Windows (building for Android) #232

Open
JaanDev opened this issue Jun 1, 2023 · 1 comment
Open

A compile error on Windows (building for Android) #232

JaanDev opened this issue Jun 1, 2023 · 1 comment

Comments

@JaanDev
Copy link

JaanDev commented Jun 1, 2023

Hello! I am using cmake to build a dynamic library (mod) for android armeabi-v7a. Im compiling from windows 10. My compiler is clang.

The error:

[build] ..../GDL/libs/dobby/builtin-plugin/SymbolResolver/macho/macho_ctx.h:5:10: fatal error: 'mach-o/loader.h' file not found
[build] #include <mach-o/loader.h>
[build]          ^~~~~~~~~~~~~~~~~
[build] 1 error generated.
... later ...
[build] In file included from ..../GDL/libs/dobby/builtin-plugin/SymbolResolver/macho/shared_cache_ctx.cpp:1:
[build] ..../GDL/libs/dobby/builtin-plugin/SymbolResolver/macho/shared_cache_ctx.h:2:10: fatal error: 'mach-o/loader.h' file not found
[build] #include <mach-o/loader.h>
[build]          ^~~~~~~~~~~~~~~~~
[build] 1 error generated.

it also cant include <mach-o/nlist.h> in the same macho_ctx.h

here is my CMakeLists.txt (it builds successfully without dobby)

cmake_minimum_required(VERSION 3.0.0)

# write path to ur android ndk into NDKPath.txt. Recommended version is r23c
# use / (not \ or \\)
file(STRINGS "NDKPath.txt" CMAKE_ANDROID_NDK)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/out)
set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_SYSTEM_VERSION 21)
set(CMAKE_ANDROID_ARCH_ABI armeabi-v7a) # arm64-v8a / armeabi-v7a
set(CMAKE_ANDROID_STL_TYPE c++_static)
set(MODNAME GDL)

project(${MODNAME} VERSION 1.0.0)

add_subdirectory(libs/dobby)

file(GLOB SOURCES
    src/*.cpp
)

add_library(${MODNAME} SHARED ${SOURCES})

target_link_libraries(${MODNAME} log dobby)

install(TARGETS ${MODNAME} LIBRARY)
@Naville
Copy link

Naville commented Jun 5, 2023

Fix: Wrap

add_library(macho_ctx_kit
in if(SYSTEM.Darwin) calls

segfault-bilibili added a commit to segfault-bilibili/Dobby that referenced this issue Jun 23, 2023
segfault-bilibili referenced this issue in rayshift/Dobby Jun 24, 2023
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

No branches or pull requests

2 participants