Git Product home page Git Product logo

blackgnezdo / ports Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openbsd/ports

3.0 3.0 1.0 1.7 GB

blackgnezdo's OpenBSD's ports hacks

Home Page: https://www.openbsd.org

Makefile 0.91% C++ 22.99% Perl 4.41% C 65.39% Roff 3.22% CMake 0.18% Python 0.46% Shell 0.74% Lua 0.01% OCaml 0.04% Vim Script 0.01% HTML 0.68% Emacs Lisp 0.01% JavaScript 0.01% M4 0.14% Yacc 0.38% XSLT 0.01% CSS 0.01% Raku 0.42% Pascal 0.02%

ports's People

Contributors

4a6f656c avatar ajacoutot avatar bluerise avatar bluhm avatar bob-beck avatar botovq avatar cjeker avatar daztucker avatar djmdjm avatar drahn avatar ericfaurot avatar fobser avatar ischwarze avatar jasperla avatar jcourreges avatar jonathangray avatar kettenis avatar marcespie avatar mbelop avatar mfriedl avatar mpieuchot avatar nicm avatar omoerbeek avatar poolporg avatar ratchov avatar reyk avatar sthen avatar stspdotname avatar vhankala avatar xsa avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mkilian

ports's Issues

ghci-iserv is broken

% ghci -fexternal-interpreter                                                                                                                           
GHCi, version 8.10.1: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/greg/.ghci
Prelude
> ghc-iserv: internal error: evacuate: strange closure type 400513752
    (GHC version 8.10.1 for x86_64_unknown_openbsd)
    Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

ld: error: can't create dynamic relocation R_X86_64_32S against symbol in readonly segment

"rm" -f rts/dist/build/libHSrts-ghc8.10.0.20200123.so
"inplace/bin/ghc-stage1" -this-unit-id rts -shared -dynamic -dynload deploy -no-auto-link-packages  `cat rts/dist/libs.depend` rts/dist/build/Adjustor.dyn_o rts/dist/build/Arena.dyn_o rts/dist/build/Capability.dyn_o rts/dist/build/CheckUnload.dyn_o rts/dist/build/ClosureFlags.dyn_o rts/dist/build/Disassembler.dyn_o rts/dist/build/FileLock.dyn_o rts/dist/build/Globals.dyn_o rts/dist/build/Hash.dyn_o rts/dist/build/Heap.dyn_o rts/dist/build/Hpc.dyn_o rts/dist/build/HsFFI.dyn_o rts/dist/build/Inlines.dyn_o rts/dist/build/Interpreter.dyn_o rts/dist/build/LdvProfile.dyn_o rts/dist/build/Libdw.dyn_o rts/dist/build/LibdwPool.dyn_o rts/dist/build/Linker.dyn_o rts/dist/build/Messages.dyn_o rts/dist/build/OldARMAtomic.dyn_o rts/dist/build/PathUtils.dyn_o rts/dist/build/Pool.dyn_o rts/dist/build/Printer.dyn_o rts/dist/build/ProfHeap.dyn_o rts/dist/build/ProfilerReport.dyn_o rts/dist/build/ProfilerReportJson.dyn_o rts/dist/build/Profiling.dyn_o rts/dist/build/Proftimer.dyn_o rts/dist/build/RaiseAsync.dyn_o rts/dist/build/RetainerProfile.dyn_o rts/dist/build/RetainerSet.dyn_o rts/dist/build/RtsAPI.dyn_o rts/dist/build/RtsDllMain.dyn_o rts/dist/build/RtsFlags.dyn_o rts/dist/build/RtsMain.dyn_o rts/dist/build/RtsMessages.dyn_o rts/dist/build/RtsStartup.dyn_o rts/dist/build/RtsSymbolInfo.dyn_o rts/dist/build/RtsSymbols.dyn_o rts/dist/build/RtsUtils.dyn_o rts/dist/build/STM.dyn_o rts/dist/build/Schedule.dyn_o rts/dist/build/Sparks.dyn_o rts/dist/build/StableName.dyn_o rts/dist/build/StablePtr.dyn_o rts/dist/build/StaticPtrTable.dyn_o rts/dist/build/Stats.dyn_o rts/dist/build/StgCRun.dyn_o rts/dist/build/StgPrimFloat.dyn_o rts/dist/build/Task.dyn_o rts/dist/build/ThreadLabels.dyn_o rts/dist/build/ThreadPaused.dyn_o rts/dist/build/Threads.dyn_o rts/dist/build/Ticky.dyn_o rts/dist/build/Timer.dyn_o rts/dist/build/TopHandler.dyn_o rts/dist/build/Trace.dyn_o rts/dist/build/TraverseHeap.dyn_o rts/dist/build/WSDeque.dyn_o rts/dist/build/Weak.dyn_o rts/dist/build/fs.dyn_o rts/dist/build/xxhash.dyn_o rts/dist/build/hooks/FlagDefaults.dyn_o rts/dist/build/hooks/LongGCSync.dyn_o rts/dist/build/hooks/MallocFail.dyn_o rts/dist/build/hooks/OnExit.dyn_o rts/dist/build/hooks/OutOfHeap.dyn_o rts/dist/build/hooks/StackOverflow.dyn_o rts/dist/build/sm/BlockAlloc.dyn_o rts/dist/build/sm/CNF.dyn_o rts/dist/build/sm/Compact.dyn_o rts/dist/build/sm/Evac.dyn_o rts/dist/build/sm/Evac_thr.dyn_o rts/dist/build/sm/GC.dyn_o rts/dist/build/sm/GCAux.dyn_o rts/dist/build/sm/GCUtils.dyn_o rts/dist/build/sm/MBlock.dyn_o rts/dist/build/sm/MarkWeak.dyn_o rts/dist/build/sm/NonMoving.dyn_o rts/dist/build/sm/NonMovingCensus.dyn_o rts/dist/build/sm/NonMovingMark.dyn_o rts/dist/build/sm/NonMovingScav.dyn_o rts/dist/build/sm/NonMovingShortcut.dyn_o rts/dist/build/sm/NonMovingSweep.dyn_o rts/dist/build/sm/Sanity.dyn_o rts/dist/build/sm/Scav.dyn_o rts/dist/build/sm/Scav_thr.dyn_o rts/dist/build/sm/Storage.dyn_o rts/dist/build/sm/Sweep.dyn_o rts/dist/build/eventlog/EventLog.dyn_o rts/dist/build/eventlog/EventLogWriter.dyn_o rts/dist/build/linker/CacheFlush.dyn_o rts/dist/build/linker/Elf.dyn_o rts/dist/build/linker/LoadArchive.dyn_o rts/dist/build/linker/M32Alloc.dyn_o rts/dist/build/linker/MachO.dyn_o rts/dist/build/linker/PEi386.dyn_o rts/dist/build/linker/SymbolExtras.dyn_o rts/dist/build/linker/elf_got.dyn_o rts/dist/build/linker/elf_plt.dyn_o rts/dist/build/linker/elf_plt_aarch64.dyn_o rts/dist/build/linker/elf_plt_arm.dyn_o rts/dist/build/linker/elf_reloc.dyn_o rts/dist/build/linker/elf_reloc_aarch64.dyn_o rts/dist/build/linker/elf_util.dyn_o rts/dist/build/posix/GetEnv.dyn_o rts/dist/build/posix/GetTime.dyn_o rts/dist/build/posix/Itimer.dyn_o rts/dist/build/posix/OSMem.dyn_o rts/dist/build/posix/OSThreads.dyn_o rts/dist/build/posix/Select.dyn_o rts/dist/build/posix/Signals.dyn_o rts/dist/build/posix/TTY.dyn_o   rts/dist/build/Apply.dyn_o rts/dist/build/Compact.dyn_o rts/dist/build/Exception.dyn_o rts/dist/build/HeapStackCheck.dyn_o rts/dist/build/PrimOps.dyn_o rts/dist/build/StgMiscClosures.dyn_o rts/dist/build/StgStartup.dyn_o rts/dist/build/StgStdThunks.dyn_o rts/dist/build/Updates.dyn_o rts/dist/build/AutoApply.dyn_o -optl-Wl,-z -optl-Wl,wxneeded -fPIC -dynamic  -H32m -O -Wall  -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header -Iincludes/dist-install/build -Irts -Irts/dist/build -DCOMPILING_RTS -DFS_NAMESPACE=rts -this-unit-id rts -dcmm-lint      -i -irts -irts/dist/build -Irts/dist/build -irts/dist/build/./autogen -Irts/dist/build/./autogen            -O2 -Wcpp-undef   -Wnoncanonical-monad-instances  -fno-use-rpaths  -optl-Wl,-zorigin  -o rts/dist/build/libHSrts-ghc8.10.0.20200123.so
ld: error: can't create dynamic relocation R_X86_64_32S against symbol: obscure_ccall_ret_code in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/Adjustor.dyn_o
>>> referenced by Adjustor.c:670 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Adjustor.c:670)
>>>               rts/dist/build/Adjustor.dyn_o:(createAdjustor)

ld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/Adjustor.dyn_o
>>> referenced by Adjustor.c:1249 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Adjustor.c:1249)
>>>               rts/dist/build/Adjustor.dyn_o:(freeHaskellFunctionPtr)

ld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/Arena.dyn_o
>>> referenced by Arena.c:44 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Arena.c:44)
>>>               rts/dist/build/Arena.dyn_o:(newArena)

ld: error: can't create dynamic relocation R_X86_64_32 against symbol: MainCapability in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/Capability.dyn_o
>>> referenced by Capability.c:81 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:81)
>>>               rts/dist/build/Capability.dyn_o:(rts_unsafeGetMyCapability)

ld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/Capability.dyn_o
>>> referenced by Capability.c:372 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:372)
>>>               rts/dist/build/Capability.dyn_o:(initCapabilities)

ld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/Capability.dyn_o
>>> referenced by Capability.c:393 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:393)
>>>               rts/dist/build/Capability.dyn_o:(initCapabilities)

ld: error: can't create dynamic relocation R_X86_64_32S against symbol: MainCapability in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/Capability.dyn_o
>>> referenced by Capability.c:394 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:394)
>>>               rts/dist/build/Capability.dyn_o:(initCapabilities)

ld: error: can't create dynamic relocation R_X86_64_32 against symbol: stg_END_TSO_QUEUE_closure in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/StgMiscClosures.dyn_o
>>> referenced by Capability.c:255 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:255)
>>>               rts/dist/build/Capability.dyn_o:(initCapabilities)

ld: error: can't create dynamic relocation R_X86_64_32S against symbol: __stg_EAGER_BLACKHOLE_info in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/StgMiscClosures.dyn_o
>>> referenced by Capability.c:284 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:284)
>>>               rts/dist/build/Capability.dyn_o:(initCapabilities)

ld: error: can't create dynamic relocation R_X86_64_32 against symbol: __stg_gc_fun in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/HeapStackCheck.dyn_o
>>> referenced by Capability.c:285 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:285)
>>>               rts/dist/build/Capability.dyn_o:(initCapabilities)

ld: error: can't create dynamic relocation R_X86_64_32 against symbol: __stg_gc_enter_1 in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/HeapStackCheck.dyn_o
>>> referenced by Capability.c:285 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:285)
>>>               rts/dist/build/Capability.dyn_o:(initCapabilities)

ld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/Capability.dyn_o
>>> referenced by Capability.c:288 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:288)
>>>               rts/dist/build/Capability.dyn_o:(initCapabilities)

ld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/Capability.dyn_o
>>> referenced by Capability.c:291 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:291)
>>>               rts/dist/build/Capability.dyn_o:(initCapabilities)

ld: error: can't create dynamic relocation R_X86_64_32S against symbol: stg_END_STM_WATCH_QUEUE_closure in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/StgMiscClosures.dyn_o
>>> referenced by Capability.c:306 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:306)
>>>               rts/dist/build/Capability.dyn_o:(initCapabilities)

ld: error: can't create dynamic relocation R_X86_64_32S against symbol: stg_END_STM_CHUNK_LIST_closure in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/StgMiscClosures.dyn_o
>>> referenced by Capability.c:307 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:307)
>>>               rts/dist/build/Capability.dyn_o:(initCapabilities)

ld: error: can't create dynamic relocation R_X86_64_32S against symbol: stg_NO_TREC_closure in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/StgMiscClosures.dyn_o
>>> referenced by Capability.c:308 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:308)
>>>               rts/dist/build/Capability.dyn_o:(initCapabilities)

ld: error: can't create dynamic relocation R_X86_64_32S against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/Capability.dyn_o
>>> referenced by Capability.c:406 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:406)
>>>               rts/dist/build/Capability.dyn_o:(initCapabilities)

ld: error: can't create dynamic relocation R_X86_64_32S against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/Capability.dyn_o
>>> referenced by Capability.c:406 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:406)
>>>               rts/dist/build/Capability.dyn_o:(initCapabilities)

ld: error: can't create dynamic relocation R_X86_64_32S against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/Capability.dyn_o
>>> referenced by Capability.c:406 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:406)
>>>               rts/dist/build/Capability.dyn_o:(initCapabilities)

ld: error: can't create dynamic relocation R_X86_64_32S against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist/build/Capability.dyn_o
>>> referenced by Capability.c:406 (/home/greg/ports/pobj/ghc-8.10.0.20200123/ghc-8.10.0.20200123/rts/Capability.c:406)
>>>               rts/dist/build/Capability.dyn_o:(initCapabilities)

ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
`cc' failed in phase `Linker'. (Exit code: 1)
gmake[1]: *** [rts/ghc.mk:323: rts/dist/build/libHSrts-ghc8.10.0.20200123.so] Error 1
gmake: *** [Makefile:128: all] Error 2
*** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2883 '/usr/ports/pobj/ghc-8.10.0.20200123/.build_done': @cd /usr/ports/pobj/ghc-8...)
*** Error 2 in /usr/ports/lang/ghc (/usr/ports/infrastructure/mk/bsd.port.mk:254

hedgewars uses ghc directly

While games/hedgewars has working cabal files in both directories

tools/pas2c/pas2c.cabal
gameServer/hedgewars-server.cabal

they are not used by the build process. The porter is responsible for installing the requisite haskell libraries listed in INSTALL.md. One lucky break is this seems to be a dependency of the -server subpackage and as such can be potentially handled separately.

Haskell binary building with cabal new-build

While looking at Haskell binary ports, a couple of approaches seem
possible.

  1. Embed Haskell libraries into ports, build binaries from them.
  2. Build binaries with cabal new-build

The status quo is 1. This has a few benefits: it exists, libraries
are reused by multiple ports reducing build costs. There are
drawbacks: the ports tree contains a duplicate (and sometimes
inconsistent) specification of Hackage information. Because of this,
upgrades are a big pain and there's a version of DLL (cabal) hell in
that a single compatible library version needs to be chosen for all
ports.

An alternative is 2. Many hs-* library ports could go away by making
each binary port (e.g. darcs, shellcheck) build their own library
dependencies in its sandbox. This will reduce maintenance costs and
avoid any possibility of version conflicts. There are drawbacks: it
doesn't exist, the same library will get built for each binary using
it. We also won't be able to switch to a completely clean 2. Some
ports (like xmonad) use Haskell build as a configuration mechanism. We
still need to provide a subset of ports-embedded libraries in the
style of 1.

If we are to keep doing 1, we should automate maintenance as much as
possible. portgen is an option and so is building a port targeting
version of cabal2bazel (once brought up to date)

If the majority of OpenBSD users only care about using the binaries, I
believe we will serve them better by doing 2 for the binary providing
ports.

Some unknowns apply to design 2:

  • how well we can specify the Hackage snapshot
  • how hermetic we can make it (force tarball fetching to happen
    before running cabal new-build)

Ports with Haskell binaries:

% for i in $(</tmp/all-hs ); do grep '^@bin' $i/pkg/PLIST*>/dev/null && echo $i; done
devel/alex
devel/cabal-install
devel/cpphs
devel/darcs
devel/gmc4cc
devel/happy
devel/hasktags
devel/shellcheck
games/hedgewars
net/hpodder
textproc/hs-HaXml
x11/xmonad
x11/xmobar

All ports (including sub-packages) dependent on ghc:

sqlite> select count(fullpkgpath) from ports where build_depends like '%ghc%';
123

ghc 8.10: ld.lld: error: unable to find library -lHSrts_thr

As of this ports state make fails with:

===>  Building for ghc-8.10.0.20200123
Makefile:121: target 'all' given more than once in the same rule
===--- building phase 0
gmake --no-print-directory -f ghc.mk phase=0 phase_0_builds
gmake[1]: Nothing to be done for 'phase_0_builds'.
===--- building phase 1
gmake --no-print-directory -f ghc.mk phase=1 phase_1_builds
"/usr/ports/pobj/ghc-8.10.0.20200123/bin/ghc" -o ghc/stage1/build/tmp/ghc-stage1 -hisuf hi -osuf  o -hcsuf hc -static  -H32m -O -Wall   -package-db libraries/bootstrapping.conf  -hide-all-packages -i -ighc/. -ighc/stage1/build -Ighc/stage1/build -ighc/stage1/build/ghc/autogen -Ighc/stage1/build/ghc/autogen     -optP-include -optPghc/stage1/build/ghc/autogen/cabal_macros.h -package-id array-0.5.3.0 -package-id base-4.12.0.0 -package-id bytestring-0.10.8.2 -package-id directory-1.3.3.0 -package-id filepath-1.4.2.1 -package-id ghc-8.10.0.20200123 -package-id ghc-boot-8.10.0.20200123 -package-id process-1.6.5.0 -package-id transformers-0.5.6.2 -package-id unix-2.7.2.2 -Wall -Wnoncanonical-monad-instances -Wnoncanonical-monoid-instances -threaded -XHaskell2010 -XNoImplicitPrelude  -Wcpp-undef -no-hs-main -no-user-package-db -rtsopts        -outputdir ghc/stage1/build   -optl-Wl,-z -optl-Wl,wxneeded -static  -H32m -O -Wall   -package-db libraries/bootstrapping.conf  -hide-all-packages -i -ighc/. -ighc/stage1/build -Ighc/stage1/build -ighc/stage1/build/ghc/autogen -Ighc/stage1/build/ghc/autogen     -optP-include -optPghc/stage1/build/ghc/autogen/cabal_macros.h -package-id array-0.5.3.0 -package-id base-4.12.0.0 -package-id bytestring-0.10.8.2 -package-id directory-1.3.3.0 -package-id filepath-1.4.2.1 -package-id ghc-8.10.0.20200123 -package-id ghc-boot-8.10.0.20200123 -package-id process-1.6.5.0 -package-id transformers-0.5.6.2 -package-id unix-2.7.2.2 -Wall -Wnoncanonical-monad-instances -Wnoncanonical-monoid-instances -threaded -XHaskell2010 -XNoImplicitPrelude  -Wcpp-undef -no-hs-main -no-user-package-db -rtsopts        ghc/stage1/build/Main.o ghc/stage1/build/hschooks.o   
Warning: -rtsopts and -with-rtsopts have no effect with -no-hs-main.
    Call hs_init_ghc() from your main() function to set these options.
ld.lld: error: unable to find library -lHSrts_thr
cc: error: linker command failed with exit code 1 (use -v to see invocation)
`cc' failed in phase `Linker'. (Exit code: 1)
gmake[1]: *** [ghc/ghc.mk:111: ghc/stage1/build/tmp/ghc-stage1] Error 1
gmake: *** [Makefile:126: all] Error 2
*** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2883 '/usr/ports/pobj/ghc-8.10.0.20200123/.build_done': @cd /usr/ports/pobj/ghc-8...)
*** Error 2 in /usr/ports/lang/ghc (/usr/ports/infrastructure/mk/bsd.port.mk:2549 'all': @lock=ghc-8.10.0.20200123;  export _LOCKS_HELD=" gh...)

./configure[11253]: Sphinx (sphinx-build) 1: unexpected `('

Initial configure run seems to be going awry:

checking for version of sphinx-build... Sphinx (sphinx-build) 1.4.8
./configure[11253]: Sphinx (sphinx-build) 1: unexpected `('
configure: WARNING: Sphinx for python3 is required to build documentation.

ghci very slow to start

4 minutes is a bit much to start ghci. All the time is spent after Loading package integer-gmp-1.0.3.0 ...

% echo :q | time ghci -v
GHCi, version 8.10.2: https://www.haskell.org/ghc/  :? for help
Glasgow Haskell Compiler, Version 8.10.2, stage 2 booted by GHC version 8.6.4.20200103
*** initializing package database:
Using binary package database: /usr/local/lib/ghc/package.conf.d/package.cache
There is no package.cache in /home/greg/.ghc/x86_64-openbsd-8.10.2/package.conf.d, checking if the database is empty
There are no .conf files in /home/greg/.ghc/x86_64-openbsd-8.10.2/package.conf.d, treating package database as empty
...
!!! ByteCodeGen [Ghci1]: finished in 10.00 milliseconds, allocated 0.035 megabytes
Loading package ghc-prim-0.6.1 ... linking ... done.
Loading package integer-gmp-1.0.3.0 ... linking ... done.
Loading package base-4.14.1.0 ... linking ... done.
Search directories (user):
Search directories (gcc):
*** Desugar:
*** Simplify [expr]:
!!! Simplify [expr]: finished in 0.00 milliseconds, allocated 0.048 megabytes
*** CorePrep [expr]:
!!! CorePrep [expr]: finished in 0.00 milliseconds, allocated 0.019 megabytes
*** ByteCodeGen [Ghci1]:
!!! ByteCodeGen [Ghci1]: finished in 0.00 milliseconds, allocated 0.033 megabytes
*** Desugar:
*** Simplify [expr]:
!!! Simplify [expr]: finished in 0.00 milliseconds, allocated 0.065 megabytes
*** CorePrep [expr]:
!!! CorePrep [expr]: finished in 0.00 milliseconds, allocated 0.027 megabytes
*** ByteCodeGen [Ghci1]:
!!! ByteCodeGen [Ghci1]: finished in 0.00 milliseconds, allocated 0.071 megabytes
Loaded GHCi configuration from /home/greg/.ghci
Prelude
> Leaving GHCi.
*** Deleting temp files:
Deleting: 
*** Deleting temp dirs:
Deleting: 
ghci -v  18.04s user 236.90s system 98% cpu 4:17.67 total

ktrace shows a huge number of

 14162 ghc      CALL  mmap(0x449f5000,0x20000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,-1,0)
 14162 ghc      RET   mmap 1211195392/0x48316000
 14162 ghc      CALL  munmap(0x48316000,0x20000)
 14162 ghc      RET   munmap 0
 14162 ghc      CALL  mmap(0x449f6000,0x20000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,-1,0)
 14162 ghc      RET   mmap 1211195392/0x48316000
 14162 ghc      CALL  munmap(0x48316000,0x20000)
 14162 ghc      RET   munmap 0
 14162 ghc      CALL  mmap(0x449f7000,0x20000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,-1,0)
 14162 ghc      RET   mmap 1211195392/0x48316000
 14162 ghc      CALL  munmap(0x48316000,0x20000)
 14162 ghc      RET   munmap 0
 14162 ghc      CALL  mmap(0x449f8000,0x20000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,-1,0)
 14162 ghc      RET   mmap 1211195392/0x48316000
 14162 ghc      CALL  munmap(0x48316000,0x20000)
 14162 ghc      RET   munmap 0
...
 14162 ghc      CALL  mmap(0x48314000,0x20000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,-1,0)
 14162 ghc      RET   mmap 1211195392/0x48316000
 14162 ghc      CALL  munmap(0x48316000,0x20000)
 14162 ghc      RET   munmap 0
 14162 ghc      CALL  mmap(0x48315000,0x20000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,-1,0)
 14162 ghc      RET   mmap 1211195392/0x48316000
 14162 ghc      CALL  munmap(0x48316000,0x20000)
 14162 ghc      RET   munmap 0

Looks like ghc tries to map a particular address, the kernel gives it a different address, ghc munmaps and keeps retrying until it gets the address it wants.

 14162 ghc      CALL  mmap(0x48316000,0x20000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,-1,0)
 14162 ghc      RET   mmap 1211195392/0x48316000
 14162 ghc      CALL  mmap(0,0x1000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,-1,0)
 14162 ghc      RET   mmap 2457674936320/0x23c38d77000
 14162 ghc      CALL  mmap(0,0x1000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,-1,0)
 14162 ghc      RET   mmap 2455801303040/0x23bc92a1000
 14162 ghc      CALL  mmap(0,0x3000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,-1,0)
 14162 ghc      RET   mmap 2454304342016/0x23b6ff04000
 14162 ghc      CALL  mmap(0,0x2000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,-1,0)
 14162 ghc      RET   mmap 2453764444160/0x23b4fc21000
 14162 ghc      CALL  mmap(0,0x2000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,-1,0)
 14162 ghc      RET   mmap 2455204917248/0x23ba59df000
 14162 ghc      CALL  mmap(0,0x1000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,-1,0)
 14162 ghc      RET   mmap 2453756563456/0x23b4f49d000

ANN module crashes ghc 8.6.4 with a bus error on OpenBSD

I'm in the process of upgrading to GHC 8.6.4 on OpenBSD-6.5-amd64-stable on this branch in repo.

I hit a bus error when porting fgl, but then reduced the problem to a
trivially reproducible one below. I've also stored a log from -v9 run
in
https://gist.githubusercontent.com/blackgnezdo/633a4e499c9d8162d74fbf620c9c05ec/raw/5006c836a11995b78d8d23d8443be76d2f052f4c/ghc8.6.4-openbsd-ann-module-crash.txt

% cat a.hs
{-# ANN module "" #-}

% /usr/local/bin/ghc -v --interactive a.hs
GHCi, version 8.6.4: http://www.haskell.org/ghc/  :? for help
Glasgow Haskell Compiler, Version 8.6.4, stage 2 booted by GHC version
8.4.2.20190113
Using binary package database:
/usr/local/lib/ghc/package.conf.d/package.cache
package flags []
loading package database /usr/local/lib/ghc/package.conf.d
wired-in package ghc-prim mapped to ghc-prim-0.5.3
wired-in package integer-gmp mapped to integer-gmp-1.0.2.0
wired-in package base mapped to base-4.12.0.0
wired-in package rts mapped to rts
wired-in package template-haskell mapped to template-haskell-2.14.0.0
wired-in package ghc mapped to ghc-8.6.4
package flags []
loading package database /usr/local/lib/ghc/package.conf.d
wired-in package ghc-prim mapped to ghc-prim-0.5.3
wired-in package integer-gmp mapped to integer-gmp-1.0.2.0
wired-in package base mapped to base-4.12.0.0
wired-in package rts mapped to rts-1.0
wired-in package template-haskell mapped to template-haskell-2.14.0.0
wired-in package ghc mapped to ghc-8.6.4
*** Parser [source]:
!!! Parser [source]: finished in 0.00 milliseconds, allocated 0.182
megabytes
*** Desugar:
*** Simplify [expr]:
!!! Simplify [expr]: finished in 0.00 milliseconds, allocated 0.124
megabytes
*** CorePrep [expr]:
!!! CorePrep [expr]: finished in 10.00 milliseconds, allocated 1.763
megabytes
*** ByteCodeGen [Ghci1]:
!!! ByteCodeGen [Ghci1]: finished in 0.00 milliseconds, allocated 0.135
megabytes
Loading package ghc-prim-0.5.3 ... linking ... done.
Loading package integer-gmp-1.0.2.0 ... linking ... done.
Loading package base-4.12.0.0 ... linking ... done.
Search directories (user):
Search directories (gcc):
*** Parser [source]:
!!! Parser [source]: finished in 0.00 milliseconds, allocated 0.050
megabytes
*** Desugar:
*** Simplify [expr]:
!!! Simplify [expr]: finished in 10.00 milliseconds, allocated 0.069
megabytes
*** CorePrep [expr]:
!!! CorePrep [expr]: finished in 0.00 milliseconds, allocated 0.022
megabytes
*** ByteCodeGen [Ghci1]:
!!! ByteCodeGen [Ghci1]: finished in 0.00 milliseconds, allocated 0.082
megabytes
*** Parser [source]:
!!! Parser [source]: finished in 0.00 milliseconds, allocated 0.085
megabytes
*** Desugar:
*** Simplify [expr]:
!!! Simplify [expr]: finished in 0.00 milliseconds, allocated 0.076
megabytes
*** CorePrep [expr]:
!!! CorePrep [expr]: finished in 0.00 milliseconds, allocated 0.022
megabytes
*** ByteCodeGen [Ghci1]:
!!! ByteCodeGen [Ghci1]: finished in 0.00 milliseconds, allocated 0.098
megabytes
*** Chasing dependencies:
Chasing modules from:
!!! Chasing dependencies: finished in 0.00 milliseconds, allocated 0.017
megabytes
Stable obj: []
Stable BCO: []
unload: retaining objs []
unload: retaining bcos []
Ready for upsweep []
Upsweep completely successful.
*** Deleting temp files:
Deleting:
*** Chasing dependencies:
Chasing modules from: */home/greg/a.hs
!!! Chasing dependencies: finished in 10.00 milliseconds, allocated 0.215
megabytes
Stable obj: []
Stable BCO: []
unload: retaining objs []
unload: retaining bcos []
Ready for upsweep
  [NONREC
      ModSummary {
         ms_hs_date = 2019-06-02 16:39:24.038862383 UTC
         ms_mod = Main,
         ms_textual_imps = [(Nothing, Prelude)]
         ms_srcimps = []
      }]
*** Deleting temp files:
Deleting:
compile: input file /home/greg/a.hs
*** Checking old interface for Main (use -ddump-hi-diffs for more details):
[1 of 1] Compiling Main             ( /home/greg/a.hs, interpreted )
*** Parser [Main]:
!!! Parser [Main]: finished in 0.00 milliseconds, allocated 0.049 megabytes
*** Renamer/typechecker [Main]:
*** Simplify [expr]:
!!! Simplify [expr]: finished in 0.00 milliseconds, allocated 0.029
megabytes
*** CorePrep [expr]:
!!! CorePrep [expr]: finished in 0.00 milliseconds, allocated 0.010
megabytes
*** ByteCodeGen [Ghci1]:
!!! ByteCodeGen [Ghci1]: finished in 0.00 milliseconds, allocated 0.033
megabytes
[1]    59488 bus error (core dumped)  /usr/local/bin/ghc -v --interactive
~/a.hs

Signed vs unsigned exit code

% ghci /usr/ports/pobj/ghc-8.10.1/ghc-8.10.1/libraries/process/tests/process009.hs                                                        > :main
ExitFailure 129
Just (ExitFailure 129)
Just (ExitFailure 129)

Expected:

% cat /usr/ports/pobj/ghc-8.10.1/ghc-8.10.1/libraries/process/tests/process009.stdout
ExitFailure (-1)
Just (ExitFailure (-1))
Just (ExitFailure (-1))

This is probably fine and should be fixed in the test suite since ExitFailure Int is documented as
indicates program failure with an exit code. The exact interpretation of the code is operating-system dependent.

tanf fails in Numeric/num009.hs

% ghci /usr/ports/pobj/ghc-8.10.1/ghc-8.10.1/libraries/base/tests/Numeric/num009.hs

> :main
uh oh! tanf 1.0e20
-Infinity
NaN
(-8388608,105)
(-12582912,105)
Done

Support running cabal v2-test

This may require a separate test-only manifest and careful distfiles tracking. This fragment will probably be useful.

modified   devel/cabal/cabal.port.mk
@@ -125,3 +125,12 @@ do-build:
 do-install:
 	@${MODCABAL_INSTALL_TARGET}
 .endif
+
+MODCABAL_TEST_TARGET = \
+	cd ${WRKBUILD} \
+	&& ${MODCABAL_CABAL} v2-test --offline --disable-benchmarks
+
+.if !target(do-test)
+do-test:
+	${MODCABAL_TEST_TARGET}
+.endif

getCPUTime returns fixed value with -threaded

This test fails:

lib/base/T16916.run T16916 [bad stdout] (normal)

Once instrumented with some prints the output is puzzling:

% ghc -threaded -O2 -o /tmp/a /tmp/a.hs                                                                                                   
Linking /tmp/a ...
% /tmp/a                                                                                                                                  "startCPUTime 0"
"endCPUTime 0"
"startTime 174897.364331696"
"endTime 174902.38197417"
"startCPUTime 0"
"endCPUTime 0"
"startTime 174902.382501444"
"endTime 174907.391930155"
False
eventTriggeredUsage 0.0
noEventUsage 0.0

In other cases observed:

% /tmp/a                                                                                                                                  
"startCPUTime 20000000000"
"endCPUTime 20000000000"
"startTime 175015.590683467"
"endTime 175020.610736021"
"startCPUTime 20000000000"
"endCPUTime 20000000000"
"startTime 175020.611046369"
"endTime 175025.63069346"
False
eventTriggeredUsage 0.0
noEventUsage 0.0

Apparently getCPUTime returns a fixed value. At the same time, when executed from ghci this doesn't reproduce:

% ghci
GHCi, version 8.10.1: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/greg/.ghci
Prelude     
> import System.CPUTime      
> mapM_ (\_ -> getCPUTime >>= print) [0..30]
780000000000
780000000000
...
790000000000            
790000000000                
790000000000             
...
800000000000
800000000000           

Instrumented source:

module Main where

import Control.Concurrent
import Foreign.C
import GHC.Clock
import GHC.Event
import System.CPUTime
import System.Posix.Types

foreign import ccall unsafe "socket" c_socket ::
               CInt -> CInt -> CInt -> IO CInt

makeTestSocketFd :: IO Fd
makeTestSocketFd = do
    sockNum <-
        c_socket
            1 -- PF_LOCAL
            2 -- SOCK_DGRAM
            0
    return $ (fromIntegral sockNum :: Fd)

callback :: FdKey -> Event -> IO ()
callback _ _ = return ()

-- Idle CPU usage with 0 for 0% and 10^12 for 100%
idleCpuUsage :: IO Double
idleCpuUsage = do
  startTime <- getMonotonicTime
  startCPUTime <- getCPUTime
  threadDelay 15000000
  endCPUTime <- getCPUTime
  endTime <- getMonotonicTime

  print $ "startCPUTime " ++ show startCPUTime
  print $ "endCPUTime " ++ show endCPUTime
  print $ "startTime " ++ show startTime
  print $ "endTime " ++ show endTime
  
  return $ fromIntegral (endCPUTime - startCPUTime) / (endTime - startTime)

main :: IO ()
main = do
  (Just eventMgr) <- getSystemEventManager
  fd <- makeTestSocketFd

  noEventUsage <- idleCpuUsage

  registerFd eventMgr callback fd evtRead OneShot
  registerFd eventMgr callback fd evtWrite OneShot

  eventTriggeredUsage <- idleCpuUsage

  -- CPU consumption should roughly be the same when just idling vs
  -- when idling after the event been triggered
  print $ eventTriggeredUsage / noEventUsage < 10.0
  putStrLn $ "eventTriggeredUsage " ++ show eventTriggeredUsage
  putStrLn $ "noEventUsage " ++ show noEventUsage

shellcheck update for ghc 8.6.4

In my quest to update the ports tree to ghc 8.6.4 I arrived at a fork re
ShellCheck.

The first blocker is ANN/TemplateHaskell is broken per #1 enough that
patching is required to get rid of all ShellCheck testing code. Now,
the next snag is the ancient version of ShellCheck in ports. At least
a couple of places need to be patched for Semigroup and MonadFail
issues. My natural impulse would be to upgrade ShellCheck to the most
recent version 0.6.0, except it has a larger dependency
set and at least aeson is not in ports. At this point I'm not sure
which way to go. Is the new version with a larger set of deps a better
option? Or the patched-up old version? Since I personally don't use
ShellCheck, I can't make the call easily. Opinions? Patches?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.