简体   繁体   中英

Can't build 'text' package with llvm backend

I have ghc-8.0.1 and llvm-3.7.0 both 64bit. I'm trying to install 'text' package like this:

cabal install text-1.2.2.2 --ghc-options="-fllvm -pgmlo opt -pgmlc llc -optlc-O4 -v -keep-llvm-files -keep-tmp-files"

It fails with the following message:

*** Assembler:
"C:\Program Files\Haskell Platform\8.0.1\lib/../mingw/bin/gcc.exe" "-fno-stack-protector" "-DTABLES_NEXT_TO_CODE" "-I.\Data\Text" "-Idist/dist-sandbox-a883bd5e\build" "-Idist/dist-sandbox-a883bd5e\build" "-Idist/dist-sandbox-a883bd5e\build\autogen" "-Idist/dist-sandbox-a883bd5e\build" "-Iinclude" "-IC:\Program Files\Haskell Platform\8.0.1\mingw\include" "-x" "assembler" "-c" "C:\Users\alex\AppData\Local\Temp\ghc7728_0\ghc_190.s" "-o" "dist/dist-sandbox-a883bd5e\build\Data\Text\Read.o"
C:\Users\alex\AppData\Local\Temp\ghc7728_0\ghc_190.s: Assembler messages:
C:\Users\alex\AppData\Local\Temp\ghc7728_0\ghc_190.s:29453: Error: junk at end of line, first unrecognized character is `,'
C:\Users\alex\AppData\Local\Temp\ghc7728_0\ghc_190.s:29490: Error: junk at end of line, first unrecognized character is `,'
C:\Users\alex\AppData\Local\Temp\ghc7728_0\ghc_190.s:29539: Error: junk at end of line, first unrecognized character is `,'
`gcc.exe' failed in phase `Assembler'. (Exit code: 1)
cabal: Leaving directory 'C:\Users\alex\AppData\Local\Temp\cabal-tmp-9212\text-1.2.2.2'
cabal: Error: some packages failed to install:
text-1.2.2.2 failed during the building phase. The exception was:
ExitFailure 1

and C:\\Users\\alex\\AppData\\Local\\Temp\\ghc7728_0\\ghc_190.s file contains:

near line 29453:

29442:  c4pto_info$def:
29443:  # BB#0:                                 # %c4pto
29444:      movsd   %xmm1, 32(%rbp)
29445:      addq    $8, %rbp
29446:      rex64 jmp   c4ppb_entry$def # TAILCALL
29447:  
29448:      .def     c4prM_info$def;
29449:      .scl    3;
29450:      .type   32;
29451:      .endef
29452:      .globl  __real@4024000000000000
29453:      .section    .rdata,"dr",discard,__real@4024000000000000
29454:      .align  8
29455:  __real@4024000000000000:
29456:      .quad   4621819117588971520     # double 10
29457:      .text
29458:      .align  16, 0x90
29459:      .quad   (S470B_srt$def-c4prM_info$def)+1024 # @"c4prM_info$def"
29460:      .quad   1925                    # 0x785
29461:      .quad   4294967328              # 0x100000020
29462:  c4prM_info$def:

near line 29490:

29479:  .LBB697_4:                              # %u4pwu
29480:      addq    $48, %rbp
29481:      movq    textzm1zi2zi2zi2zm9RlRQEEESJb1LT1TjepTtH_DataziTextziRead_zdszc1_closure$def(%rip), %rax
29482:      movl    $textzm1zi2zi2zi2zm9RlRQEEESJb1LT1TjepTtH_DataziTextziRead_zdszc1_closure$def, %ebx
29483:      rex64 jmpq  *%rax           # TAILCALL
29484:  
29485:      .def     c4psR_info$def;
29486:      .scl    3;
29487:      .type   32;
29488:      .endef
29489:      .globl  __xmm@80000000000000008000000000000000
29490:      .section    .rdata,"dr",discard,__xmm@80000000000000008000000000000000
29491:      .align  16
29492:  __xmm@80000000000000008000000000000000:
29493:      .quad   -9223372036854775808    # 0x8000000000000000
29494:      .quad   -9223372036854775808    # 0x8000000000000000
29495:      .text
29496:      .align  16, 0x90
29497:      .quad   1925                    # @"c4psR_info$def"
29498:                                          # 0x785
29499:      .quad   32                      # 0x20
29500:  c4psR_info$def:

near line 29539:

29521:    .LBB698_4:                              # %c4ptk
29522:      movq    $ghczmprim_GHCziTuple_Z2T_con_info, 24(%rax)
29523:      leaq    -47(%r12), %rdx
29524:      movq    %rdx, 32(%rax)
29525:      movq    %rcx, 40(%rax)
29526:      movq    $base_DataziEither_Right_con_info, 48(%rax)
29527:      leaq    -31(%r12), %rcx
29528:      movq    %rcx, 56(%rax)
29529:      movq    48(%rbp), %rax
29530:      addq    $48, %rbp
29531:      leaq    -6(%r12), %rbx
29532:      rex64 jmpq  *%rax           # TAILCALL
29533:    
29534:      .def     c4ps8_info$def;
29535:      .scl    3;
29536:      .type   32;
29537:      .endef
29538:      .globl  __real@3ff0000000000000
29539:      .section    .rdata,"dr",discard,__real@3ff0000000000000
29540:      .align  8
29541:    __real@3ff0000000000000:
29542:      .quad   4607182418800017408     # double 1
29543:      .text
29544:      .align  16, 0x90
29545:      .quad   1925                    # @"c4ps8_info$def"
29546:                                            # 0x785
29547:      .quad   32                      # 0x20
29548:    c4ps8_info$def:

I installed other packages with llvm backend, so far only 'text' fails.

On an OS-X system using llvm 3.7 and GHC 8.0.2 I was able to (in a temp directory):

cabal sandbox init
cabal install text-1.2.2.2 --ghc-options="-fllvm -pgmlo opt -pgmlc llc -optlc-O4 -v -keep-llvm-files -keep-tmp-files"

Which yielded significant text ending with:

...
Created temporary directory: /var/folders/0x/hlxcgy9n5714ryp0gkn5hkmm0000gp/T/ghc6374_0
*** C Compiler:
/usr/bin/gcc -m64 -fno-stack-protector -DTABLES_NEXT_TO_CODE -x c /var/folders/0x/hlxcgy9n5714ryp0gkn5hkmm0000gp/T/16807282475249.c -o /var/f
olders/0x/hlxcgy9n5714ryp0gkn5hkmm0000gp/T/ghc6374_0/ghc_1.s -fno-common -U__PIC__ -D__PIC__ -Wimplicit -S '-D__GLASGOW_HASKELL__=800' -inclu
de /usr/local/lib/ghc-8.0.2/include/ghcversion.h -I/usr/local/lib/ghc-8.0.2/base-4.9.1.0/include -I/usr/local/lib/ghc-8.0.2/integer-gmp-1.0.0
.1/include -I/usr/local/lib/ghc-8.0.2/include
*** Clang (Assembler):
clang -m64 -fno-stack-protector -DTABLES_NEXT_TO_CODE -fno-common -U__PIC__ -D__PIC__ -Qunused-arguments -x assembler -c /var/folders/0x/hlxc
gy9n5714ryp0gkn5hkmm0000gp/T/ghc6374_0/ghc_1.s -o /var/folders/0x/hlxcgy9n5714ryp0gkn5hkmm0000gp/T/1622650073984943658.o
Resolving dependencies...
Notice: installing into a sandbox located at /private/tmp/x/.cabal-sandbox
Configuring text-1.2.2.2...
Building text-1.2.2.2...
Installed text-1.2.2.2
cabal install text-1.2.2.2   218.77s user 8.27s system 98% cpu 3:49.67 total

So in short this is a non-reproduceable (by me) platform/tooling issue. I suggest you try GHC 8.0.2 since 8.0.1 is, well, lesser. It might also be worth glancing at the windows-specific bugs on the GHC trac.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM