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

fatal error: 'endian.h' file not found on M1 mac #88

Closed
rlorigro opened this issue Dec 14, 2023 · 5 comments
Closed

fatal error: 'endian.h' file not found on M1 mac #88

rlorigro opened this issue Dec 14, 2023 · 5 comments

Comments

@rlorigro
Copy link
Contributor

rlorigro commented Dec 14, 2023

Hi,

I unfortunately need to compile this library on an M1 Mac and I am running into an error:

[1%] Building C object CMakeFiles/wfa2.dir/wavefront/wavefront_extend_kernels.c.o
/Users/rlorigro/code/sv_merge/build/project_wfa-prefix/src/project_wfa/wavefront/wavefront_extend_kernels.c:32:10: fatal error: 'endian.h' file not found
#include <endian.h>
         ^~~~~~~~~~

clang:

Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: arm64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

on macOS Sonoma 14.2 (23C64)

Based on some quick googling it may be as simple as using <machine/endian.h> in this particular context

Thanks

@rlorigro
Copy link
Contributor Author

I tried using #include <endian.h> and #include <machine/endian.h> in my own project and <machine/endian.h> works but the other does not.

@rlorigro
Copy link
Contributor Author

After some more searching I learned that using <sys/types.h> is supposed to be more portable than trying to include endian.h directly. I made a fork and tested it on my system and it works.

To be honest, I'm not sure why my build system doesn't activate the conditional clause if defined(__APPLE__) that you already had there. But it may have something to do with how I have compiled/linked in CMake:

ExternalProject_Add(project_wfa
        URL https://github.com/smarco/WFA2-lib/archive/refs/tags/v2.3.4.tar.gz
        TIMEOUT 5
        CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_SOURCE_DIR}/external/wfa2 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_RPATH=${CMAKE_SOURCE_DIR}/external/wfa2/lib/
        INSTALL_COMMAND make install
)

add_library(wfa2 SHARED IMPORTED)
set_property(TARGET wfa2
        PROPERTY IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/external/wfa2/lib/libwfa2cpp.${LIB_SUFFIX})
#                                            /sv_merge/external/wfa2/lib

add_dependencies(wfa2 project_wfa)
add_dependencies(sv_merge wfa2)

# Specify include dir
include_directories(
        ${CMAKE_SOURCE_DIR}/external/wfa2/include/wfa2lib
)

Let me know your thoughts. I would prefer not to use a fork if possible. Maybe I am missing something simple.

@smarco
Copy link
Owner

smarco commented Mar 31, 2024

Hi,

Thanks for the report and sorry for the terrible delay in answering. I am not an expert on macOS but I appreciate your research and looks good to me. Would you like to make a PR to development and get the credit for the patch?

Let me know,

@rlorigro
Copy link
Contributor Author

sure, PR is up now

@smarco
Copy link
Owner

smarco commented Mar 31, 2024

Thanks!

@smarco smarco closed this as completed Mar 31, 2024
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