Fusion / libui.cr

Crystal-lang bindings for libui
MIT License
176 stars 17 forks source link

How to run on linux #5

Open ghost opened 7 years ago

ghost commented 7 years ago

Hi Write more the process of running programs using the library libui.cr on linux (ubuntu)

refi64 commented 7 years ago

You mean...like this?

https://github.com/Fusion/libui.cr/blob/master/README.md#development

The instructions are already for OSX and Linux.

ghost commented 7 years ago

@kirbyfan64 This instruction is unclear

Fusion commented 7 years ago

Sergiy,

What part of the instructions, specifically, do you find unclear? If you share with us where you are stuck, this will allow me to update the documentation accordingly.

tzekid commented 7 years ago

@yenel The documentation on libui's page is fuzzy. The static linking in crystal didn't work (as I expected).

I haven't found an 'easy-way' of installing libui on a fresh install of ubuntu.
The only way I've found is to download, build and install the libui and libpcre libraries.
The process (in my experience was/) is a bit tedious.

Here's a little script I wrote that more or less automates this process (tested on a fresh install of Ubuntu 17.04)

nedpals commented 7 years ago

@tzekid I followed your script but it appears it has conflicts with the dependencies /usr/bin/ld: warning: libpcre.so.3, needed by //lib/x86_64-linux-gnu/libglib-2.0.so.0, may conflict with libpcre.so.1

I'm using 16.04 btw

tzekid commented 7 years ago

@nedpals Can you give out a bit more info please ? e.g. Did you get any errors / warnings whilst following the script ? How did you get the warning ? etc.

nedpals commented 7 years ago

@tzekid Nevermind, it was just a warning. Works fine except on compiling it shows that warning. Btw your script is fine except when copying libraries. It throws an error having no "out" folder when copying libui.

tzekid commented 7 years ago

@nedpals Ok. Thanks. Fixed it :)

ddrscott commented 7 years ago

on OSX I get the following:

% crystal build --link-flags "-L$(PWD)" src/examples/controlgallery/main.cr
ld: library not found for -lui
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: execution of command failed with code: 1: `cc -o "/Users/scott.pierce/git/libui.cr/main" "${@}" -L/Users/scott.pierce/git/libui.cr -rdynamic  -lui -lpcre -lgc -lpthread /usr/local/Cellar/crystal-lang/0.22.0/src/ext/libcrystal.a -levent -liconv -ldl -L/usr/lib -L/usr/local/lib`
tzekid commented 7 years ago

@ddrscott: Crystal doesn't recognize libui on your system. You need to build it.

rubyFeedback commented 2 years ago

You need to build it.

Not sure.

The ruby gem comes with the bindings for osx and windows so it just works there.

Perhaps a crystal shard could have the same and support it. Perhaps even on windows now? The above comment is ~5 years old so perhaps things improved a lot meanwhile.

Edit: For those unaware, I referred to kojix2' bindings in ruby here:

https://github.com/kojix2/LibUI