#64113 closed defect (fixed)
xxhashlib @0.8.1_0: build failure: static_assert undefined
Reported by: | macdeport | Owned by: | Schamschula (Marius Schamschula) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.7.1 |
Keywords: | yosemite snowleopard haspatch | Cc: | macdeport, ryandesign (Ryan Carsten Schmidt), BjarneDMat |
Port: | xxhashlib |
Description
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_xxhash/xxhashlib/work/compwrap/cc/usr/bin/clang -Os -arch x86_64 -Wall -Wextra -Wconversion -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings -Wredundant-decls -Wstrict-overflow=2 -I/opt/local/include -DXXH_INLINE_ALL cli/xxhsum.c -o xxhsum_inlinedXXH :info:build In file included from xxhash.c:43: :info:build ./xxhash.h:2266:5: warning: implicit declaration of function 'static_assert' is invalid in C99 [-Wimplicit-function-declaration] :info:build XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t));In file included from xxhash.c:43: :info:build ./xxhash.h:2266:5 ^ :info:build : warning: ./xxhash.h:1556:32: implicit declaration of function 'static_assert' is invalid in C99 [-Wimplicit-function-declaration]note :info:build : expanded from macro 'XXH_STATIC_ASSERT' :info:build # define XXH_STATIC_ASSERT(c) XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c) :info:build ^ :info:build ./xxhash.h:1550:54: note: expanded from macro 'XXH_STATIC_ASSERT_WITH_MESSAGE' :info:build # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0) :info:build ^ :info:build XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t)); :info:build ^ :info:build ./xxhash.h:1556:32: note: expanded from macro 'XXH_STATIC_ASSERT' :info:build # define XXH_STATIC_ASSERT(c) XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c) :info:build ^ :info:build ./xxhash.h:1550:54: note: expanded from macro 'XXH_STATIC_ASSERT_WITH_MESSAGE' :info:build # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0) :info:build ^ :info:build In file included from cli/xxhsum.c:41: :info:build In file included from cli/xsum_sanity_check.c:31: :info:build cli/../xxhash.h:2266:5: warning: implicit declaration of function 'static_assert' is invalid in C99 [-Wimplicit-function-declaration] :info:build XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t)); :info:build ^ :info:build cli/../xxhash.h:1556:32: note: expanded from macro 'XXH_STATIC_ASSERT' :info:build # define XXH_STATIC_ASSERT(c) XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c) :info:build ^ :info:build cli/../xxhash.h:1550:54: note: expanded from macro 'XXH_STATIC_ASSERT_WITH_MESSAGE' :info:build # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0) :info:build ^ :info:build 1 warning generated. :info:build 1 warning generated. :info:build ar rcs libxxhash.a xxhash.o :info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_xxhash/xxhashlib/work/compwrap/cc/usr/bin/clang -Os -arch x86_64 -Wall -Wextra -Wconversion -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings -Wredundant-decls -Wstrict-overflow=2 -I/opt/local/include xxhash.o cli/xxhsum.o cli/xsum_os_specific.o cli/xsum_output.o cli/xsum_sanity_check.o cli/xsum_bench.o -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -o xxhsum :info:build Undefined symbols for architecture x86_64: :info:build "_static_assert", referenced from: :info:build _XXH32_canonicalFromHash in xxhash.o :info:build _XXH64_canonicalFromHash in xxhash.o :info:build Undefined symbols for architecture x86_64: :info:build "_static_assert", referenced from: :info:build _XXH32_canonicalFromHash in xxhash-e1ea3c.o :info:build _XXH3_hashLong_64b_default in xxhash.o :info:build _XXH3_hashLong_64b_withSecret in xxhash.o :info:build _XXH3_hashLong_64b_withSeed in xxhash.o :info:build _XXH3_64bits_withSecretandSeed in xxhash.o :info:build _XXH3_64bits_reset_withSeed in xxhash.o :info:build _XXH64_canonicalFromHash in xxhash-e1ea3c.o :info:build ... :info:build _XXH3_hashLong_64b_default in xxhash-e1ea3c.o :info:build _XXH3_hashLong_64b_withSecret in xxhash-e1ea3c.o :info:build _XXH3_hashLong_64b_withSeed in xxhash-e1ea3c.o :info:build _XXH3_64bits_withSecretandSeed in xxhash-e1ea3c.o :info:build _XXH3_64bits_reset_withSeed in xxhash-e1ea3c.o :info:build ... :info:build ld: symbol(s) not found for architecture x86_64 :info:build ld: symbol(s) not found for architecture x86_64 :info:build clang: error: linker command failed with exit code 1 (use -v to see invocation) :info:build clang: error: linker command failed with exit code 1 (use -v to see invocation) :info:build make: *** [xxhsum] Error 1 :info:build make: *** Waiting for unfinished jobs.... :info:build make: *** [libxxhash.0.8.1.dylib] Error 1 :info:build 1 warning generated. :info:build Undefined symbols for architecture x86_64: :info:build "_static_assert", referenced from: :info:build _localXXH3_stream_seeded in xxhsum-c9b2d4.o :info:build _localXXH128_stream_seeded in xxhsum-c9b2d4.o :info:build _XXH3_hashLong_64b_default in xxhsum-c9b2d4.o :info:build _XXH3_hashLong_64b_withSeed in xxhsum-c9b2d4.o :info:build _XXH3_hashLong_64b_withSecret in xxhsum-c9b2d4.o :info:build _XXH3_hashLong_128b_internal in xxhsum-c9b2d4.o :info:build _XXH3_hashLong_128b_withSeed in xxhsum-c9b2d4.o :info:build ... :info:build ld: symbol(s) not found for architecture x86_64 :info:build clang: error: linker command failed with exit code 1 (use -v to see invocation) :info:build make: *** [xxhsum_inlinedXXH] Error 1
Attachments (1)
Change History (17)
Changed 3 years ago by macdeport
Attachment: | main.log.zip added |
---|
comment:1 Changed 3 years ago by jmroot (Joshua Root)
Owner: | set to Schamschula |
---|---|
Status: | new → assigned |
Summary: | xxhashlib @0.8.1_0: error: Undefined symbols for architecture x86_64 → xxhashlib @0.8.1_0: build failure: static_assert undefined |
comment:2 Changed 3 years ago by Schamschula (Marius Schamschula)
I currently test build on Big Sur (and Monterey). Unfortunately, I'm no expert on back porting to older systems, as I have none available to test against.
comment:3 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
static_assert
is a C++11 feature. Try indicating compiler.cxx_standard 2011
in the Portfile to let MacPorts choose a newer compiler.
The port has a section that applies a patch only for gcc 4. Since gcc 4 doesn't support C++11 that section and the patchfile can probably be removed.
comment:4 Changed 3 years ago by Schamschula (Marius Schamschula)
comment:5 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
Well the first search result I found claimed it was a C++11 thing, but according to Microsoft documentation it's a C11 thing. That makes more sense since I don't see any C++ compiler being used in the build.
The build does succeed on Lion, Mountain Lion, Mavericks, using Xcode clang, so that gives me hope this can be solved on Yosemite too, but it makes me skeptical that C11 is really required: why would it be required on Yosemite but not on older OSes?
It also fails on Snow Leopard, with a newer MacPorts clang, with the same message about static_assert
.
I don't see any -std
flag in the build either, so if C11 features are being used, you'd think it would specify -std=c11
.
Let me look at the code and see what's going on...
comment:6 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
The code says:
#ifndef XXH_STATIC_ASSERT # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */ # include <assert.h> # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0) # elif defined(__cplusplus) && (__cplusplus >= 201103L) /* C++11 */ # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0) # else # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { struct xxh_sa { char x[(c) ? 1 : -1]; }; } while(0) # endif # define XXH_STATIC_ASSERT(c) XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c) #endif
So they're clearly intending to use static_assert
only if the compiler is already in C11 or C++11 mode. So the questions are: why on 10.6 and 10.10 are we apparently in C11 or C++11 mode, and if we are in that mode, why then can't the symbol be found?
The issue where this revised static assert stuff was introduced is https://github.com/Cyan4973/xxHash/issues/567.
comment:7 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
I didn't have a 10.6 or 10.10 machine handy but I did have a 10.7 machine and I was able to reproduce the issue there if I forced the use of macports-clang-9.0, which IIRC defaults to C11 mode, so maybe that's significant. I was able to build successfully with macports-clang-9.0 by adding -std=c99
to CFLAGS. So this PR should fix the build failure on 10.6 and might fix it on 10.10 too:
comment:8 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
comment:9 follow-up: 10 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
Keywords: | snowleopard added |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Success!
Still worth reporting to the developers of xxhash though. They will probably want to make some change so that it can be compiled in C11 mode.
comment:10 Changed 3 years ago by macdeport
Replying to ryandesign:
Success!
Of course I confirm. Thank you again for your usual involvement and efficiency. Glad to have contributed indirectly to the improvement of a port.
comment:11 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | ryandesign added |
---|
Ports that use xxhashlib experience the same problem and might need the same workaround until it is fixed properly. See #64255 for an accidental instance of this. Has anyone reported the problem to the developer of xxhashlib yet?
comment:12 Changed 3 years ago by BjarneDMat
Cc: | BjarneDMat added |
---|
comment:13 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
Reported now: https://github.com/Cyan4973/xxHash/issues/671
comment:14 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
Keywords: | haspatch added |
---|
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_xxhash/xxhashlib/main.log