conda-forge / ghc-feedstock

A conda-smithy repository for ghc.
BSD 3-Clause "New" or "Revised" License
2 stars 15 forks source link

GHC looks for paths in the build environment (which do not exist when it is running) #9

Closed luispedro closed 3 years ago

luispedro commented 5 years ago

Compiling a simple test fails (this is on a fresh env with only GHC installed):

[1 of 1] Compiling Main             ( Main.hs, Main.o )

<no location info>: error:
    Warning: Couldn't figure out C compiler information!
             Make sure you're using GNU gcc, or clang
ghc: could not execute: /home/conda/feedstock_root/build_artifacts/ghc_1546296476453/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc

I believe the issue is that the settings file installed with ghc lists paths from the build environment, which (obviously) do not exist on my machine. Here is the lib/ghc-8.2.2/settings file:

[("GCC extra via C opts", " -fwrapv -fno-builtin"), ("C compiler command", "/home/conda/feedstock_root/build_artifacts/ghc_1546296476453/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc"), ("C compiler flags", " -fno-stack-protector"), ("C compiler link flags", " "), ("C compiler supports -no-pie", "YES"), ("Haskell CPP command","/home/conda/feedstock_root/build_artifacts/ghc_1546296476453/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc"), ("Haskell CPP flags","-E -undef -traditional"), ("ld command", "/home/conda/feedstock_root/build_artifacts/ghc_1546296476453/_build_env/bin/x86_64-conda_cos6-linux-gnu-ld"), ("ld flags", ""), ("ld supports compact unwind", "YES"), ("ld supports build-id", "YES"), ("ld supports filelist", "NO"), ("ld is GNU ld", "YES"), ("ar command", "/usr/bin/ar"), ("ar flags", "q"), ("ar supports at file", "YES"), ("touch command", "touch"), ("dllwrap command", "/bin/false"), ("windres command", "/bin/false"), ("libtool command", "libtool"), ("perl command", "/opt/conda/bin/perl"), ("cross compiling", "NO"), ("target os", "OSLinux"), ("target arch", "ArchX86_64"), ("target word size", "8"), ("target has GNU nonexec stack", "True"), ("target has .ident directive", "True"), ("target has subsections via symbols", "False"), ("target has RTS linker", "@HaskellHaveRTSLinker@"), ("Unregisterised", "NO"), ("LLVM llc command", "llc"), ("LLVM opt command", "opt") ]

Environment (conda list):

``` $ conda list # packages in environment at /home/luispedro/.anaconda/envs/ghc: # # Name Version Build Channel ghc 8.2.2 h6b0b704_1001 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge gmp 6.1.2 hf484d3e_1000 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge libgcc-ng 7.3.0 hdf63c60_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge libstdcxx-ng 7.3.0 hdf63c60_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge xz 5.2.4 h14c3975_1001 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge ```


Details about conda and system ( conda info ):

``` $ conda info active environment : ghc active env location : /home/luispedro/.anaconda/envs/ghc shell level : 1 user config file : /home/luispedro/.condarc populated config files : /home/luispedro/.condarc conda version : 4.6.7 conda-build version : 3.10.5 python version : 3.6.5.final.0 base environment : /home/luispedro/.anaconda (writable) channel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch package cache : /home/luispedro/.anaconda/pkgs /home/luispedro/.conda/pkgs envs directories : /home/luispedro/.anaconda/envs /home/luispedro/.conda/envs platform : linux-64 user-agent : conda/4.6.7 requests/2.18.4 CPython/3.6.5 Linux/4.15.0-1033-oem ubuntu/18.04.1 glibc/2.27 UID:GID : 1001:1001 netrc file : None offline mode : False ```
step21 commented 3 years ago

Can you retest this on the latest version if it is still relevant to you? Otherwise I would close this.

luispedro commented 3 years ago

Yes. This is still happening.

conda create -n ghc-test
conda activate ghc-test
conda install -c conda-forge ghc

ghc-pkg recache
ghc Hello.hs -o hello

returns an error:


[1 of 1] Compiling Main             ( Hello.hs, Hello.o )

<no location info>: error:
    Warning: Couldn't figure out C compiler information!
             Make sure you're using GNU gcc, or clang
ghc: could not execute: /home/conda/feedstock_root/build_artifacts/ghc_1631487753784/_build_env/bin/x86_64-conda-linux-gnu-gcc

The file Hello.hs is very simple:

module Main where

main = putStrLn "Hello World"

Again, the /home/luispedro/.anaconda/envs/ghc-test/lib/ghc-8.10.4/settings file references these paths:

[("GCC extra via C opts", "")
,("C compiler command", "/home/conda/feedstock_root/build_artifacts/ghc_1631487753784/_build_env/bin/x86_64-conda-linux-gnu-gcc")
,("C compiler flags", "")
,("C++ compiler flags", "")
,("C compiler link flags", "")
,("C compiler supports -no-pie", "YES")
,("Haskell CPP command", "/home/conda/feedstock_root/build_artifacts/ghc_1631487753784/_build_env/bin/x86_64-conda-linux-gnu-gcc")
,("Haskell CPP flags", "-E -undef -traditional")
,("ld command", "/home/conda/feedstock_root/build_artifacts/ghc_1631487753784/_build_env/bin/x86_64-conda-linux-gnu-ld")
,("ld flags", "")
,("ld supports compact unwind", "NO")
,("ld supports build-id", "YES")
,("ld supports filelist", "NO")
,("ld is GNU ld", "YES")
,("Merge objects command", "/home/conda/feedstock_root/build_artifacts/ghc_1631487753784/_build_env/bin/x86_64-conda-linux-gnu-ld")
,("Merge objects flags", "-r")
,("ar command", "x86_64-unknown-linux-gnu-ar")
,("ar flags", "q")
,("ar supports at file", "YES")
,("ranlib command", "/home/conda/feedstock_root/build_artifacts/ghc_1631487753784/_build_env/bin/x86_64-conda-linux-gnu-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-unknown-linux")
,("target os", "OSLinux")
,("target arch", "ArchX86_64")
,("target word size", "8")
,("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-linux")
,("LLVM llc command", "llc")
,("LLVM opt command", "opt")
,("LLVM clang command", "clang")
,("integer library", "integer-gmp")
,("Use interpreter", "YES")
,("Use native code generator", "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")
,("Use Threads", "YES")
,("Use Debugging", "NO")
,("RTS expects libdw", "NO")
]