deech / fltkhs Goto Github PK
View Code? Open in Web Editor NEWHaskell bindings to FLTK GUI toolkit.
License: MIT License
Haskell bindings to FLTK GUI toolkit.
License: MIT License
widgetMaker rectangle _label' draw' customFuncs' new' newWithLabel' newWithCustomFuncs' newWithCustomFuncsLabel' =
let (x_pos, y_pos, width, height) = fromRectangle rectangle
in case (_label', customFuncs') of
(Nothing,Nothing) -> new' x_pos y_pos width height >>= toRef
((Just l), Nothing) -> newWithLabel' x_pos y_pos width height l >>= toRef
((Just l), (Just fs)) -> do
ptr <- customWidgetFunctionStruct draw' fs
newWithCustomFuncsLabel' x_pos y_pos width height l (castPtr ptr) >>= toRef
(Nothing, (Just fs)) -> do
ptr <- customWidgetFunctionStruct draw' fs
newWithCustomFuncs' x_pos y_pos width height (castPtr ptr) >>= toRef
In the first two cases of the case
the draw'
function is ignored.
cabal-install -fbundled -fopengl fltkhs
fails because it can't find the fltk-config
that it built. There is a workaround and I have got it installed now, reporting this in case someone else has the same problem.
$ cabal install -fbundled -fopengl fltkhs
Resolving dependencies...
Notice: installing into a sandbox located at
/home/claude/code/borok/et/.cabal-sandbox
Configuring fltkhs-0.5.4.4...
Failed to install fltkhs-0.5.4.4
Build log ( /home/claude/code/borok/et/.cabal-sandbox/logs/fltkhs-0.5.4.4.log ):
cabal: Entering directory '/tmp/cabal-tmp-9029/fltkhs-0.5.4.4'
[1 of 1] Compiling Main ( /tmp/cabal-tmp-9029/fltkhs-0.5.4.4/dist/dist-sandbox-953b16d5/setup/setup.hs, /tmp/cabal-tmp-9029/fltkhs-0.5.4.4/dist/dist-sandbox-953b16d5/setup/Main.o )
Linking /tmp/cabal-tmp-9029/fltkhs-0.5.4.4/dist/dist-sandbox-953b16d5/setup/setup ...
Building bundled FLTK
FLTK already built.
Running autoconf ...
Configuring fltkhs-0.5.4.4...
fltk-config: runInteractiveProcess: runInteractiveProcess: exec: does not exist (No such file or directory)cabal: Leaving directory '/tmp/cabal-tmp-9029/fltkhs-0.5.4.4'
cabal: Error: some packages failed to install:
fltkhs-0.5.4.4 failed during the configure step. The exception was:
ExitFailure 1
The bundled FLTK is built, but cabal can't find the built fltk-config
:
$ find "fltk-config"
./.cabal-sandbox/lib/fltk-bundled/bin/fltk-config
Symlinking the binaries to somewhere cabal-install
looks allows the build to proceed when retrying:
$ cd .cabal-sandbox/bin/
$ ln -s ../lib/fltk-bundled/bin/fltk-config
$ ln -s ../lib/fltk-bundled/bin/fluid
$ cd ../..
$ cabal install -fbundled -fopengl fltkhs
Resolving dependencies...
Notice: installing into a sandbox located at
/home/claude/code/borok/et/.cabal-sandbox
Configuring fltkhs-0.5.4.4...
Building fltkhs-0.5.4.4...
Warning: /tmp/pkgConf-fltkhs-0.5.47833686901102520059.4: Unrecognized field
abi-depends on line 107
/tmp/pkgConf-fltkhs-0.5.47833686901102520059.4: Unrecognized field indefinite
on line 15
Installed fltkhs-0.5.4.4
Updating documentation index
/home/claude/code/borok/et/.cabal-sandbox/share/ghc-8.0.1/doc/index.html
Versions, currently using those supplied by Debian Stretch (current stable):
$ cabal --version
cabal-install version 1.24.0.1
compiled using version 1.24.1.0 of the Cabal library
$ ghc -V
The Glorious Glasgow Haskell Compilation System, version 8.0.1
The documentation on running FLTKHS in a REPL is quite extensive: it consists of a title.
Naively running stack repl
, stack ghci
, stack exec -- ghci
, stack exec -- cabal repl
or any variants just creates opaque errors about missing libraries (libfltkc-dyn.so
) and undefined symbols (Fl_Adjuster_New
). The packaging tricks kill stack-less ways to run ghci. Normally this is a sign that something is missing in the .cabal file. In this case it's probably just some flag. But I have no idea what it could be. The general result is the same in bundled and unbundled builds, and it persists since I first took a look a few weeks ago. I am not certain if the missing parts changed in the meantime though.
All the type level trickery, lack of naming conventions, documentation-by-error-messages and the fact that types are spread all over the libraries seems to imply that these libraries were designed to be explored interactively. The downside is that it's almost impossible for a newcomer to get a grip on things without help by ghci. Therefore, this is an important part of the environment that should be documented.
Encountered in fltkhs-demos, fltkhs-fluid-demos, fltkhs-hello-world, and fltkhs on Debian 8 with stack 1.1.2, ghc 8.0.2, cabal-install 1.24.0.2.
On Windows the configuration of the bundled fltk library fails saying it is missing the X11 libraries, which we don't need.
It appears my build platform isn't detected correctly.
By passing the flag --build=mingw32
to the fltk configure step it builds correctly.
I'm using msys2
for the build environment.
See related discussion: https://groups.google.com/forum/#!topic/fltkgeneral/sHq2LeoXRfI
Cabal is perfectly capable of building C/C++ files and can link them with the fltkhs
library. Perhaps the custom Setup.hs
isn't needed then.
Building with c2hs 0.17.2 (debian jessie default) fails:
src/Graphics/UI/FLTK/LowLevel/Button.chs:116: (column 66) [ERROR] >>> Missing "out" marshaller!
There is no default marshaller for this combination of Haskell and C type:
Haskell type: CInt
C type : CInt
0.26.2 is fine. Not sure, however, how to include such a constraint in the cabal file, so this is just an issue report instead of a PR.
Citing from http://hydra.cryp.to/build/578083/nixlog/2/raw:
[1 of 1] Compiling Main ( Setup.hs, /tmp/nix-build-haskell-fltkhs-0.1.0.0.drv-0/Main.o )
Setup.hs:168:51: Not in scope: ‘buildNumJobs’
The install instructions for Windows build fltk from source in a MSYS2 environment, why not use the package that is already present?
$ pacman -Ss fltk
mingw32/mingw-w64-i686-fltk 1.3.4-1
C++ user interface toolkit (mingw-w64)
mingw64/mingw-w64-x86_64-fltk 1.3.4-1
C++ user interface toolkit (mingw-w64)
I might have missed something, as this is the first widget I looked for - but it doesn't seem like this library wraps http://www.fltk.org/doc-1.3/classFl__Tile.html
currently fltkhs
is MIT licensed.
http://www.fltk.org says
FLTK is provided under the terms of the GNU Library Public License, Version 2 with exceptions that allow for static linking.
iiuc, end-user apps that statically link can be licensed more permissively (?). but fltkhs
bundles the source too.
osx el capitan install.
Following readme instructions:
> brew install --devel fltk
> fltk-config --version
1.3.4
> git clone http://github.com/deech/fltkhs-hello-world
> cd fltkhs-hello-world
> stack --version
Version 1.3.2 x86_64 hpack-0.15.0
> stack install
stack install errors with:
ltkhs-0.5.0.2: configure
Progress: 3/4
-- While building package fltkhs-0.5.0.2 using:
/private/var/folders/h1/yhtz6g614_g999nh_tb4gj600000gn/T/stack18814/fltkhs-0.5.0.2/.stack-work/dist/x86_64-osx/Cabal-1.24.0.0/setup/setup --builddir=.stack-work/dist/x86_64-osx/Cabal-1.24.0.0 configure --with-ghc=/Users/tonyday/.stack/programs/x86_64-osx/ghc-8.0.1/bin/ghc --with-ghc-pkg=/Users/tonyday/.stack/programs/x86_64-osx/ghc-8.0.1/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/Users/tonyday/.stack/snapshots/x86_64-osx/lts-7.16/8.0.1/pkgdb --package-db=/Users/tonyday/git/fltkhs-hello-world/.stack-work/install/x86_64-osx/lts-7.16/8.0.1/pkgdb --libdir=/Users/tonyday/git/fltkhs-hello-world/.stack-work/install/x86_64-osx/lts-7.16/8.0.1/lib --bindir=/Users/tonyday/git/fltkhs-hello-world/.stack-work/install/x86_64-osx/lts-7.16/8.0.1/bin --datadir=/Users/tonyday/git/fltkhs-hello-world/.stack-work/install/x86_64-osx/lts-7.16/8.0.1/share --libexecdir=/Users/tonyday/git/fltkhs-hello-world/.stack-work/install/x86_64-osx/lts-7.16/8.0.1/libexec --sysconfdir=/Users/tonyday/git/fltkhs-hello-world/.stack-work/install/x86_64-osx/lts-7.16/8.0.1/etc --docdir=/Users/tonyday/git/fltkhs-hello-world/.stack-work/install/x86_64-osx/lts-7.16/8.0.1/doc/fltkhs-0.5.0.2 --htmldir=/Users/tonyday/git/fltkhs-hello-world/.stack-work/install/x86_64-osx/lts-7.16/8.0.1/doc/fltkhs-0.5.0.2 --haddockdir=/Users/tonyday/git/fltkhs-hello-world/.stack-work/install/x86_64-osx/lts-7.16/8.0.1/doc/fltkhs-0.5.0.2 --dependency=base=base-4.9.0.0 --dependency=bytestring=bytestring-0.10.8.1 --dependency=directory=directory-1.2.6.2 --dependency=filepath=filepath-1.4.1.0 --dependency=mtl=mtl-2.2.1-6qsR1PHUy5lL47Hpoa4jCM --dependency=parsec=parsec-3.1.11-LpfwwmNNJ2sE9xLSsn0mIx --dependency=text=text-1.2.2.0-3a9dYmy0lx7FK5kPXUTTi5
Process exited with code: ExitFailure 77
Logs have been written to: /Users/tonyday/git/fltkhs-hello-world/.stack-work/logs/fltkhs-0.5.0.2.log
[1 of 2] Compiling Main ( /private/var/folders/h1/yhtz6g614_g999nh_tb4gj600000gn/T/stack18814/fltkhs-0.5.0.2/Setup.hs, /private/var/folders/h1/yhtz6g614_g999nh_tb4gj600000gn/T/stack18814/fltkhs-0.5.0.2/.stack-work/dist/x86_64-osx/Cabal-1.24.0.0/setup/Main.o )
[2 of 2] Compiling StackSetupShim ( /Users/tonyday/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /private/var/folders/h1/yhtz6g614_g999nh_tb4gj600000gn/T/stack18814/fltkhs-0.5.0.2/.stack-work/dist/x86_64-osx/Cabal-1.24.0.0/setup/StackSetupShim.o )
Linking /private/var/folders/h1/yhtz6g614_g999nh_tb4gj600000gn/T/stack18814/fltkhs-0.5.0.2/.stack-work/dist/x86_64-osx/Cabal-1.24.0.0/setup/setup ...
Running autoconf ...
Configuring fltkhs-0.5.0.2...
configure: WARNING: unrecognized options: --with-compiler
checking whether the C++ compiler works... no
configure: error: in `/private/var/folders/h1/yhtz6g614_g999nh_tb4gj600000gn/T/stack18814/fltkhs-0.5.0.2':
configure: error: C++ compiler cannot create executables
See `config.log' for more details
Any ideas on debugging?
cabal install fltkhs
seems to work fine, while this doesn't:
$ stack install fltkhs
Cabal file warning in /Users/divanov/.config/yi/.stack-work/downloaded/d88bb8ad3fdcf2e28902e66d2733d9d066a4e8df893d35142c4fecb1a7457364/fltkhs.cabal: This package requires at least Cabal version 1.24
Cabal file warning in /Users/divanov/.config/yi/.stack-work/downloaded/d88bb8ad3fdcf2e28902e66d2733d9d066a4e8df893d35142c4fecb1a7457364/fltkhs.cabal: This package requires at least Cabal version 1.24
fltkhs-0.4.0.7: build
Preprocessing library fltkhs-0.4.0.7...
<no location info>: error:
module ‘Graphics.UI.FLTK.LowLevel.Ask’ is a package module
-- While building package fltkhs-0.4.0.7 using:
/Users/divanov/.config/yi/.stack-work/downloaded/d88bb8ad3fdcf2e28902e66d2733d9d066a4e8df893d35142c4fecb1a7457364/.stack-work/dist/x86_64-osx/Cabal-1.24.0.0/setup/setup --builddir=.stack-work/dist/x86_64-osx/Cabal-1.24.0.0 build lib:fltkhs exe:fltkhs-buttons exe:fltkhs-fluidtohs --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
This is happening on OSX 10.11.
Hello! I am 90% sure this is user error on my part, but I am posting here for help. I have a project that uses fltkhs
(just a number of simple executable files that I am making small testing programs with). All of the programs work great and can find the compiled fltk modules, thanks to, I'm assuming, the following line in the .cabal
files:
ghc-Options: -pgml g++ "-optl-Wl,--whole-archive" "-optl-Wl,-Bstatic" "-optl-Wl,-lfltkc" "-optl-Wl,-Bdynamic" "-optl-Wl,--no-whole-archive"
However, when I run cabal repl
, I think the fltk files are not found. I get the following error:
$ cabal repl
Preprocessing executable 'basic' for testing-fltkhs-0.1.0.0...
GHCi, version 7.10.2: http://www.haskell.org/ghc/ :? for help
<command line>: can't load .so/.DLL for: /home/david/scratch/fltkhs/.cabal-sandbox/lib/x86_64-l
inux-ghc-7.10.2/fltkh_6U9r2TsApb78yY6ZxCRDjK/libHSfltkhs-0.3.0.0-6U9r2TsApb78yY6ZxCRDjK-ghc7.10
.2.so (/home/david/scratch/fltkhs/.cabal-sandbox/lib/x86_64-linux-ghc-7.10.2/fltkh_6U9r2TsApb78
yY6ZxCRDjK/libHSfltkhs-0.3.0.0-6U9r2TsApb78yY6ZxCRDjK-ghc7.10.2.so: undefined symbol: _ZTVN10__
cxxabiv120__si_class_type_infoE)
I am on Arch Linux, which comes with another fltk
package. That package doesn't work with fltkhs
, so I downloaded and manually compiled fltk
version 1.3.3 like you said in the README. Again, the example work fun when executed with cabal run
. I think the error here is because cabal repl
is using the Arch Linux version of fltk
, and not the version I manually compiled.
My question is, does anyone use cabal repl
when working on fltkhs
projects? Is there anything special you have to do to get it to work? Thanks in advance!
ghc-8.0.2 (or Haskell Platform 8.0.2) requires extra setup-depends in the cabal file:
custom-setup
setup-depends:
base >= 4.5 && < 4.11,
Cabal < 1.25,
filepath,
directory
See pull request #48
Successful installed fltkhs-0.5.0.9 but linking my own app to the library fails:
Linking dist\build\App\App.exe ...
g++: error: /mingw32/lib/libfltk_images.a: No such file or directory
g++: error: /mingw32/lib/libfltk_png.a: No such file or directory
g++: error: /mingw32/lib/libfltk_z.a: No such file or directory
g++: error: /mingw32/lib/libfltk_jpeg.a: No such file or directory
g++: error: /mingw32/lib/libfltk_gl.a: No such file or directory
g++: error: /mingw32/lib/libfltk_forms.a: No such file or directory
g++: error: /mingw32/lib/libfltk.a: No such file or directory
`g++' failed in phase `Linker'. (Exit code: 1)
In %APPDATA%\ghc\i386-mingw32-8.0.2\package.conf.d\fltkhs-0.5.0.9-KXyRP22dXDGGi8E4BCALOM.conf
I notice the following linker flags:
ld-options: -mwindows "-Wl,--enable-auto-import"
"-Wl,--enable-runtime-pseudo-reloc" /mingw32/lib/libfltk_images.a
/mingw32/lib/libfltk_png.a /mingw32/lib/libfltk_z.a
/mingw32/lib/libfltk_jpeg.a /mingw32/lib/libfltk_gl.a -lglu32
-lopengl32 /mingw32/lib/libfltk_forms.a /mingw32/lib/libfltk.a
-lole32 -luuid -lcomctl32 -lstdc++
Wasn't expecting the dependency on the static libraries which I suspect are already in the fltkhs
library.
Ignoring typeclass issue, it should be of type Ref window -> IO a -> IO a
/u/taktoa on Reddit reported:
I'm trying to get this to build in Nix, and I'm getting the following linker error:
Linking dist/build/fltkhs-fluidtohs/fltkhs-fluidtohs ...
…/dist/build/libHSfltkhs-0.5.1.4-…-ghc8.0.1.so: undefined reference to `Fl_Timer_New'
…/dist/build/libHSfltkhs-0.5.1.4-…-ghc8.0.1.so: undefined reference to `Fl_OverriddenFile_Browser_New'
…/dist/build/libHSfltkhs-0.5.1.4-…-ghc8.0.1.so: undefined reference to `Fl_File_Browser_New'
…/dist/build/libHSfltkhs-0.5.1.4-…-ghc8.0.1.so: undefined reference to `Fl_OverriddenFile_Browser_New_WithLabel'
…/dist/build/libHSfltkhs-0.5.1.4-…-ghc8.0.1.so: undefined reference to `Fl_OverriddenTimer_New'
…/dist/build/libHSfltkhs-0.5.1.4-…-ghc8.0.1.so: undefined reference to `Fl_File_Browser_New_WithLabel'
collect2: error: ld returned 1 exit status
`g++' failed in phase `Linker'. (Exit code: 1)
Any idea why that would be happening? Usually in my experience it results from modules not being in exposed-modules but that should cause failures on any platform.
The Nix expression I'm using is: haskell.lib.addBuildTools (self.callPackage ./fltkhs.nix {}) [autoconf fltk mesa libjpeg] where fltk.hs contains the output of cabal2nix cabal://fltkhs.
I am trying to build a within function, which take a window, a IO (), inject begin window, end window around the IO ().
However, I need to juggle the type so that the result of begin and end need to be returned, or ambiguous type will ensure.
Can we add a FunDep to avoid problem like this?
Since you've asked for feedback. 😄
As far as I understand, you've used type-level computations to solve the problem of modeling the FLTK class hierarchy. This has some issues; for instance, I have to increase GHC's context stack signifcantly in order to successfully compile the example programs. I have to admit that I don't understand how it works in detail, but would it also be possible to solve this problem using phantom types?
Daan Leijens's article on the design of WxHaskell (section 5) explains the use of phantom types for modeling an OOP class hierarchy. It has the tremendous benefit of yielding simple type signatures. Of course, it cannot deal with all situations, like multiple inheritance. But the radical simplicity may be totally worth it. Is that an option?
I wanted to give fltkhs
a try but I cannot seem to get it installed in my system (x86_64 gentoo linux). While compling the library itself seems to succeed, the executables that use it cannot be compiled with the process failing at the linking stage. This includes executalbes fltkhs-fluidtohs
, fltkhs-buttons
, and fltkhs-hello-world
.
For example, I tried to run the following: mkdir /tmp/fltkhs && cd /tmp/fltkhs && cabal sandbox init && cabal install c2hs && cabal install fltkhs
. Here's the output of the last command: https://gist.github.com/redneb/ab5130e06f950109f69b.
Maybe a extra-libraries:
is missing from the cabal file.
I got this error after cabal build
*** Compiling DerivedText_Editor.cpp...
DerivedText_Editor.cpp: In member function ‘void DerivedText_Editor::remove_key_binding(int, int, DerivedText_Editor::Key_Binding_With_Callback**)’:
DerivedText_Editor.cpp:91:36: error: ‘last’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (last) last->next = curr->next;
^
cc1plus: all warnings being treated as errors
This is on gcc 4.9.2, ghc 7.8.4 and on a Archlinux 64bits system.
If I disable -Werror on c-src/Makefile.in (or initialize the "last" pointer in the cpp code) then the compilation continue , but fails later on linking fase. Lot of line similar to:
undefined reference to `Fl_Menu_Button::Fl_Menu_Button(int, int, int, int, char const*)'
I try to resolve it later, and post any further ideas.
The fltkhs-0.2.0.0
build depends on fltk-config
(or rather: the system package that provides this tool), but this dependency is not declared in the Cabal file, hence NixOS will not provide that package in the build environment, causing the build to fail. Also, the build seems to depend on autoconf
(why?), which is also not declared.
Lesser problem no doubt: I just note currently it seems to need Cabal < 1.24 to configure/build.
I think that would be easy to fix though.
On Mac OS 10.11.6:
bash-3.2$ cabal update
Downloading the latest package list from hackage.haskell.org
bash-3.2$ cabal install fltkhs-demos
Resolving dependencies...
Downloading fltkhs-0.5.3.4...
Configuring fltkhs-0.5.3.4...
Building fltkhs-0.5.3.4...
Installed fltkhs-0.5.3.4
Downloading fltkhs-demos-0.0.0.7...
Configuring fltkhs-demos-0.0.0.7...
Building fltkhs-demos-0.0.0.7...
Failed to install fltkhs-demos-0.0.0.7
Build log ( /Users/conal/.cabal/logs/ghc-8.0.2/fltkhs-demos-0.0.0.7-Ftx2BvJpVHMA8mmEQdEyxx.log ):
cabal: Entering directory '/var/folders/wx/m2wn7shj0gn4q_y_wnybcsqh0000gn/T/cabal-tmp-16244/fltkhs-demos-0.0.0.7'
[1 of 1] Compiling Main ( /var/folders/wx/m2wn7shj0gn4q_y_wnybcsqh0000gn/T/cabal-tmp-16244/fltkhs-demos-0.0.0.7/dist/setup/setup.hs, /var/folders/wx/m2wn7shj0gn4q_y_wnybcsqh0000gn/T/cabal-tmp-16244/fltkhs-demos-0.0.0.7/dist/setup/Main.o )
Linking /var/folders/wx/m2wn7shj0gn4q_y_wnybcsqh0000gn/T/cabal-tmp-16244/fltkhs-demos-0.0.0.7/dist/setup/setup ...
Configuring fltkhs-demos-0.0.0.7...
Building fltkhs-demos-0.0.0.7...
Preprocessing executable 'fltkhs-threads' for fltkhs-demos-0.0.0.7...
[1 of 1] Compiling Main ( src/Examples/threads.hs, dist/build/fltkhs-threads/fltkhs-threads-tmp/Main.o )
src/Examples/threads.hs:25:97: error:
• Couldn't match type ‘[Char]’
with ‘text-1.2.2.1:Data.Text.Internal.Text’
Expected type: Maybe text-1.2.2.1:Data.Text.Internal.Text
Actual type: Maybe [Char]
• In the second argument of ‘buttonNew’, namely
‘(Just "start background thread")’
In a stmt of a 'do' block:
startButton <- buttonNew
(Rectangle (Position (X 15) (Y 10)) (Size (Width 230) (Height 25)))
(Just "start background thread")
In the expression: [...]
Plus five more similar errors.
brew install fltk
fltk: This formula either does not compile or function as expected on OS X
versions newer than Yosemite due to an upstream incompatibility.
Error: An unsatisfied requirement failed this build.
Hello!
Thank you for very nice GUI library, which is easy to compile both on Linux and Windows.
Does fltkhs support Tables from fuild? I included simple table in fltkhs-fluid-hello-world (see attached HelloWorld.fl) but it produces not-working code, something like:
setCallback helloWorldButton buttonCb;
-- Fl_Table table0 (25,25,175,100);
setLabel table0 "Table1";
-- unknown attribute: Open;
-- unknown attribute: Selected;
begin table0;
end table0;
Using the steps posted in the Windows install, the final step to build the hello world program using stack fails:
Building fltkhs-0.5.0.7...
Preprocessing library fltkhs-0.5.0.7...
In file included from .stack-work\dist\2fae85dd\build\Graphics\UI\FLTK\LowLevel\Ask.chs.h:3:0:
./c-src/Fl_Types.h:3:25: fatal error: FL/fl_types.h: No such file or directory
compilation terminated.
c2hs.exe: Error during preprocessing custom header file
Following the guide here this step
./configure --enable-gl --enable-shared --enable-localjpeg --enable-localzlib --enable-localpng
fails with the following error
configure: loading site script /etc/config.site
checking build system type... configure: error: /bin/sh ./config.sub -pc-msys failed
configure: WARNING: cache variable ac_cv_build contains a newline
I'm running Windows 10 and using a standalone MSYS2 installation (stack is instructed to use my installation, but it shouldn't matter because this part doesn't have anything to do with stack).
I can provide any additional details.
Hello! I wanted to give fltkhs
a try, but the build fails. Here's the build log:
apfelmus$ cabal install fltkhs
Resolving dependencies...
Configuring fltkhs-0.1.0.2...
Building fltkhs-0.1.0.2...
Failed to install fltkhs-0.1.0.2
Build log ( /Users/apfelmus/.cabal/logs/fltkhs-0.1.0.2.log ):
[1 of 1] Compiling Main ( /var/folders/st/qynp3xt166l2vqv1m78jq7_00000gr/T/fltkhs-0.1.0.2-42115/fltkhs-0.1.0.2/dist/setup/setup.hs, /var/folders/st/qynp3xt166l2vqv1m78jq7_00000gr/T/fltkhs-0.1.0.2-42115/fltkhs-0.1.0.2/dist/setup/Main.o )
Linking /var/folders/st/qynp3xt166l2vqv1m78jq7_00000gr/T/fltkhs-0.1.0.2-42115/fltkhs-0.1.0.2/dist/setup/setup ...
Running autoconf ...
Warning: defaultUserHooks in Setup script is deprecated.
Configuring fltkhs-0.1.0.2...
configure: WARNING: unrecognized options: --with-hc, --with-gcc
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for fltk-config... fltk-config
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdint.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for unistd.h... (cached) yes
checking for main in -ldl... yes
checking for fl_alphasort in -lfltk... no
checking for main in -lfltk_gl... no
checking for main in -lfltk_images... no
checking for main in -lfltk_cairo... no
checking for main in -lfltk_forms... no
checking for size_t... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for select... yes
checking for strdup... yes
checking for strerror... yes
checking for strrchr... yes
checking for strtol... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating c-src/Makefile
config.status: creating c-examples/Makefile
config.status: creating fltkhs.buildinfo
configure: WARNING: unrecognized options: --with-hc, --with-gcc
==Compiling C bindings==
*** Compiling Fl_Menu_ButtonC.cpp...
*** Compiling Fl_PositionerC.cpp...
*** Compiling Fl_TimerC.cpp...
*** Compiling Fl_Value_OutputC.cpp...
*** Compiling Fl_Value_SliderC.cpp...
*** Compiling Fl_ScrollbarC.cpp...
*** Compiling Fl_RollerC.cpp...
*** Compiling Fl_DialC.cpp...
*** Compiling Fl_CounterC.cpp...
*** Compiling Utils.cpp...
*** Compiling xC.cpp...
*** Compiling fl_utf8C.cpp...
*** Compiling glC.cpp...
*** Compiling glutC.cpp...
*** Compiling DerivedText_Editor.cpp...
*** Compiling DerivedShared_Image.cpp...
*** Compiling filenameC.cpp...
*** Compiling Fl_AskC.cpp...
*** Compiling Fl_BitmapC.cpp...
*** Compiling Fl_BoxC.cpp...
*** Compiling Fl_BrowserC.cpp...
*** Compiling Fl_ButtonC.cpp...
*** Compiling Fl_CallbackC.cpp...
*** Compiling Fl_C.cpp...
*** Compiling Fl_Check_ButtonC.cpp...
*** Compiling Fl_ChoiceC.cpp...
*** Compiling Fl_ClockC.cpp...
*** Compiling Fl_Color_ChooserC.cpp...
*** Compiling Fl_Copy_SurfaceC.cpp...
*** Compiling Fl_Double_WindowC.cpp...
*** Compiling Fl_DrawC.cpp...
*** Compiling Fl_DeviceC.cpp...
*** Compiling Fl_EnumerationsC.cpp...
*** Compiling Fl_File_BrowserC.cpp...
*** Compiling Fl_File_IconC.cpp...
*** Compiling Fl_File_InputC.cpp...
*** Compiling Fl_File_ChooserC.cpp...
*** Compiling Fl_Float_InputC.cpp...
*** Compiling Fl_Gl_WindowC.cpp...
*** Compiling Fl_GroupC.cpp...
*** Compiling Fl_Hold_BrowserC.cpp...
*** Compiling Fl_Image_SurfaceC.cpp...
*** Compiling Fl_ImageC.cpp...
*** Compiling Fl_Input_C.cpp...
*** Compiling Fl_InputC.cpp...
*** Compiling Fl_Int_InputC.cpp...
*** Compiling Fl_Light_ButtonC.cpp...
*** Compiling Fl_Menu_C.cpp...
*** Compiling Fl_Menu_ItemC.cpp...
*** Compiling Fl_Multi_BrowserC.cpp...
*** Compiling Fl_Multiline_InputC.cpp...
*** Compiling Fl_Multiline_OutputC.cpp...
*** Compiling Fl_Native_File_ChooserC.cpp...
*** Compiling Fl_OutputC.cpp...
*** Compiling Fl_Overlay_WindowC.cpp...
*** Compiling Fl_Paged_DeviceC.cpp...
*** Compiling Fl_PixmapC.cpp...
*** Compiling Fl_PNM_ImageC.cpp...
*** Compiling Fl_PreferencesC.cpp...
*** Compiling Fl_PrinterC.cpp...
*** Compiling Fl_ProgressC.cpp...
*** Compiling Fl_Radio_ButtonC.cpp...
*** Compiling Fl_Radio_Light_ButtonC.cpp...
*** Compiling Fl_Repeat_ButtonC.cpp...
*** Compiling Fl_Return_ButtonC.cpp...
*** Compiling Fl_RGB_ImageC.cpp...
*** Compiling Fl_Round_ButtonC.cpp...
*** Compiling Fl_Round_ClockC.cpp...
*** Compiling Fl_Secret_InputC.cpp...
*** Compiling Fl_Select_BrowserC.cpp...
*** Compiling Fl_Shared_ImageC.cpp...
*** Compiling fl_show_colormapC.cpp...
*** Compiling Fl_Single_WindowC.cpp...
*** Compiling Fl_SliderC.cpp...
*** Compiling Fl_Sys_Menu_BarC.cpp...
*** Compiling Fl_TableC.cpp...
*** Compiling Fl_Table_RowC.cpp...
*** Compiling Fl_TabsC.cpp...
*** Compiling Fl_Text_BufferC.cpp...
*** Compiling Fl_Text_DisplayC.cpp...
*** Compiling Fl_Text_EditorC.cpp...
*** Compiling Fl_Text_SelectionC.cpp...
*** Compiling Fl_TileC.cpp...
*** Compiling Fl_Toggle_ButtonC.cpp...
*** Compiling Fl_TooltipC.cpp...
*** Compiling Fl_TreeC.cpp...
*** Compiling Fl_Tree_ItemC.cpp...
*** Compiling Fl_Tree_PrefsC.cpp...
*** Compiling Fl_ValuatorC.cpp...
*** Compiling Fl_AdjusterC.cpp...
*** Compiling Fl_Value_InputC.cpp...
*** Compiling Fl_WidgetC.cpp...
*** Compiling Fl_WindowC.cpp...
*** Compiling Fl_WizardC.cpp...
*** Linking libfltkc.a...
/opt/local/bin/ranlib: file: ../c-lib/libfltkc.a(fl_utf8C.o) has no symbols
*** Not linking libfltkcdyn.dylib because of bugs in ./c-src/Makefile.in, help appreciated.
Building fltkhs-0.1.0.2...
Preprocessing library fltkhs-0.1.0.2...
In file included from dist/build/Graphics/UI/FLTK/LowLevel/GlWindow.chs.h:2:
In file included from ./c-src/Fl_C.h:5:
./c-src/Fl_Types.h:3:10: fatal error: 'FL/fl_types.h' file not found
#include "FL/fl_types.h"
^
1 error generated.
c2hs: Error during preprocessing custom header file
cabal: Error: some packages failed to install:
fltkhs-0.1.0.2 failed during the building phase. The exception was:
ExitFailure 1
I should note that I have installed the FLTK library via Macports, which means that it has the prefix /opt/local/
. The same is true for the autoconf
tool.
Apparently fltkhs depends on c2hs to generate the bindings. Mentioning this package as a dependency seems to work, at least when building with cabal in a sandbox.
Latest development version fails to build on Windows:
> stack build --flag fltkhs:bundled
....
Linking .stack-work\dist\5f9bc736\build\fltkhs-buttons\fltkhs-buttons.exe ...
C:\Users\jorisp\workspace\3rdparty\fltk\fltkhs\.stack-work\dist\5f9bc736\build/libHSfltkhs-0.5.4.4-EEy3JTZALO36A7zCpw2MLZ.a(FL.o):fake:(.text+0x136a): undefined reference to `Fl_awake_to_handler'
collect2.exe: error: ld returned 1 exit status
`g++' failed in phase `Linker'. (Exit code: 1)
custom-setup
/setup-depends
needs a lower bound for Cabal
. Cabal >= 1.24.1 && < 1.25
seems to work. It also needs a lower bound on directory
. directory >= 1.2.3.0
seems to work. Specifically, withCurrentDirectory
and libraryDynDirs
are somewhat new.
timerNew
is implemented in terms of Fl_Timer_New
:
{# fun Fl_Timer_New as timerNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #}
timerNew :: Rectangle -> T.Text -> IO (Ref Timer)
timerNew rectangle l'=
let (x_pos, y_pos, width, height) = fromRectangle rectangle
in timerNewWithLabel' x_pos y_pos width height l' >>= toRef
But while Fl_Timer_New
is declared in Fl_TimerC.h
:
FL_EXPORT_C(fl_Timer, Fl_Timer_New)(int x, int y, int w, int h, const char* l);
The corresponding implementation in Fl_TimerC.cpp
uses the name Fl_Timer_New_WithLabel
, not Fl_Timer_New
:
FL_EXPORT_C(fl_Timer, Fl_Timer_New_WithLabel)(int X, int Y, int W, int H, const char* label){
fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs();
Fl_DerivedTimer* w = new Fl_DerivedTimer(FL_NORMAL_TIMER,X,Y,W,H,label,fs);
return (fl_Timer)w;
}
So if I try to compile a program containing timerNew
, I get a linking error.
-- Undefined symbols for architecture x86_64:
-- "_Fl_OverriddenTimer_New", referenced from:
-- _fltkhszm0zi5zi2zi4zmJ8HFBnbOGX86OTsRCvwWFo_GraphicsziUIziFLTKziLowLevelziTimer_zdwoverriddenWidgetNewzq_info in libHSfltkhs-0.5.2.4-J8HFBnbOGX86OTsRCvwWFo.a(Timer.o)
-- (maybe you meant: _Fl_OverriddenTimer_New_WithLabel)
-- "_Fl_Timer_New", referenced from:
-- _cblHE_info in libHSfltkhs-0.5.2.4-J8HFBnbOGX86OTsRCvwWFo.a(Timer.o)
-- (maybe you meant: _Fl_Timer_New_WithLabel)
-- ld: symbol(s) not found for architecture x86_64
-- clang: error: linker command failed with exit code 1 (use -v to see invocation)
-- `gcc' failed in phase `Linker'. (Exit code: 1)
{-# LANGUAGE OverloadedStrings #-}
import Graphics.UI.FLTK.LowLevel.Fl_Types
import Graphics.UI.FLTK.LowLevel.Timer
main :: IO ()
main = do
_ <- timerNew (Rectangle (Position (X 10) (Y 30))
(Size (Width 95) (Height 30)))
"timer"
return ()
It's easy to fix the problem by changing timerNew
to use Fl_Timer_New_WithLabel
instead of Fl_Timer_New
, but I think there's more to this bug than a simple name change.
Since the FLTK documentation for Fl_Timer recommends not to use that widget, the fact that it doesn't work isn't a big loss. But while googling for my error message, I noticed issue #53 in which you're getting linking errors for that symbol on Nix as well. Maybe clang links lazily, so the error only occurs when a symbol is actually used, whereas Nix is strict in that regard? If so, I should also be able to produce linking errors for each of the other symbols in that issue. And indeed:
{-# LANGUAGE OverloadedStrings #-}
import Graphics.UI.FLTK.LowLevel.Fl_Types
import Graphics.UI.FLTK.LowLevel.Timer
import Graphics.UI.FLTK.LowLevel.FileBrowser
main :: IO ()
main = do
-- linking error for _Fl_Timer_New and _Fl_OverriddenTimer_New
_ <- timerNew (Rectangle (Position (X 10) (Y 30))
(Size (Width 95) (Height 30)))
"timer"
-- linking error for _Fl_OverriddenFile_Browser_New
_ <- fileBrowserCustom (Rectangle (Position (X 10) (Y 30))
(Size (Width 95) (Height 30)))
Nothing
Nothing
Nothing
-- linking error for _Fl_File_Browser_New
_ <- fileBrowserNew (Rectangle (Position (X 10) (Y 30))
(Size (Width 95) (Height 30)))
Nothing
-- linking error for _Fl_File_Browser_New_WithLabel
-- and _Fl_OverriddenFile_Browser_New_WithLabel
_ <- fileBrowserNew (Rectangle (Position (X 10) (Y 30))
(Size (Width 95) (Height 30)))
(Just "file browser")
return ()
Looking at the history, I see that Fl_Timer_New
and Fl_File_Browser_New_WithLabel
were both removed in commit d97b613, "Custom Widgets". By adding support for custom widgets, maybe you accidentally introduced a regression in the script which generates your bindings?
When building using stack, stack build --flag fltkhs:bundled --verbose
, the process stops with following error:
2017-09-11 14:45:05.132953: [info] Building bundled FLTK
@(Stack\Build\Execute.hs:1096:67)
2017-09-11 14:45:05.210953: [warn] tar: This does not look like a tar archive
@(Stack\Build\Execute.hs:1096:67)
2017-09-11 14:45:05.210953: [warn] tar: Skipping to next header
@(Stack\Build\Execute.hs:1096:67)
2017-09-11 14:45:05.429354: [warn] tar: Exiting with failure status due to previous errors
I checked the version by printing from within the Setup.hs
and it is the correct version and working directory. When using this version of tar
to extract the archive, comment this line in the Setup.hs
, calling the build again the build process passes this point and starts the configuration of the fltk library.
This is on a Windows 7.
After brew install fltk --devel
and doing stack build
in the fltkhs-hello-world project, I get
*** Linking libfltkc.a...
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: ../c-lib/libfltkc.a(fl_utf8C.o) has no symbols
*** Linking libfltkc-dyn.dylib...
ld: library not found for -lfltk_images
clang: error: linker command failed with exit code 1 (use -v to see invocation)
http://hackage.haskell.org/package/fltkhs-0.4.0.5/docs/Graphics-UI-FLTK-LowLevel-FLTKHS.html#g:4 mentions "fltk_images" very briefly, but I don't see it in homebrew.
looks like compBuildOrder :: [ComponentName]
has been depreciated in cabal-1.18+ in favor of componentsConfigs :: [(ComponentName, ComponentLocalBuildInfo, [ComponentName])]
A cabal install fltkhs
on Fedora 21 results in the following build failure:
[3 of 5] Compiling Parser
( src/Fluid/Parser.hs, dist/build/fltkhs-fluidtohs/fltkhs-fluidtohs-tmp/Parser.o )
src/Fluid/Parser.hs:96:34: Not in scope: `endOfLine'
src/Fluid/Parser.hs:99:32: Not in scope: `endOfLine'
src/Fluid/Parser.hs:103:45: Not in scope: `crlf'
src/Fluid/Parser.hs:529:28: Not in scope: `endOfLine'
Failed to install fltkhs-0.3.0.0
cabal: Error: some packages failed to install:
fltkhs-0.3.0.0 failed during the building phase. The exception was:
ExitFailure 1
The Fltk library has following version, fltk-config --version
: 1.3.3
ghc --version
is 7.6.3
Many linux distros still have the older fltk-1.3.3
. Because fltk-1.3.4
is backwards compatible we could make the build smarter to allow both.
This would make installing fltkhs very easy, just install the fltk-dev
package and cabal install fltkhs
.
I have to :quit
in order to close the application.
$ brew install fltk
Warning: fltk-1.3.3 already installed
~$ stack install fltkhs
Run from outside a project, using implicit global project config
Using resolver: lts-5.2 from implicit global project's config file: /Users/simon/.stack/global/stack.yaml
language-c-0.4.7: configure
language-c-0.4.7: build
language-c-0.4.7: copy/register
c2hs-0.27.1: configure
c2hs-0.27.1: build
c2hs-0.27.1: copy/register
fltkhs-0.4.0.2: download
fltkhs-0.4.0.2: configure
fltkhs-0.4.0.2: build
Completed 3 action(s).
-- While building package fltkhs-0.4.0.2 using:
/private/var/folders/r7/f9j9c2zd1k97v47cr84j_qvc0000gn/T/stack60554/fltkhs-0.4.0.2/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/setup/setup --builddir=.stack-work/dist/x86_64-osx/Cabal-1.22.5.0 build --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: /Users/simon/.stack/global/.stack-work/logs/fltkhs-0.4.0.2.log
[1 of 1] Compiling Main ( /private/var/folders/r7/f9j9c2zd1k97v47cr84j_qvc0000gn/T/stack60554/fltkhs-0.4.0.2/Setup.hs, /private/var/folders/r7/f9j9c2zd1k97v47cr84j_qvc0000gn/T/stack60554/fltkhs-0.4.0.2/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/setup/Main.o )
/private/var/folders/r7/f9j9c2zd1k97v47cr84j_qvc0000gn/T/stack60554/fltkhs-0.4.0.2/Setup.hs:39:29: Warning:
In the use of ‘defaultUserHooks’
(imported from Distribution.Simple):
Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2
compatibility in which case you must stick with defaultUserHooks"
/private/var/folders/r7/f9j9c2zd1k97v47cr84j_qvc0000gn/T/stack60554/fltkhs-0.4.0.2/Setup.hs:53:12: Warning:
In the use of ‘defaultUserHooks’
(imported from Distribution.Simple):
Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2
compatibility in which case you must stick with defaultUserHooks"
/private/var/folders/r7/f9j9c2zd1k97v47cr84j_qvc0000gn/T/stack60554/fltkhs-0.4.0.2/Setup.hs:71:13: Warning:
In the use of ‘defaultUserHooks’
(imported from Distribution.Simple):
Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2
compatibility in which case you must stick with defaultUserHooks"
/private/var/folders/r7/f9j9c2zd1k97v47cr84j_qvc0000gn/T/stack60554/fltkhs-0.4.0.2/Setup.hs:97:16: Warning:
In the use of ‘defaultUserHooks’
(imported from Distribution.Simple):
Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2
compatibility in which case you must stick with defaultUserHooks"
/private/var/folders/r7/f9j9c2zd1k97v47cr84j_qvc0000gn/T/stack60554/fltkhs-0.4.0.2/Setup.hs:101:15: Warning:
In the use of ‘defaultUserHooks’
(imported from Distribution.Simple):
Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2
compatibility in which case you must stick with defaultUserHooks"
/private/var/folders/r7/f9j9c2zd1k97v47cr84j_qvc0000gn/T/stack60554/fltkhs-0.4.0.2/Setup.hs:118:13: Warning:
In the use of ‘defaultUserHooks’
(imported from Distribution.Simple):
Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2
compatibility in which case you must stick with defaultUserHooks"
Linking /private/var/folders/r7/f9j9c2zd1k97v47cr84j_qvc0000gn/T/stack60554/fltkhs-0.4.0.2/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/setup/setup ...
Running autoconf ...
Warning: defaultUserHooks in Setup script is deprecated.
Configuring fltkhs-0.4.0.2...
configure: WARNING: unrecognized options: --with-hc, --with-gcc
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for fltk-config... fltk-config
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdint.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for unistd.h... (cached) yes
checking for main in -ldl... yes
checking for fl_alphasort in -lfltk... yes
checking for main in -lfltk_gl... yes
checking for main in -lfltk_images... yes
checking for main in -lfltk_cairo... no
checking for main in -lfltk_forms... yes
checking for size_t... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for select... yes
checking for strdup... yes
checking for strerror... yes
checking for strrchr... yes
checking for strtol... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating c-src/Makefile
config.status: creating c-examples/Makefile
config.status: creating fltkhs.buildinfo
configure: WARNING: unrecognized options: --with-hc, --with-gcc
==Compiling C bindings==
*** Compiling Fl_Menu_ButtonC.cpp...
*** Compiling Fl_PositionerC.cpp...
*** Compiling Fl_TimerC.cpp...
*** Compiling Fl_Value_OutputC.cpp...
*** Compiling Fl_Value_SliderC.cpp...
*** Compiling Fl_ScrollbarC.cpp...
*** Compiling Fl_ScrollC.cpp...
*** Compiling Fl_RollerC.cpp...
*** Compiling Fl_DialC.cpp...
*** Compiling Fl_CounterC.cpp...
*** Compiling Fl_SpinnerC.cpp...
*** Compiling UtilsC.cpp...
*** Compiling xC.cpp...
*** Compiling fl_utf8C.cpp...
*** Compiling glC.cpp...
*** Compiling glutC.cpp...
*** Compiling DerivedText_Editor.cpp...
*** Compiling DerivedShared_Image.cpp...
*** Compiling filenameC.cpp...
*** Compiling Fl_AskC.cpp...
*** Compiling Fl_BitmapC.cpp...
*** Compiling Fl_BoxC.cpp...
*** Compiling Fl_BrowserC.cpp...
*** Compiling Fl_ButtonC.cpp...
*** Compiling Fl_CallbackC.cpp...
*** Compiling Fl_C.cpp...
*** Compiling Fl_Check_ButtonC.cpp...
*** Compiling Fl_ChoiceC.cpp...
*** Compiling Fl_ClockC.cpp...
*** Compiling Fl_Color_ChooserC.cpp...
*** Compiling Fl_Copy_SurfaceC.cpp...
*** Compiling Fl_Double_WindowC.cpp...
*** Compiling Fl_DrawC.cpp...
*** Compiling Fl_DeviceC.cpp...
*** Compiling Fl_EnumerationsC.cpp...
*** Compiling Fl_File_BrowserC.cpp...
*** Compiling Fl_File_IconC.cpp...
*** Compiling Fl_File_InputC.cpp...
*** Compiling Fl_File_ChooserC.cpp...
*** Compiling Fl_Float_InputC.cpp...
*** Compiling Fl_Gl_WindowC.cpp...
*** Compiling Fl_GroupC.cpp...
*** Compiling Fl_Hold_BrowserC.cpp...
*** Compiling Fl_Image_SurfaceC.cpp...
*** Compiling Fl_ImageC.cpp...
*** Compiling Fl_JPEG_ImageC.cpp...
*** Compiling Fl_Input_C.cpp...
*** Compiling Fl_InputC.cpp...
*** Compiling Fl_Int_InputC.cpp...
*** Compiling Fl_Light_ButtonC.cpp...
*** Compiling Fl_Menu_C.cpp...
*** Compiling Fl_Menu_ItemC.cpp...
*** Compiling Fl_Multi_BrowserC.cpp...
*** Compiling Fl_Multiline_InputC.cpp...
*** Compiling Fl_Multiline_OutputC.cpp...
*** Compiling Fl_Native_File_ChooserC.cpp...
*** Compiling Fl_OutputC.cpp...
*** Compiling Fl_Overlay_WindowC.cpp...
*** Compiling Fl_Paged_DeviceC.cpp...
*** Compiling Fl_PixmapC.cpp...
*** Compiling Fl_PNM_ImageC.cpp...
*** Compiling Fl_PNG_ImageC.cpp...
*** Compiling Fl_XBM_ImageC.cpp...
*** Compiling Fl_XPM_ImageC.cpp...
*** Compiling Fl_GIF_ImageC.cpp...
*** Compiling Fl_BMP_ImageC.cpp...
*** Compiling Fl_PreferencesC.cpp...
*** Compiling Fl_PrinterC.cpp...
*** Compiling Fl_ProgressC.cpp...
*** Compiling Fl_Radio_ButtonC.cpp...
*** Compiling Fl_Radio_Light_ButtonC.cpp...
*** Compiling Fl_Repeat_ButtonC.cpp...
*** Compiling Fl_Return_ButtonC.cpp...
*** Compiling Fl_RGB_ImageC.cpp...
*** Compiling Fl_Round_ButtonC.cpp...
*** Compiling Fl_Round_ClockC.cpp...
*** Compiling Fl_Secret_InputC.cpp...
*** Compiling Fl_Select_BrowserC.cpp...
*** Compiling Fl_Shared_ImageC.cpp...
*** Compiling fl_show_colormapC.cpp...
*** Compiling Fl_Single_WindowC.cpp...
*** Compiling Fl_SliderC.cpp...
*** Compiling Fl_Sys_Menu_BarC.cpp...
*** Compiling Fl_TableC.cpp...
*** Compiling Fl_Table_RowC.cpp...
*** Compiling Fl_TabsC.cpp...
*** Compiling Fl_Text_BufferC.cpp...
*** Compiling Fl_Text_DisplayC.cpp...
*** Compiling Fl_Text_EditorC.cpp...
*** Compiling Fl_Text_SelectionC.cpp...
*** Compiling Fl_TileC.cpp...
*** Compiling Fl_PackC.cpp...
*** Compiling Fl_Toggle_ButtonC.cpp...
*** Compiling Fl_TooltipC.cpp...
*** Compiling Fl_TreeC.cpp...
*** Compiling Fl_Tree_ItemC.cpp...
*** Compiling Fl_Tree_PrefsC.cpp...
*** Compiling Fl_ValuatorC.cpp...
*** Compiling Fl_AdjusterC.cpp...
*** Compiling Fl_Value_InputC.cpp...
*** Compiling Fl_WidgetC.cpp...
*** Compiling Fl_WindowC.cpp...
*** Compiling Fl_WizardC.cpp...
*** Linking libfltkc.a...
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: ../c-lib/libfltkc.a(fl_utf8C.o) has no symbols
*** Not linking libfltkc.dylib because of bugs in ./c-src/Makefile.in, help appreciated.
Building fltkhs-0.4.0.2...
Preprocessing library fltkhs-0.4.0.2...
c2hs: C header contains errors:
./c-src/Fl_RGB_ImageC.h:35: (column 48) [ERROR] >>> Syntax error !
The symbol `size' does not fit here.
I'm trying to port a little program on Windows but I can't manage to install fltkhs.
Using the procedure described on hackage, I'm stuck here:
[ 97%] Built target fltkc_obj
Scanning dependencies of target fltkc-dyn
make[2]: *** No rule to make target '/lib', needed by 'c-lib/libfltkc-dyn.dll'. Stop.
make[1]: *** [CMakeFiles/Makefile2:127: c-src/CMakeFiles/fltkc-dyn.dir/all] Error
make: *** [Makefile:84:all] Error
After running stack install
in fltkhs-hello-world directory, and got the same error with cabal.
By checking online, it seems make
apparently knows that he needs to do something with /lib
but not what. I don't find any clues in the makefiles of fltk and fltkhs (but I'm a noob here).
As I just want to make a statically linked executable, and it seems the dynamic part is problematic:
I tried to install fltkhs manually, deleting everything related to dynamic libraries in the package (ugly hack) and it nearly works.. but after I got some g++ linking errors (lot of undefined references) when trying to use the library, I think it's normal.
I tried to disable shared libraries when running cmake, but it changes nothing.
It's not related but I had to make changes in FL_Types.hs
otherwise it won't compile (CULLong instead of CInt):
type FDHandlerPrim = CULLong -> Ptr () -> IO ()
type FDHandler = CULLong -> IO ()
And the move from defaultUserHooks
to autoconfUserHooks
in Setup.hs
don't work on my computer as setup.exe
fail to find a configure script.
I don't know how to resolve this issue as I normally don't use haskell on windows and I never directly used makefiles. On my dev machine (linux) everything runs so smoothly.
I'm available for testing and to give as much information as I can.
I followed the instructions here:
http://hackage.haskell.org/package/fltkhs-0.5.1.6/docs/Graphics-UI-FLTK-LowLevel-FLTKHS.html#g:8
Windows 10 64-bit, stack 1.2.0, GHC 8.0.2
make[1]: Wall: Command not found
make[1]: fltk-config: Command not found
are the options being interpreted as commands themselves?
Trying to follow your README exactly after #29, I got this FLTK build failure. Not your problem perhaps, except I know you want this to just work.
~/src/fltk$ curl -s 'http://fltk.org/pub/fltk/1.3.3/fltk-1.3.3-source.tar.gz' | tar xzf -
~/src/fltk$ cd fltk-1.3.3/
~/src/fltk/fltk-1.3.3$ ./configure --enable-shared
checking build system type... x86_64-apple-darwin15.3.0
checking host system type... x86_64-apple-darwin15.3.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking for nroff... /usr/bin/nroff
checking for doxygen... no
checking for ranlib... ranlib
checking for ar... /usr/bin/ar
checking for windres... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking size of short... 2
checking size of int... 4
checking size of long... 8
checking whether the compiler recognizes bool as a built-in type... yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/stdtypes.h usability... no
checking sys/stdtypes.h presence... no
checking for sys/stdtypes.h... no
checking whether we have the POSIX compatible scandir() prototype... yes
checking for vsnprintf... yes
checking for snprintf... yes
checking for strings.h... (cached) yes
checking for strcasecmp... yes
checking for strlcat... yes
checking for strlcpy... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking for localeconv... yes
checking for library containing pow... none required
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for long long int... yes
checking for library containing dlsym... none required
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for jpeg_CreateCompress in -ljpeg... yes
checking jpeglib.h usability... yes
checking jpeglib.h presence... yes
checking for jpeglib.h... yes
checking for gzgets in -lz... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for png_read_info in -lpng... yes
checking png.h usability... yes
checking png.h presence... yes
checking for png.h... yes
checking libpng/png.h usability... no
checking libpng/png.h presence... no
checking for libpng/png.h... no
checking for png_get_valid in -lpng... yes
checking for png_set_tRNS_to_alpha in -lpng... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for pthread_create using -lpthreads... no
checking for pthread_create using -lpthread... yes
checking if GCC supports -fno-exceptions... yes
checking if GCC supports -fno-strict-aliasing... yes
checking if ld supports -Bsymbolic-functions... no
checking if toolchain supports sections... no
Configuration Summary
-------------------------------------------------------------------------
Directories: prefix=/usr/local
bindir=${exec_prefix}/bin
datadir=${datarootdir}
datarootdir=${prefix}/share
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
mandir=${datarootdir}/man
Graphics: Quartz
Image Libraries: JPEG=System
PNG=System
ZLIB=System
Large Files: YES
OpenGL: YES
Threads: YES
configure: creating ./config.status
config.status: creating makeinclude
config.status: creating fltk.list
config.status: creating fltk-config
config.status: creating fltk.spec
config.status: creating FL/Makefile
config.status: creating config.h
~/src/fltk/fltk-1.3.3$ make
=== making src ===
Compiling Fl_cocoa.mm...
Fl_cocoa.mm:1537:15: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
[NSThread detachNewThreadSelector:nil toTarget:nil withObject:nil];
^ ~~~
Fl_cocoa.mm:1537:15: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
[NSThread detachNewThreadSelector:nil toTarget:nil withObject:nil];
^ ~~~
2 warnings generated.
Compiling Fl_Quartz_Printer.mm...
Fl_Quartz_Printer.mm:241:8: warning: comparison of function 'PMSessionGetCGGraphicsContext' not equal to a null pointer is always true
[-Wtautological-pointer-compare]
if ( PMSessionGetCGGraphicsContext != NULL ) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
Fl_Quartz_Printer.mm:241:8: note: prefix with the address-of operator to silence this warning
if ( PMSessionGetCGGraphicsContext != NULL ) {
^
&
1 warning generated.
Compiling Fl_Native_File_Chooser_MAC.mm...
Compiling Fl_Sys_Menu_Bar.mm...
Compiling Fl.cxx...
Compiling Fl_Adjuster.cxx...
Compiling Fl_Bitmap.cxx...
Compiling Fl_Browser.cxx...
Compiling Fl_Browser_.cxx...
Compiling Fl_Browser_load.cxx...
Compiling Fl_Box.cxx...
Compiling Fl_Button.cxx...
Compiling Fl_Chart.cxx...
Compiling Fl_Check_Browser.cxx...
Compiling Fl_Check_Button.cxx...
Compiling Fl_Choice.cxx...
Compiling Fl_Clock.cxx...
Compiling Fl_Color_Chooser.cxx...
Compiling Fl_Copy_Surface.cxx...
Fl_Copy_Surface.cxx:191:6: warning: comparison of function 'CGDataConsumerCreateWithCFData' not equal to a null pointer is always true
[-Wtautological-pointer-compare]
if(CGDataConsumerCreateWithCFData != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
Fl_Copy_Surface.cxx:191:6: note: prefix with the address-of operator to silence this warning
if(CGDataConsumerCreateWithCFData != NULL) {
^
&
1 warning generated.
Compiling Fl_Counter.cxx...
Compiling Fl_Dial.cxx...
Compiling Fl_Device.cxx...
Compiling Fl_Double_Window.cxx...
Compiling Fl_File_Browser.cxx...
Compiling Fl_File_Chooser.cxx...
Compiling Fl_File_Chooser2.cxx...
Compiling Fl_File_Icon.cxx...
Compiling Fl_File_Input.cxx...
Compiling Fl_Group.cxx...
Compiling Fl_Help_View.cxx...
Compiling Fl_Image.cxx...
Compiling Fl_Image_Surface.cxx...
Compiling Fl_Input.cxx...
Compiling Fl_Input_.cxx...
Compiling Fl_Light_Button.cxx...
Compiling Fl_Menu.cxx...
Compiling Fl_Menu_.cxx...
Compiling Fl_Menu_Bar.cxx...
Compiling Fl_Menu_Button.cxx...
Compiling Fl_Menu_Window.cxx...
Compiling Fl_Menu_add.cxx...
Compiling Fl_Menu_global.cxx...
Compiling Fl_Multi_Label.cxx...
Compiling Fl_Native_File_Chooser.cxx...
Compiling Fl_Overlay_Window.cxx...
Compiling Fl_Pack.cxx...
Compiling Fl_Paged_Device.cxx...
Compiling Fl_Pixmap.cxx...
Compiling Fl_PostScript.cxx...
Compiling Fl_Positioner.cxx...
Compiling Fl_Preferences.cxx...
Fl_Preferences.cxx:959:13: warning: function 'makePath' is not needed and will not be emitted [-Wunneeded-internal-declaration]
static char makePath( const char *path ) {
^
1 warning generated.
Compiling Fl_Printer.cxx...
Compiling Fl_Progress.cxx...
Compiling Fl_Repeat_Button.cxx...
Compiling Fl_Return_Button.cxx...
Compiling Fl_Roller.cxx...
Compiling Fl_Round_Button.cxx...
Compiling Fl_Scroll.cxx...
Compiling Fl_Scrollbar.cxx...
Compiling Fl_Shared_Image.cxx...
Compiling Fl_Single_Window.cxx...
Compiling Fl_Slider.cxx...
Compiling Fl_Table.cxx...
Compiling Fl_Table_Row.cxx...
Compiling Fl_Tabs.cxx...
In file included from Fl_Tabs.cxx:28:
../FL/Fl_Tabs.H:202:14: warning: private field 'value_' is not used [-Wunused-private-field]
Fl_Widget *value_;
^
1 warning generated.
Compiling Fl_Text_Buffer.cxx...
Compiling Fl_Text_Display.cxx...
Compiling Fl_Text_Editor.cxx...
Compiling Fl_Tile.cxx...
Compiling Fl_Tiled_Image.cxx...
Compiling Fl_Tree.cxx...
Fl_Tree.cxx:68:12: warning: function 'find_total_children' is not needed and will not be emitted [-Wunneeded-internal-declaration]
static int find_total_children(Fl_Tree_Item *item, int count=0) {
^
1 warning generated.
Compiling Fl_Tree_Item.cxx...
Compiling Fl_Tree_Item_Array.cxx...
Compiling Fl_Tree_Prefs.cxx...
Compiling Fl_Tooltip.cxx...
Compiling Fl_Valuator.cxx...
Compiling Fl_Value_Input.cxx...
Compiling Fl_Value_Output.cxx...
Compiling Fl_Value_Slider.cxx...
Compiling Fl_Widget.cxx...
Compiling Fl_Window.cxx...
Compiling Fl_Window_fullscreen.cxx...
Compiling Fl_Window_hotspot.cxx...
Compiling Fl_Window_iconize.cxx...
Compiling Fl_Window_shape.cxx...
Fl_Window_shape.cxx:340:31: warning: comparison of function 'CGContextClipToMask' not equal to a null pointer is always true
[-Wtautological-pointer-compare]
if (shape_data_->mask && (CGContextClipToMask != NULL)) {
^~~~~~~~~~~~~~~~~~~ ~~~~
Fl_Window_shape.cxx:340:31: note: prefix with the address-of operator to silence this warning
if (shape_data_->mask && (CGContextClipToMask != NULL)) {
^
&
1 warning generated.
Compiling Fl_Wizard.cxx...
Compiling Fl_XBM_Image.cxx...
Compiling Fl_XPM_Image.cxx...
Compiling Fl_abort.cxx...
Compiling Fl_add_idle.cxx...
Compiling Fl_arg.cxx...
Compiling Fl_compose.cxx...
Compiling Fl_display.cxx...
Compiling Fl_get_key.cxx...
In file included from Fl_get_key.cxx:22:
./Fl_get_key_mac.cxx:247:6: warning: comparison of function 'CGEventSourceKeyState' not equal to a null pointer is always true
[-Wtautological-pointer-compare]
if(CGEventSourceKeyState != NULL) {
^~~~~~~~~~~~~~~~~~~~~ ~~~~
./Fl_get_key_mac.cxx:247:6: note: prefix with the address-of operator to silence this warning
if(CGEventSourceKeyState != NULL) {
^
&
1 warning generated.
Compiling Fl_get_system_colors.cxx...
Compiling Fl_grab.cxx...
Compiling Fl_lock.cxx...
Compiling Fl_own_colormap.cxx...
Compiling Fl_visual.cxx...
Compiling Fl_x.cxx...
Compiling filename_absolute.cxx...
Compiling filename_expand.cxx...
Compiling filename_ext.cxx...
Compiling filename_isdir.cxx...
Compiling filename_list.cxx...
Compiling filename_match.cxx...
Compiling filename_setext.cxx...
Compiling fl_arc.cxx...
Compiling fl_arci.cxx...
Compiling fl_ask.cxx...
Compiling fl_boxtype.cxx...
Compiling fl_color.cxx...
Compiling fl_cursor.cxx...
Compiling fl_curve.cxx...
Compiling fl_diamond_box.cxx...
Compiling fl_dnd.cxx...
Compiling fl_draw.cxx...
Compiling fl_draw_image.cxx...
Compiling fl_draw_pixmap.cxx...
Compiling fl_encoding_latin1.cxx...
Compiling fl_encoding_mac_roman.cxx...
Compiling fl_engraved_label.cxx...
Compiling fl_file_dir.cxx...
Compiling fl_font.cxx...
In file included from fl_font.cxx:51:
./fl_font_mac.cxx:51:8: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
if ( abs(advances[0].width - advances[1].width) < 1E-2 ) {//this is a fixed-width font
^
./fl_font_mac.cxx:51:8: note: use function 'std::abs' instead
if ( abs(advances[0].width - advances[1].width) < 1E-2 ) {//this is a fixed-width font
^~~
std::abs
./fl_font_mac.cxx:51:8: note: include the header <cmath> or explicitly provide a declaration for 'std::abs'
1 warning generated.
Compiling fl_gleam.cxx...
Compiling fl_gtk.cxx...
Compiling fl_labeltype.cxx...
Compiling fl_line_style.cxx...
fl_line_style.cxx:38:13: error: elaborated type refers to a typedef
static enum CGLineCap fl_quartz_line_cap_ = kCGLineCapButt;
^
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:33:26: note: declared here
typedef CF_ENUM(int32_t, CGLineCap) {
^
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h:127:88: note: expanded from macro 'CF_ENUM'
#define CF_ENUM(...) __CF_ENUM_GET_MACRO(__VA_ARGS__, __CF_NAMED_ENUM, __CF_ANON_ENUM)(__VA_ARGS__)
^
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h:110:45: note: expanded from macro '__CF_NAMED_ENUM'
#define __CF_NAMED_ENUM(_type, _name) _type _name; enum
^
fl_line_style.cxx:39:13: error: elaborated type refers to a typedef
static enum CGLineJoin fl_quartz_line_join_ = kCGLineJoinMiter;
^
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:25:26: note: declared here
typedef CF_ENUM(int32_t, CGLineJoin) {
^
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h:127:88: note: expanded from macro 'CF_ENUM'
#define CF_ENUM(...) __CF_ENUM_GET_MACRO(__VA_ARGS__, __CF_NAMED_ENUM, __CF_ANON_ENUM)(__VA_ARGS__)
^
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h:110:45: note: expanded from macro '__CF_NAMED_ENUM'
#define __CF_NAMED_ENUM(_type, _name) _type _name; enum
^
fl_line_style.cxx:113:15: error: elaborated type refers to a typedef
static enum CGLineCap Cap[4] = { kCGLineCapButt, kCGLineCapButt,
^
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:33:26: note: declared here
typedef CF_ENUM(int32_t, CGLineCap) {
^
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h:127:88: note: expanded from macro 'CF_ENUM'
#define CF_ENUM(...) __CF_ENUM_GET_MACRO(__VA_ARGS__, __CF_NAMED_ENUM, __CF_ANON_ENUM)(__VA_ARGS__)
^
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h:110:45: note: expanded from macro '__CF_NAMED_ENUM'
#define __CF_NAMED_ENUM(_type, _name) _type _name; enum
^
fl_line_style.cxx:115:15: error: elaborated type refers to a typedef
static enum CGLineJoin Join[4] = { kCGLineJoinMiter, kCGLineJoinMiter,
^
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:25:26: note: declared here
typedef CF_ENUM(int32_t, CGLineJoin) {
^
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h:127:88: note: expanded from macro 'CF_ENUM'
#define CF_ENUM(...) __CF_ENUM_GET_MACRO(__VA_ARGS__, __CF_NAMED_ENUM, __CF_ANON_ENUM)(__VA_ARGS__)
^
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h:110:45: note: expanded from macro '__CF_NAMED_ENUM'
#define __CF_NAMED_ENUM(_type, _name) _type _name; enum
^
4 errors generated.
make[1]: *** [fl_line_style.o] Error 1
make: *** [all] Error 1
Hello! I was trying to recreate Example 1 from the fltk docs and I got a segfault. Here is the example program:
module Main where
import qualified Graphics.UI.FLTK.LowLevel.FL as FL
import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
import Graphics.UI.FLTK.LowLevel.FLTKHS
main :: IO ()
main = do
w1 <- windowNew (Size (Width 300) (Height 180)) Nothing (Just "Hello!")
begin w1
let labelRect = Rectangle (Position (X 20) (Y 40)) (Size (Width 260) (Height 100))
label <- widgetCustom labelRect (Just "Bob") defaultCustomWidgetFuncs
setBox label UpBox
setLabelfont label helveticaBoldItalic
setLabelsize label (FontSize 36)
setLabeltype label ShadowLabel
end w1
showWidget w1
_ <- FL.run
return ()
Am I doing something wrong? I installed FLTK like is shown in the README. I am running in a cabal sandbox, and the examples work. If I use an Output with outputNew
instead of widgetCustom
, I don't get a segfault, but I see no text (this is an issue for later I think, I thought the segfault was more pertinent, and I am just mentioning it because I think it indicates the problem is with widgetCustom
).
FYI: I am trying to learn FLTK as I use this library (I have a ton of experience with PyQt, but not FLTK). As I go, I want to make a pull request with some heavily commented examples, just like FLTK has.
Thanks for your work on this library!
I wanted to add a callback for when a file descriptor has data to read.
I see equivalents for add_check
and add_idle
, but don't see one for add_fd
unless I'm missing it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.