GithubHelp home page GithubHelp logo

How to run? about fidget HOT 31 CLOSED

andreaferretti avatar andreaferretti commented on June 18, 2024
How to run?

from fidget.

Comments (31)

treeform avatar treeform commented on June 18, 2024 1

I have added the .nimble dependancies. I have tested it working on mac and windows.

There is still a ton of work todo.

from fidget.

andreaferretti avatar andreaferretti commented on June 18, 2024 1

Then... I guess it should not be mentioned at all in the nimble file and the import should become import nimgl/glfw?

Anyway, I tried changing the nimble file by removing

requires "glfw >= 3.2.1"

and adding

requires "nimgl >= 1.0.1"

and changing src/fidget/openglbackend/base.nim like this

import nimgl/glfw
# import glfw3

and it still does not compile (Error: undeclared identifier: 'GetWindowSize').

Now, I understand that this is a project in development, so it's ok.

I am a little worried about the dependencies though. I guess Nimble should just forbid global installs (no more nimble install somelibrary) in favour of requires somelibrary, otherwise the Nim ecosystem is going to become quite brittle.

from fidget.

treeform avatar treeform commented on June 18, 2024

Sorry this project is not ready yet. I am still working on it.

I need to update nimble.

You just run the projects directly nim c -r ...yourfile...

fidgetgen was for some thing else..

from fidget.

andreaferretti avatar andreaferretti commented on June 18, 2024

I understand that the project is not in shape right now. If you ever have the time, I think it would be worthwhile to actually include the dependencies (with working versions) in the nimble file. Right now, it is a hit and miss guessing which dependencies are needed, and I have not been able to compile any example

from fidget.

andreaferretti avatar andreaferretti commented on June 18, 2024

Thank you! Now I understand the problem I had with the dependencies. Your nimble file declares

requires "glfw >= 3.2.1"

but the latest version published on https://github.com/ephja/nim-glfw is 0.3.1

Do you have access to a more up to date version of glfw?

from fidget.

SolitudeSF avatar SolitudeSF commented on June 18, 2024

@andreaferretti thats probably it https://github.com/nimgl/glfw
nimble file should point to git repo instead of just glfw

from fidget.

andreaferretti avatar andreaferretti commented on June 18, 2024

Then maybe this should be published on nimble. On https://github.com/nim-lang/packages/blob/master/packages.json, glfw points to https://github.com/ephja/nim-glfw

from fidget.

SolitudeSF avatar SolitudeSF commented on June 18, 2024

it is published on nimble in form of https://github.com/nimgl/nimgl subpackage

from fidget.

andreaferretti avatar andreaferretti commented on June 18, 2024

That is good to know, but what does it mean? On the README of Nimble, subpackages are not even mentioned

from fidget.

SolitudeSF avatar SolitudeSF commented on June 18, 2024

it means you import it with nimgl/glfw instead of just glfw. i mean a logical subpackage.

from fidget.

treeform avatar treeform commented on June 18, 2024

I am using https://github.com/rafaelvasco/nimrod-glfw/blob/master/glfw.nimble

packageName   = "glfw"
version       = "3.2.1"

I don't use https://github.com/nimgl/nimgl so that will not work.

from fidget.

treeform avatar treeform commented on June 18, 2024

I think the https://github.com/rafaelvasco/nimrod-glfw/blob/master/glfw.nimble is broken. It installs as requires "nimrod-glfw >= 3.2.1" but internally calls itself glfw and goes into a folder called glfw-3.2.1 but you import it as glfw3 ... its a mess?

from fidget.

andreaferretti avatar andreaferretti commented on June 18, 2024

Well, a little mess, but less than I had feared! :-) Nimble suggests to use a module name equal to the package name, but this is not enforced (yet?).

So, it is just a matter of changing

requires "glfw >= 3.2.1"

to

requires "nimrod-glfw >= 3.2.1"

At least now I am able to compile! :-) Not that I see much, the text and inputs are still missing, but I guess that's just the status of the native backend

from fidget.

treeform avatar treeform commented on June 18, 2024

Sorry the text missing was caused by recent "Mac fix". I have fixed it again. Some of the examples should be showing up now. Added a section to the readme about which examples to run:

Now to run the examples:

Native examples for Windows, macOS, and Linux:

cd examples
nim c -r bars/bars.nim
nim c -r fonts/fonts.nim
nim c -r hovers/hovers.nim
nim c -r inputs/inputs.nim
nim c -r padoftext/padoftext.nim
nim c -r padofcode/padofcode.nim
nim c -r basic/basic.nim

Runs the same examples as HTML:

cd examples
nim js -o:bars/bars.js bars/bars.nim
nim js -o:fonts/fonts.js fonts/fonts.nim
nim js -o:hovers/hovers.js hovers/hovers.nim
nim js -o:inputs/inputs.js inputs/inputs.nim
nim js -o:padoftext/padoftext.js padoftext/padoftext.nim
nim js -o:padofcode/padofcode.js padofcode/padofcode.nim
nim js -o:basic/basic.js basic/basic.nim

from fidget.

andreaferretti avatar andreaferretti commented on June 18, 2024

Great, thank you! Now all examples run for me as well! :-)

from fidget.

matkuki avatar matkuki commented on June 18, 2024

Hi guys,

I have added the changes to nimrod-glfw as noted above but I still get this error during compilation:

...\.nimble\pkgs\fidget-0.2.1\fidget\openglbackend\slate.nim(27, 33) Error: type mismatch: got <seq[uint8]>
but expected one of:
proc compress(input: string): string
  first type mismatch at position: 1
  required type for input: string
  but expression 'mip.data' is of type: seq[uint8]

expression: snappy.compress(mip.data)

I'm on Windows 10 with Nim Compiler Version 1.1.1 [Windows: amd64].

from fidget.

treeform avatar treeform commented on June 18, 2024

@matkuki it looks like you have the wrong snappy version? Make sure you have this one: https://github.com/treeform/snappy

It looks like the nimble's snappy is not mine? https://nimble.directory/pkg/snappy

I'll fix my .nimble file.

from fidget.

treeform avatar treeform commented on June 18, 2024

I have updated the nimble file see if it works for you now.

Also latest version of nim is 1.0.2 not 1.1.1! https://nim-lang.org/blog.html

from fidget.

SolitudeSF avatar SolitudeSF commented on June 18, 2024

1.1.1 is devel

from fidget.

matkuki avatar matkuki commented on June 18, 2024

Yes, I did a fresh install a couple of days ago.

@treeform
I deleted my old snappy installation and tried your new nimble file, but I had to change the line:
requires "https://github.com/treeform/snappy@4c900cb0d979a2b8fc07835925d268319a6b1129"
to
requires "https://github.com/treeform/snappy"
otherwise I got an error when nimble wanted to download the repository.
But I still get the same error.

from fidget.

andreaferretti avatar andreaferretti commented on June 18, 2024

The right incantation is
requires "https://github.com/treeform/snappy#4c900cb0d979a2b8fc07835925d268319a6b1129"

from fidget.

matkuki avatar matkuki commented on June 18, 2024

@andreaferretti
Thanks, yes that fixes the snappy installation.
Just noticed that the nim js ... compilation works, but the nim c ... doesn't.
I guess it's not ready yet?

from fidget.

treeform avatar treeform commented on June 18, 2024

What issue do you get? It supposed to all work.

from fidget.

matkuki avatar matkuki commented on June 18, 2024

Hey @treeform
As I showed above, it's the same error when compiling for example examples/basic/basic.nim with nim c basic.nim:

Hint: slate [Processing]
Hint: snappy [Processing]
...\.nimble\pkgs\fidget-0.2.1\fidget\openglbackend\slate.nim(27, 33) Error: type mismatch: got <seq[uint8]>
but expected one of:
proc compress(input: string): string
  first type mismatch at position: 1
  required type for input: string
  but expression 'mip.data' is of type: seq[uint8]

expression: snappy.compress(mip.data)

... but compiling with nim js basic.nim works.

from fidget.

treeform avatar treeform commented on June 18, 2024

I have fixed the nimble file can you try reinstalling this package (which should fix the dependencies) and see if it works for you?

from fidget.

matkuki avatar matkuki commented on June 18, 2024

Hey @treeform
I removed fidget and reinstalled it with nimble install https://github.com/treeform/fidget and compiled the basic.nim with ˙nim c basic.nim˙ again and got the same error I think:

$ nim c basic.nim
Hint: used config file 'C:\Nim\config\nim.cfg' [Conf]
Hint: used config file '...\nim.cfg' [Conf]
Hint: used config file 'C:\Nim\config\config.nims' [Conf]
Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: basic [Processing]
Hint: fidget [Processing]
Hint: macros [Processing]
Hint: tables [Processing]
Hint: hashes [Processing]
Hint: math [Processing]
Hint: bitops [Processing]
Hint: algorithm [Processing]
Hint: json [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: unicode [Processing]
Hint: lexbase [Processing]
Hint: streams [Processing]
Hint: parsejson [Processing]
Hint: options [Processing]
Hint: typetraits [Processing]
Hint: chroma [Processing]
Hint: names [Processing]
Hint: colortypes [Processing]
Hint: transformations [Processing]
Hint: print [Processing]
Hint: vmath [Processing]
Hint: random [Processing]
Hint: times [Processing]
Hint: winlean [Processing]
Hint: dynlib [Processing]
Hint: time_t [Processing]
Hint: uibase [Processing]
Hint: sequtils [Processing]
Hint: textboxes [Processing]
Hint: typography [Processing]
Hint: flippy [Processing]
Hint: os [Processing]
Hint: pathnorm [Processing]
Hint: osseps [Processing]
Hint: read [Processing]
Hint: components [Processing]
Hint: write [Processing]
Hint: font [Processing]
Hint: svg [Processing]
Hint: xmlparser [Processing]
Hint: parsexml [Processing]
Hint: strtabs [Processing]
Hint: xmltree [Processing]
Hint: ttf [Processing]
Hint: endians [Processing]
Hint: opentype [Processing]
Hint: encodings [Processing]
Hint: opentypedata [Processing]
Hint: rasterizer [Processing]
Hint: layout [Processing]
...\fidget\src\fidget\uibase.nim(1, 23) Warning: imported and not used: 'sequtils' [UnusedImport]
Hint: backendopengl [Processing]
Hint: base [Processing]
Hint: opengl [Processing]
Hint: input [Processing]
...\fidget\src\fidget\openglbackend\input.nim(1, 8) Warning: imported and not used: 'unicode' [UnusedImport]
Hint: perf [Processing]
Hint: strformat [Processing]
Hint: staticglfw [Processing]
C:\Nim\lib\system\timers.nim(27, 8) Hint: '-' is declared but not used [XDeclaredButNotUsed]
C:\Nim\lib\system\timers.nim(24, 8) Hint: 'getTicks' is declared but not used [XDeclaredButNotUsed]
...\fidget\src\fidget\openglbackend\base.nim(3, 31) Warning: imported and not used: 'print' [UnusedImport]
...\fidget\src\fidget\openglbackend\base.nim(2, 17) Warning: imported and not used: 'sequtils' [UnusedImport]
Hint: context [Processing]
Hint: meshes [Processing]
Hint: shaders [Processing]
...\fidget\src\fidget\openglbackend\shaders.nim(3, 8) Warning: imported and not used: 'times' [UnusedImport]
Hint: textures [Processing]
...\fidget\src\fidget\openglbackend\textures.nim(90, 23) Hint: conversion from GLenum to itself is pointless [ConvFromXtoItselfNotNeeded]

...\fidget\src\fidget\openglbackend\textures.nim(91, 23) Hint: conversion from GLenum to itself is pointless [ConvFromXtoItselfNotNeeded]

...\fidget\src\fidget\openglbackend\textures.nim(1, 8) Warning: imported and not used: 'os' [UnusedImport]
...\fidget\src\fidget\openglbackend\textures.nim(1, 12) Warning: imported and not used: 'streams' [UnusedImport]
...\fidget\src\fidget\openglbackend\textures.nim(1, 21) Warning: imported and not used: 'tables' [UnusedImport]
...\fidget\src\fidget\openglbackend\textures.nim(1, 29) Warning: imported and not used: 'strutils' [UnusedImport]
...\fidget\src\fidget\openglbackend\textures.nim(1, 39) Warning: imported and not used: 'times' [UnusedImport]
...\fidget\src\fidget\openglbackend\textures.nim(2, 23) Warning: imported and not used: 'vmath' [UnusedImport]
...\fidget\src\fidget\openglbackend\textures.nim(2, 16) Warning: imported and not used: 'print' [UnusedImport]
Hint: slate [Processing]
Hint: snappy [Processing]
...\fidget\src\fidget\openglbackend\slate.nim(27, 33) Error: type mismatch: got <seq[uint8]>
but expected one of:
proc compress(input: string): string
  first type mismatch at position: 1
  required type for input: string
  but expression 'mip.data' is of type: seq[uint8]

expression: snappy.compress(mip.data)

I also tried removing snappy and fidget (as snappy seems to be causing the problem), then reinstalled fidget, but the error persists.

from fidget.

treeform avatar treeform commented on June 18, 2024

from fidget.

matkuki avatar matkuki commented on June 18, 2024

I tried removing snappy again and reinstalling fidget with:

git clone https://github.com/treeform/fidget
cd fidget 
nimble install
cd examples/minimal
nim c -r minimal

But the installation always installs the same version of snappy:

$ nimble install
  Verifying dependencies for [email protected]
      Info: Dependency on chroma@>= 0.0.1 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on typography@>= 0.2.2 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on flippy@>= 0.2.0 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on vmath@>= 0.1.0 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on chroma@>= 0.0.1 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on print@>= 0.1.0 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on stb_image@>= 2.1 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on vmath@>= 0.2.0 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on chroma@>= 0.0.1 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on print@>= 0.1.0 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on stb_image@>= 2. already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on flippy@>= 0.2.0 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on vmath@>= 0.1.0 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on chroma@>= 0.0.1 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on print@>= 0.1.0 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on stb_image@>= 2.1 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on vmath@>= 0.2.0 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on print@>= 0.1.0 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on opengl@>= 1.2.3 already satisfied
  Verifying dependencies for opengl@#head
 Installing snappy@any version
Downloading https://github.com/jangko/snappy using git
  Verifying dependencies for [email protected]
 Installing [email protected]
   Success: snappy installed successfully.
      Info: Dependency on html5_canvas@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on https://github.com/treeform/staticglfw@#dfebb6dc9b7ecabfa87608cb9d645692545f7880 already satisfied
  Verifying dependencies for staticglfw@#dfebb6dc9b7ecabfa87608cb9d645692545f7880
 Installing [email protected]
   Success: fidget installed successfully.

The error is still there.

from fidget.

treeform avatar treeform commented on June 18, 2024

There is some thing strange going on with snappy. Its complaining about this signature:

proc compress(input: string): string

But its not part of https://github.com/jangko/snappy/blob/master/snappy.nim .

The signature there is:

template compress*(src: openArray[byte]): seq[byte] =

It looks like you are getting it from this snappy:
https://github.com/dfdeshom/nimsnappy

It claims to be nimsnappy but the file it provides is snappy.nim so it clashes with the other import.

Please uninstall that nimsnappy so that proper snappy can be found. Which is https://github.com/jangko/snappy/blob/master/snappy.nim version.

So can go into your ~/.nimble/pkg folder and make sure all things that look like "snappy" are gone.

from fidget.

matkuki avatar matkuki commented on June 18, 2024

Yes, that did it! nimsnappy was the culprit!
Uninstalling snappy and nimsnappy and reinstalling fidget fixed the issue.

Thank you, @treeform !

I would close this issue, but I don't have the necessary rights.

from fidget.

treeform avatar treeform commented on June 18, 2024

Cool I am glad that worked!

from fidget.

Related Issues (20)

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.