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

Build error on macOS 14.3.1 (23D60) (Apple Silicon) #52

Open
dewey opened this issue Feb 12, 2024 · 3 comments
Open

Build error on macOS 14.3.1 (23D60) (Apple Silicon) #52

dewey opened this issue Feb 12, 2024 · 3 comments

Comments

@dewey
Copy link

dewey commented Feb 12, 2024

Hey, I followed the instructions from the README, but it seems that something isn't working correctly.

hurl|master ⇒ ./build_simple.sh
/opt/homebrew/bin/cmake
~/repos/github.com/Edgio/hurl/build ~/repos/github.com/Edgio/hurl
CMake Warning (dev) at CMakeLists.txt:4 (project):
  cmake_minimum_required() should be called prior to this top-level project()
  call.  Please see the cmake-commands(7) manual for usage documentation of
  both commands.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is AppleClang 15.0.0.15000100
-- The CXX compiler identification is AppleClang 15.0.0.15000100
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/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: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build Configuration:

    Build Option                               Variable                Value
    -----------------------------------------------------------------------------------------
    Install path:                              INSTALL_PREFIX          /usr/local
    Fortify Source:                            FORTIFY                 OFF
    Debug mode:                                DEBUG_MODE              OFF
    Build Symbols                              BUILD_SYMBOLS           OFF
    Build with tcmalloc:                       BUILD_TCMALLOC          OFF
    Enable google cpu/heap profiler support:   BUILD_PROFILER          OFF
    Build with Address Sanitizer:              BUILD_ASAN              OFF
    Build with Undefined Behavior Sanitizer:   BUILD_UBSAN             OFF
    Build for custom OpenSSL:                  BUILD_CUSTOM_OPENSSL    OFF
    Build unit tests:                          BUILD_TESTS             OFF
    Build for Linux (adds package help):       BUILD_LINUX             OFF
    Build with KTLS support:                   BUILD_KTLS_SUPPORT      OFF

-- Package Configuration:

    Option                                     Value
    ---------------------------------------------------------------------
    Package Version:                           1.9.1-macOS

-- Configuring done (0.7s)
-- Generating done (0.1s)
-- Build files have been written to: /Users/philippdefner/repos/github.com/Edgio/hurl/build
[  1%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_buf.c.o
[  3%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_callbacks.c.o
[  5%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_debug.c.o
[  7%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_extpri.c.o
[  9%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_frame.c.o
[ 11%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_hd.c.o
[ 13%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_hd_huffman.c.o
[ 15%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_hd_huffman_data.c.o
[ 17%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_helper.c.o
[ 19%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_http.c.o
[ 21%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_map.c.o
[ 23%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_mem.c.o
[ 25%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_npn.c.o
[ 26%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_option.c.o
[ 28%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_outbound_item.c.o
[ 30%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_pq.c.o
[ 32%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_priority_spec.c.o
[ 34%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_queue.c.o
[ 36%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_rcbuf.c.o
[ 38%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_session.c.o
[ 40%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_stream.c.o
[ 42%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_submit.c.o
[ 44%] Building C object ext/nghttp2/src/CMakeFiles/nghttp2.dir/nghttp2_version.c.o
[ 46%] Linking C static library libnghttp2.a
[ 46%] Built target nghttp2
[ 48%] Building CXX object src/core/CMakeFiles/hurlcore.dir/__/__/ext/http_parser/http_parser.cc.o
[ 50%] Building CXX object src/core/CMakeFiles/hurlcore.dir/__/__/ext/hostcheck/hostcheck.cc.o
[ 51%] Building CXX object src/core/CMakeFiles/hurlcore.dir/__/__/ext/base64/base64.cc.o
[ 53%] Building CXX object src/core/CMakeFiles/hurlcore.dir/evr/evr.cc.o
In file included from /Users/philippdefner/repos/github.com/Edgio/hurl/src/core/evr/evr.cc:16:
/Users/philippdefner/repos/github.com/Edgio/hurl/src/core/support/ndebug.h:146:41: error: invalid output constraint '=a' in asm
        __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
                                        ^
1 error generated.
make[2]: *** [src/core/CMakeFiles/hurlcore.dir/evr/evr.cc.o] Error 1
make[1]: *** [src/core/CMakeFiles/hurlcore.dir/all] Error 2
make: *** [all] Error 2
~/repos/github.com/Edgio/hurl
hurl|master ⇒ cd build
build|master ⇒ ls
Permissions Size User          Date Created Git Name
.rw-r--r--  1.9k philippdefner 12 Feb 12:40  -I cmake_install.cmake
.rw-r--r--  1.2k philippdefner 12 Feb 12:40  -I cmake_uninstall.cmake
.rw-r--r--   16k philippdefner 12 Feb 12:40  -I CMakeCache.txt
drwxr-xr-x     - philippdefner 12 Feb 12:40  -I CMakeFiles/
.rw-r--r--  4.0k philippdefner 12 Feb 12:40  -I CPackConfig.cmake
.rw-r--r--  4.4k philippdefner 12 Feb 12:40  -I CPackSourceConfig.cmake
drwxr-xr-x     - philippdefner 12 Feb 12:40  -I ext/
.rw-r--r--  9.5k philippdefner 12 Feb 12:40  -I Makefile
drwxr-xr-x     - philippdefner 12 Feb 12:40  -I src/
build|master ⇒ sudo make install
Password:
[ 46%] Built target nghttp2
[ 48%] Building CXX object src/core/CMakeFiles/hurlcore.dir/evr/evr.cc.o
In file included from /Users/philippdefner/repos/github.com/Edgio/hurl/src/core/evr/evr.cc:16:
/Users/philippdefner/repos/github.com/Edgio/hurl/src/core/support/ndebug.h:146:41: error: invalid output constraint '=a' in asm
        __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
                                        ^
1 error generated.
make[2]: *** [src/core/CMakeFiles/hurlcore.dir/evr/evr.cc.o] Error 1
make[1]: *** [src/core/CMakeFiles/hurlcore.dir/all] Error 2
make: *** [all] Error 2
@tinselcity
Copy link
Contributor

It's probably an issue with the rdtsc (x86 assembly instruction -Read Timestamp Counter) not working on Apple Silicon (M1/2/3 etc). I don't maintain the repo anymore but it looks like just removing these lines might work (FYI for Edgio folks). Other uses are gated by #ifdef __arm__.

@dewey
Copy link
Author

dewey commented Feb 12, 2024

Thanks, I tried to blindly fix it without knowing much about it. That seems to do the trick, there's some other instances though where I wasn't able to figure it out so I'll leave that for someone else more familiar with it.

[ 48%] Building CXX object src/core/CMakeFiles/hurlcore.dir/support/time_util.cc.o
/Users/philippdefner/repos/github.com/dewey/hurl/src/core/support/time_util.cc:59:41: error: invalid output constraint '=a' in asm
        __asm__ __volatile__ ("rdtsc" : "=a" (l_lo), "=d" (l_hi));
                                        ^
1 error generated.

@dewey dewey changed the title Build error on macOS 14.3.1 (23D60) Build error on macOS 14.3.1 (23D60) (Apple Silicon) Feb 12, 2024
@tinselcity
Copy link
Contributor

I'll poke the Edgio folks, but what if they changed this line to:

diff --git a/src/core/support/time_util.cc b/src/core/support/time_util.cc
index fd93a34..a1a6070 100644
--- a/src/core/support/time_util.cc
+++ b/src/core/support/time_util.cc
@@ -46,7 +46,7 @@ __thread char g_last_date_str[128];
 static __inline__ uint64_t get_rdtsc64()
 {
         uint64_t tm;
-#if defined(__arm__) && defined(__linux__)
+#if defined(__arm__)
         struct timespec ts;
         clock_gettime(CLOCK_REALTIME, &ts);
         tm = ts.tv_sec;

To force everything __arm__ based to not use x86 asm.

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