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

Fix FreeBSD job #475

Merged
merged 1 commit into from
Oct 8, 2022
Merged

Fix FreeBSD job #475

merged 1 commit into from
Oct 8, 2022

Conversation

Bodigrim
Copy link
Contributor

@Bodigrim Bodigrim commented Oct 7, 2022

@Bodigrim Bodigrim requested a review from Lysxia October 7, 2022 18:51
@Bodigrim
Copy link
Contributor Author

Bodigrim commented Oct 7, 2022

@blackgnezdo @arrowd could you possibly help me out with this? The FreeBSD CI job used to succeed with GHC 8.10 and FreeBSD 13.0, e. g., https://cirrus-ci.com/task/4639347260522496. However, upgrading to GHC 9.2 and FreeBSD 13.1 suddenly started to fail (e. g., https://cirrus-ci.com/task/6067564724355072) with

In file included from cbits/validate_utf8.cpp:1:0: error: 
simdutf/simdutf.h:6:10: error:
     fatal error: 'string' file not found
  |
6 | #include <string>
  |          ^
#include <string>
         ^~~~~~~~
1 error generated.
`cc' failed in phase `C Compiler'. (Exit code: 1)
cabal: Failed to build text-2.0.1 (which is required by test:tests from
text-2.0.1).

@Bodigrim
Copy link
Contributor Author

Bodigrim commented Oct 8, 2022

CC @vdukhovni as another FreeBSD user, if I recall correctly.

@arrowd
Copy link

arrowd commented Oct 8, 2022

FreeBSD 13.1 ships Clang 13 which has a bug when the --target flag is passed with unexpected value.

As a workaround you can add llvm14 to the pkg install line and point cabal to clang++14 executable as a C++ compiler.

@vdukhovni
Copy link

I am running into a problem with GHC 9.2 and FreeBSD 12.3-p6:

Linking /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/b/text-benchmarks/build/text-benchmarks/text-benchmarks ...
/usr/local/bin/ld: /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/build/libHStext-2.0.1-inplace.a(simdutf.o): in function `simdutf::internal::detect_best_supported_implementation_on_first_use::set_best() const':
simdutf.cpp:(.text+0x4032): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)'
/usr/local/bin/ld: /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/build/libHStext-2.0.1-inplace.a(simdutf.o): in function `simdutf::builtin_implementation()':
simdutf.cpp:(.text+0x42bb): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)'
/usr/local/bin/ld: /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/build/libHStext-2.0.1-inplace.a(simdutf.o): in function `simdutf::to_string[abi:cxx11](simdutf::encoding_type)':
simdutf.cpp:(.text+0x443f): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)'
/usr/local/bin/ld: simdutf.cpp:(.text+0x4497): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)'
/usr/local/bin/ld: simdutf.cpp:(.text+0x44df): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)'
/usr/local/bin/ld: /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/build/libHStext-2.0.1-inplace.a(simdutf.o):simdutf.cpp:(.text+0x450f): more undefined references to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)' follow
/usr/local/bin/ld: /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/build/libHStext-2.0.1-inplace.a(simdutf.o): in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<std::allocator<char> >(char const*, std::allocator<char> const&) [clone .constprop.0]':
simdutf.cpp:(.text.startup+0x9b): undefined reference to `std::__throw_logic_error(char const*)'
/usr/local/bin/ld: /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/build/libHStext-2.0.1-inplace.a(simdutf.o): in function `__static_initialization_and_destruction_0(int, int) [clone .constprop.0]':
simdutf.cpp:(.text.startup+0xf0): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0xff): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0x111): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0x119): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0x17d): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0x18c): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0x19e): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0x1a6): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0x20a): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0x219): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0x22b): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0x233): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0x297): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0x2a6): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0x2bf): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0x2c7): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0x32b): undefined reference to `std::ios_base::Init::Init()'
/usr/local/bin/ld: simdutf.cpp:(.text.startup+0x332): undefined reference to `std::ios_base::Init::~Init()'
/usr/local/bin/ld: /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/build/libHStext-2.0.1-inplace.a(simdutf.o): in function `void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.0]':
simdutf.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag.isra.0[_ZN7simdutf8internal26unsupported_implementationC5Ev]+0x7a): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)'
/usr/local/bin/ld: simdutf.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag.isra.0[_ZN7simdutf8internal26unsupported_implementationC5Ev]+0xa8): undefined reference to `std::__throw_logic_error(char const*)'
/usr/local/bin/ld: /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/build/libHStext-2.0.1-inplace.a(simdutf.o): in function `simdutf::internal::unsupported_implementation::unsupported_implementation()':
simdutf.cpp:(.text._ZN7simdutf8internal26unsupported_implementationC2Ev[_ZN7simdutf8internal26unsupported_implementationC5Ev]+0x41): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)'
/usr/local/bin/ld: simdutf.cpp:(.text._ZN7simdutf8internal26unsupported_implementationC2Ev[_ZN7simdutf8internal26unsupported_implementationC5Ev]+0x162): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()'
/usr/local/bin/ld: simdutf.cpp:(.text._ZN7simdutf8internal26unsupported_implementationC2Ev[_ZN7simdutf8internal26unsupported_implementationC5Ev]+0x16a): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()'
/usr/local/bin/ld: simdutf.cpp:(.text._ZN7simdutf8internal26unsupported_implementationC2Ev[_ZN7simdutf8internal26unsupported_implementationC5Ev]+0x173): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()'
/usr/local/bin/ld: /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/build/libHStext-2.0.1-inplace.a(simdutf.o): in function `__static_initialization_and_destruction_0(int, int) [clone .constprop.0] [clone .cold]':
simdutf.cpp:(.text.unlikely+0x8): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()'
/usr/local/bin/ld: simdutf.cpp:(.text.unlikely+0x13): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()'
/usr/local/bin/ld: /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/build/libHStext-2.0.1-inplace.a(simdutf.o):simdutf.cpp:(.text.unlikely+0x1b): more undefined references to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()' follow
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)

My settings are:

[("GCC extra via C opts", "")
,("C compiler command", "gcc")
,("C compiler flags", "")
,("C++ compiler flags", "")
,("C compiler link flags", "-fuse-ld=lld")
,("C compiler supports -no-pie", "YES")
,("Haskell CPP command", "gcc")
,("Haskell CPP flags", "-E -undef -traditional")
,("ld command", "ld.lld")
,("ld flags", "")
,("ld supports compact unwind", "NO")
,("ld supports build-id", "YES")
,("ld supports filelist", "NO")
,("ld is GNU ld", "YES")
,("Merge objects command", "ld.lld")
,("Merge objects flags", "-r")
,("ar command", "/usr/local/bin/ar")
,("ar flags", "q")
,("ar supports at file", "YES")
,("ranlib command", "ranlib")
,("otool command", "otool")
,("install_name_tool command", "install_name_tool")
,("touch command", "touch")
,("dllwrap command", "/bin/false")
,("windres command", "/bin/false")
,("libtool command", "libtool")
,("unlit command", "$topdir/bin/unlit")
,("cross compiling", "NO")
,("target platform string", "x86_64-portbld-freebsd")
,("target os", "OSFreeBSD")
,("target arch", "ArchX86_64")
,("target word size", "8")
,("target word big endian", "NO")
,("target has GNU nonexec stack", "YES")
,("target has .ident directive", "YES")
,("target has subsections via symbols", "NO")
,("target has RTS linker", "YES")
,("Unregisterised", "NO")
,("LLVM target", "x86_64-unknown-freebsd")
,("LLVM llc command", "llc")
,("LLVM opt command", "opt")
,("LLVM clang command", "clang")
,("Use interpreter", "YES")
,("Support SMP", "YES")
,("RTS ways", "l debug thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn thr_debug_dyn l_dyn thr_l_dyn thr_debug_p debug_p")
,("Tables next to code", "YES")
,("Leading underscore", "NO")
,("Use LibFFI", "NO")
,("RTS expects libdw", "NO")
]

@vdukhovni
Copy link

vdukhovni commented Oct 8, 2022

The command leading to the failing invocation of /usr/local/bin/ld is:

Linking...
/home/viktor/.local/ghc-9.2/bin/ghc --make -fbuilding-cabal-package -O -static -outputdir /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/b/text-benchmarks/build/text-benchmarks/text-benchmarks-tmp -odir /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/b/text-benchmarks/build/text-benchmarks/text-benchmarks-tmp -hidir /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/b/text-benchmarks/build/text-benchmarks/text-benchmarks-tmp -stubdir /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/b/text-benchmarks/build/text-benchmarks/text-benchmarks-tmp -i -i/usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/b/text-benchmarks/build/text-benchmarks/text-benchmarks-tmp -ibenchmarks/haskell -i/usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/b/text-benchmarks/build/text-benchmarks/autogen -i/usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/b/text-benchmarks/build/global-autogen -I/usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/b/text-benchmarks/build/text-benchmarks/autogen -I/usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/b/text-benchmarks/build/global-autogen -I/usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/b/text-benchmarks/build/text-benchmarks/text-benchmarks-tmp -optP-include -optP/usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/b/text-benchmarks/build/text-benchmarks/autogen/cabal_macros.h -hide-all-packages -Wmissing-home-modules -no-user-package-db -package-db /home/viktor/.cabal/store/ghc-9.2.3/package.db -package-db /usr/home/viktor/dev/text/dist-newstyle/packagedb/ghc-9.2.3 -package-db /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/b/text-benchmarks/package.conf.inplace -package-id base-4.16.2.0 -package-id bytestring-0.11.3.1 -package-id containers-0.6.5.1 -package-id deepseq-1.4.6.1 -package-id directory-1.3.6.2 -package-id filepath-1.4.2.2 -package-id tasty-bench-0.3.2-ec96d8743faf0de7196001c94f76829ac09dd1ffffbd488ae721ac1e3720ba1b -package-id text-2.0.1-inplace -package-id transformers-0.5.6.2 -XHaskell2010 -XNondecreasingIndentation benchmarks/haskell/Benchmarks.hs Benchmarks.Builder Benchmarks.Concat Benchmarks.DecodeUtf8 Benchmarks.EncodeUtf8 Benchmarks.Equality Benchmarks.FileRead Benchmarks.FoldLines Benchmarks.Multilang Benchmarks.Programs.BigTable Benchmarks.Programs.Cut Benchmarks.Programs.Fold Benchmarks.Programs.Sort Benchmarks.Programs.StripTags Benchmarks.Programs.Throughput Benchmarks.Pure Benchmarks.ReadNumbers Benchmarks.Replace Benchmarks.Search Benchmarks.Stream Benchmarks.WordFrequencies -o /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/b/text-benchmarks/build/text-benchmarks/text-benchmarks -Wall -O2 -rtsopts '-with-rtsopts=-A32m --nonmoving-gc' -hide-all-packages
Linking /usr/home/viktor/dev/text/dist-newstyle/build/x86_64-freebsd/ghc-9.2.3/text-2.0.1/b/text-benchmarks/build/text-benchmarks/text-benchmarks ...

@vdukhovni
Copy link

As a workaround you can add llvm14 to the pkg install line and point cabal to clang++14 executable as a C++ compiler.

Is that in the text.cabal file, or a global cabal setting (which)?

@Bodigrim Bodigrim force-pushed the freebsd-job branch 2 times, most recently from 3eedecc to 1d892eb Compare October 8, 2022 18:03
@Bodigrim
Copy link
Contributor Author

Bodigrim commented Oct 8, 2022

Thanks @arrowd, cabal test --ghc-options='-pgmc clang++14' works, at least for GHC 9.2.

@Lysxia this is ready for review.

@Lysxia Lysxia merged commit a7496a7 into haskell:master Oct 8, 2022
@vdukhovni
Copy link

FWIW, when I use GHC 9.4.1 instead of 9.2, the build works.

@blackgnezdo
Copy link
Contributor

cabal v2-test passes on OpenBSD at both 5558730 and a7496a7 using ghc 9.2.4.

@Lysxia
Copy link
Contributor

Lysxia commented Oct 8, 2022

Thanks for the help!

@Bodigrim Bodigrim deleted the freebsd-job branch October 8, 2022 22:40
@Bodigrim
Copy link
Contributor Author

Bodigrim commented Oct 8, 2022

Thanks all for investigation!

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.

5 participants