Comments (11)
Thanks! I guess the solution would be to compile ncurses either with
--with-terminfo-dirs
: lookup to a few hardcoded paths with directories from the most common operating systems (/lib/terminfo
,/etc/terminfo
,/usr/share/terminfo
)--with-fallback
: embed some terminfo definitions directly to the library.
I'll go ahead with the first option. Hopefully I'll be able to do it via an override without sending a PR to upstream nixpkgs.
Edit: Yes, it looks like it's as easy as: ncurses.overrideDerivation (old: { configureFlags = old.configureFlags ++ [ "--with-terminfo-dirs=/lib/terminfo:/etc/terminfo:/usr/share/terminfo" ]; })
. I'll test it and update the containers again.
from ghc-musl.
Thanks! I'll include terminfo
in the containers.
from ghc-musl.
@utdemir Thank you so much!
from ghc-musl.
I added ncurses
library (both static and shared versions), and published -v5
images to dockerhub. I was able to compile summoner-tui
statically via cloning summoner
repository and applying below diff:
diff --git a/stack.yaml b/stack.yaml
index dbec01c..97fdac4 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -8,3 +8,9 @@ extra-deps:
- generic-data-0.8.0.0
- hspec-hedgehog-0.0.1.1
- validation-selective-0.0.0.0
+
+compiler: ghc-8.8.1
+
+docker:
+ enable: true
+ image: utdemir/ghc-musl:v5-libgmp-ghc881
diff --git a/summoner-tui/summoner-tui.cabal b/summoner-tui/summoner-tui.cabal
index 14c3a42..5a71fb4 100644
--- a/summoner-tui/summoner-tui.cabal
+++ b/summoner-tui/summoner-tui.cabal
@@ -97,3 +97,4 @@ executable summon-tui
ghc-options: -threaded
-rtsopts
-with-rtsopts=-N
+ -static -optl-static -optl-pthread -fPIC
Hope it'll work out for you, let me know if there's any other issues!
from ghc-musl.
@utdemir Awesome news!
from ghc-musl.
@utdemir Unfortunately, it doesn't work expected... It builds, but it prints some library error. When trying to run a simple command, I see:
$ ./summon-tui-linux-static new foo
Configurations from /home/shersh/.summoner.toml will be used.
summon-tui-linux-static: setupTerm: Couldn't look up terminfo entry "xterm-256color"
When I expected to see the project scaffolding settings screen:
from ghc-musl.
@chshersh I looked into it a bit, it looks like ncurses requires a terminfo database, and uses TERMINFO_DIRS
environment variable to look up. This is seemingly a common problem with the use of ncurses. It's not specifically about static linking, but since installing ncurses for dynamic linking purposes also usually installs the terminfo files; it's only appears when ncurses is linked statically inside the binary and lacking the terminfo files.
I saw a related issue(fish-shell/fish-shell#1271) where they were thinking about embedding terminfo definitions inside ncurses. However the build definition from nixpkgs does not seem to have that functionality. I will take a look at adding that functionality to nixpkgs, but probably it won't be before the next weekend. However if you send a PR to nixpkgs or open an issue and it gets fixed, I can easily modify this repository to take advantage of the new functionality any time.
from ghc-musl.
@chshersh Alternatively, can you check if you have a terminfo database on your system, and summoner-tui works if you set TERMINFO_DIRS
accordingly? Maybe we just need to set the default lookup path in the statically linked library somehow.
from ghc-musl.
@utdemir I can confirm that specifying TERMINFO_DIRS
make statically built summoner-tui
succeed. The following command works on my OS (Ubuntu 18.04):
TERMINFO_DIRS=/lib/terminfo ./summon-tui-linux-static new foo
But if I understand correctly from what I read, the path to the terminfo
database can be different on different machines.
from ghc-musl.
@chshersh I uploaded v6
with the change I mentioned above. I also tried building summoner-tui again, and ran the resulting image on an Ubuntu container; and it worked, including the fancy TUI!
The resulting binary should be usable on common OS's, let me know if there's any other issues!
from ghc-musl.
@utdemir Thanks for your work ❤️ I was able to build working statically linked executable for Summoner TUI.
from ghc-musl.
Related Issues (20)
- Building with stack fails with "Executable named groupadd not found on path" error HOT 2
- Add sdl2 and sdl2-ttf to the docker images? HOT 48
- build postgrest failed with error message setup: The program 'pg_config' is required but it could not be found HOT 9
- Failed with integer-gmp HOT 3
- Update image to GHC 9.0.2 HOT 8
- Linker problem building a `monomer` app HOT 2
- Alpine package upgrades HOT 12
- Earthfile suggestions HOT 5
- Would you be so kind as to include stack? HOT 6
- Build a statically linked Haskell library with ghc-musl HOT 5
- Build wai-app-static failed with Segfaults HOT 3
- Support GHC-8.8.3 HOT 4
- Docker image with GHC 9.2.5 HOT 2
- Affected by binutils bug 23856 HOT 1
- Error encountered while installing GHC HOT 2
- The `--ghc-options` for `stack build` were not recognized correctly. HOT 1
- SSL certificates HOT 19
- adding pcre HOT 2
- add bz2 & openssl HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ghc-musl.