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

How can I know if I have the correct LLVM installed? #1

Open
alexanderkjeldaas opened this issue Apr 2, 2018 · 10 comments
Open

How can I know if I have the correct LLVM installed? #1

alexanderkjeldaas opened this issue Apr 2, 2018 · 10 comments

Comments

@alexanderkjeldaas
Copy link

It seems I'm using the wrong LLVM. I'm getting tons of:

+ exec env PATH=/home/cibuild/build/android-sdk-linux/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin:/home/cibuild/build/android-sdk-linux/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/li
nux-x86_64/arm-linux-androideabi/bin:/home/cibuild/build/android-sdk-linux/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin:/home/cibuild/build/android-sdk-linux/ndk-bundle/toolchains/aarch64-linux-an
droid-4.9/prebuilt/linux-x86_64/aarch64-linux-android/bin:/code/app-react/hs-code/x/clang+llvm-5.0.0-linux-x86_64-ubuntu16.04/bin:/code/arm/bin:/code/arm/toolchain-wrapper:/code/arm/bin:/code/arm/toolchai
n-wrapper:/code/arm/bin:/code/arm/toolchain-wrapper:/home/cibuild/.local/bin:/home/cibuild/bin:/home/cibuild/.local/bin:/home/cibuild/.nvm/versions/node/v9.10.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/local
/games:/usr/games:/home/cibuild/build/android-sdk-linux/tools:/home/cibuild/build/android-sdk-linux/platform-tools:/home/cibuild/app-react/rn-code/node_modules/.bin:/home/cibuild/.cabal/bin clang --target
=arm-linux-androideabi --sysroot /home/cibuild/build/android-sdk-linux/ndk-bundle/sysroot -isystem /home/cibuild/build/android-sdk-linux/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_AP
I__=24 -marm -fno-stack-protector -DTABLES_NEXT_TO_CODE -Isrc/Data/Generics -Idist/build -Idist/build -Idist/build/autogen -Idist/build -Qunused-arguments -x assembler -c /tmp/ghc22305_0/ghc_18.s -o dist/
build/Data/Generics/Aliases.o

/tmp/ghc22305_0/ghc_18.s:5:125: error:
     error: expected STT_<TYPE_IN_UPPER_CASE>, '#<type>', '%<type>' or "<type>"
            .type   sybzm0zi7zm0aea212ced888f6b5e2d66b8e52d0ffb62e814441050d1b1c62b10b2a98f1b45_DataziGenericsziAliases_unGenericzq_info,@object
                                                                                                                                         ^
  |
5 |         .type   sybzm0zi7zm0aea212ced888f6b5e2d66b8e52d0ffb62e814441050d1b1c62b10b2a98f1b45_DataziGenericsziAliases_unGenericzq_info,@object
  |                                                                                                                             ^

/tmp/ghc22305_0/ghc_18.s:13:6: error:
     error: invalid operand for instruction
            sub     x8, x20, #8             // =8
                    ^
   |
13 |         sub     x8, x20, #8             // =8
   |      ^

/tmp/ghc22305_0/ghc_18.s:14:7: error:
     error: invalid operand for instruction
            cmp             w8, w26
                            ^
   |
14 |         cmp             w8, w26
   |       ^

/tmp/ghc22305_0/ghc_18.s:15:3: error:
     error: invalid operand for instruction
            b.hs    .LBB0_2
             ^
   |
15 |         b.hs    .LBB0_2
   |   ^

/tmp/ghc22305_0/ghc_18.s:17:6: error:
     error: invalid operand for instruction
            sub     w8, w19, #8             // =8

I've installed from http://apt.llvm.org/ and also from http://releases.llvm.org/download.html#5.0.0

Maybe I should compile something myself?

What's the procedure for checking whether my LLVM is the correct one?

@alexanderkjeldaas
Copy link
Author

The clang that's being used is /home/cibuild/build/android-sdk-linux/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang in this case.

@alexanderkjeldaas
Copy link
Author

Example output from. llc doesn't read this type of assembly.
example.txt

@alexanderkjeldaas
Copy link
Author

Looks like ARM assembly now that I've looked a bit closer..

@angerman
Copy link
Contributor

angerman commented Apr 3, 2018

Did you use -fllvmng and -fast-llvm? THere should be no assembly emitted at all.

@alexanderkjeldaas
Copy link
Author

Ok, so I added:

program-options
  ghc-options: -fllvmng -fast-llvm

repository hackage.mobilehaskell
  url: http://hackage.mobilehaskell.org/
  secure: True
  root-keys: 8184c1f23ce05ab836e5ebac3c3a56eecb486df503cc28110e699e24792582da
             81ff2b6c5707d9af651fdceded5702b9a6950117a1c39461f4e2c8fc07d2e36a
             8468c561cd02cc7dfe27c56de0da1a5c1a2b1b264fff21f4784f02b8c5a63edd
  key-threshold: 3

repository head.hackage
   url: http://head.hackage.haskell.org/
   secure: True
   root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740
              2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb
              8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e
   key-threshold: 3

to cabal.project

Now I'm getting.

...
Configuration files installed in:
/home/cibuild/.cabal/store/ghc-8.4.0.20180109/mime-types-0.1.0.7-a00cc5d37cd019c2b0f687d4d3a1b250874f8c569e09d9f53927a8fb56764e94/etc
No alex found
Using ar found on system at:
/code/arm/toolchain-wrapper/armv7-linux-androideabi-ar
No c2hs found
No cpphs found
Using gcc version 4.2.1 found on system at:
/code/arm/toolchain-wrapper/armv7-linux-androideabi-clang
Using ghc version 8.4.0.20180109 given by user at:
/code/arm/bin/aarch64-linux-android-ghc
Using ghc-pkg version 8.4.0.20180109 given by user at:
/code/arm/bin/aarch64-linux-android-ghc-pkg
No ghcjs found
No ghcjs-pkg found
No greencard found
No haddock found
No happy found
Using haskell-suite found on system at: haskell-suite-dummy-location
Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location
No hmake found
No hpc found
Using hsc2hs version 0.68.3 found on system at:
/home/cibuild/.local/bin/hsc2hs
No hscolour found
No jhc found
Using ld found on system at:
/code/arm/toolchain-wrapper/armv7-linux-androideabi-ld
No lhc found
No lhc-pkg found
No pkg-config found
Using strip version 2.27 found on system at:
/home/cibuild/build/android-sdk-linux/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/aarch64-linux-android/bin/strip
Using tar found on system at: /bin/tar
No uhc found
Component build order: library
creating dist/build
creating dist/build/autogen
Building mime-types-0.1.0.7...
/code/arm/bin/aarch64-linux-android-ghc-pkg init dist/package.conf.inplace
Preprocessing library mime-types-0.1.0.7...
Building library...
creating dist/build
/code/arm/bin/aarch64-linux-android-ghc --make -fbuilding-cabal-package -O -outputdir dist/build -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -i. -idist/build/autogen -Idist/build/autogen -Idist/build -optP-include -optPdist/build/autogen/cabal_macros.h -this-unit-id mime-types-0.1.0.7-a00cc5d37cd019c2b0f687d4d3a1b250874f8c569e09d9f53927a8fb56764e94 -hide-all-packages -no-user-package-db -package-db /home/cibuild/.cabal/store/ghc-8.4.0.20180109/package.db -package-db dist/package.conf.inplace -package-id base-4.11.0.0 -package-id bytestring-0.10.8.2 -package-id containers-0.5.10.2 -package-id text-1.2.3.0 -XHaskell98 Network.Mime -fllvmng -fast-llvm
[1 of 1] Compiling Network.Mime     ( Network/Mime.hs, dist/build/Network/Mime.o )
LLVM ERROR: expected relocatable expression
`llc' failed in phase `LLVM Compiler'. (Exit code: 1)

in the logs.

@alexanderkjeldaas
Copy link
Author

Actually it seems to work for armv7-linux-androideabi-cabal, but not aarch64-linux-android-cabal.

@alexanderkjeldaas
Copy link
Author

For zlib, which is missing -lz, is there a standard package I can install to get an ARM-version of "standard libraries"?

@alexanderkjeldaas
Copy link
Author

$ANDROID_HOME/ndk-bundle/platforms/android-24/arch-arm/usr/lib/ has libz*.. just need to add that path. Should this path be added by the wrapper?

@angerman
Copy link
Contributor

angerman commented Apr 4, 2018

@alexanderkjeldaas that's a good questions. I guess we could just add it, but ideally it would come out of the config files via the -system flag I believe.

@alexanderkjeldaas
Copy link
Author

alexanderkjeldaas commented Apr 4, 2018 via email

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