Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing on Ubuntu x86_64 #5

Open
MangelMaxime opened this issue Feb 10, 2016 · 7 comments
Open

Installing on Ubuntu x86_64 #5

MangelMaxime opened this issue Feb 10, 2016 · 7 comments
Assignees

Comments

@MangelMaxime
Copy link

Hello, I am trying to install ftlk4lua on my computer running under Ubuntu. And I god the following error :

sudo luarocks install fltk4lua
[sudo] password for shadaen: 
Installing https://luarocks.org/fltk4lua-0.1-1.src.rock...
Using https://luarocks.org/fltk4lua-0.1-1.src.rock... switching to 'build' mode
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/fltk4lua.o src/fltk4lua.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_enums.o src/f4l_enums.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_ask.o src/f4l_ask.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_image.o src/f4l_image.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_shared_image.o src/f4l_shared_image.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_widget.o src/f4l_widget.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_box.o src/f4l_box.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_button.o src/f4l_button.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_chart.o src/f4l_chart.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_clock.o src/f4l_clock.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_group.o src/f4l_group.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_browserx.o src/f4l_browserx.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_browser.o src/f4l_browser.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_file_browser.o src/f4l_file_browser.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_check_browser.o src/f4l_check_browser.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_input_choice.o src/f4l_input_choice.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_color_chooser.o src/f4l_color_chooser.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_pack.o src/f4l_pack.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_scroll.o src/f4l_scroll.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_spinner.o src/f4l_spinner.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_tabs.o src/f4l_tabs.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_tile.o src/f4l_tile.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_window.o src/f4l_window.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_wizard.o src/f4l_wizard.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_input.o src/f4l_input.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_menu.o src/f4l_menu.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_choice.o src/f4l_choice.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_menu_bar.o src/f4l_menu_bar.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_menu_button.o src/f4l_menu_button.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_progress.o src/f4l_progress.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_valuator.o src/f4l_valuator.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_adjuster.o src/f4l_adjuster.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_counter.o src/f4l_counter.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_dial.o src/f4l_dial.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_roller.o src/f4l_roller.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_slider.o src/f4l_slider.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_value_input.o src/f4l_value_input.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o src/f4l_value_output.o src/f4l_value_output.cxx
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o moon/moon.o moon/moon.c
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -c -o compat-5.3/c-api/compat-5.3.o compat-5.3/c-api/compat-5.3.c
gcc -O2 -fPIC -I/usr/include/lua5.2 -Imoon -Icompat-5.3/c-api -DMOON_PREFIX=f4lx -DCOMPAT53_PREFIX=f4lx -DNDEBUG `/usr/local/bin/fltk-config --use-images --cxxflags` -shared -o fltk4lua.so src/fltk4lua.o src/f4l_enums.o src/f4l_ask.o src/f4l_image.o src/f4l_shared_image.o src/f4l_widget.o src/f4l_box.o src/f4l_button.o src/f4l_chart.o src/f4l_clock.o src/f4l_group.o src/f4l_browserx.o src/f4l_browser.o src/f4l_file_browser.o src/f4l_check_browser.o src/f4l_input_choice.o src/f4l_color_chooser.o src/f4l_pack.o src/f4l_scroll.o src/f4l_spinner.o src/f4l_tabs.o src/f4l_tile.o src/f4l_window.o src/f4l_wizard.o src/f4l_input.o src/f4l_menu.o src/f4l_choice.o src/f4l_menu_bar.o src/f4l_menu_button.o src/f4l_progress.o src/f4l_valuator.o src/f4l_adjuster.o src/f4l_counter.o src/f4l_dial.o src/f4l_roller.o src/f4l_slider.o src/f4l_value_input.o src/f4l_value_output.o moon/moon.o compat-5.3/c-api/compat-5.3.o `/usr/local/bin/fltk-config --use-images --ldflags` -lstdc++
/usr/bin/ld: /usr/local/lib/libfltk_images.a(fl_images_core.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libfltk_images.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:63: recipe for target 'fltk4lua.so' failed
make: *** [fltk4lua.so] Error 1

Error: Build error: Failed building.

Here are some informations about my system.

○ → uname -a
Linux shadaen-G750JW 3.19.0-47-generic #53-Ubuntu SMP Mon Jan 18 14:02:48 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

○ → lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 15.04
Release:    15.04
Codename:   vivid

I have lua5.2 configure as main lua version on my computer.

Do you have any idea ?

@siffiejoe
Copy link
Owner

Yes. x86-64 requires that you compile all object files that are part of a shared library with -fPIC (or -fpic). It seems that the object files in /usr/local/lib/libfltk_images.a have been compiled without this flag. You will either have to recompile your FLTK libraries using -fPIC, or use the library files from the apt repositories.

@MangelMaxime
Copy link
Author

Hallelujah ! ! !

Ok after one evening of try and with your help I got fltk4lua working on my ubuntu computer. (I used the compiled version as the library one seems not working for me).

I think it's probably a good idea to put the following informations inside of the wiki :
For building, FLTK on Unix 64 do :

○ →  ./configure CFLAGS="-fpic" CXXFLAGS="-fpic"
○ →  make
○ →  [sudo] make install

Please be sure to delete all previous build and pre-build data from FLTK sources and destination installation folder (ex: /usr/local/lib)

Thanks for your help @siffiejoe .

Let's start playing with fltk4lua :).
Just a quick question, is the implementation complete or there is some lack ?

@siffiejoe
Copy link
Owner

The implementation is not complete. Most simple widgets are available (see the list on the wiki). What's missing is the low-level drawing and event handling code (because you have to subclass a widget to use it), the composite widgets like Fl_Tree, Fl_Table, Fl_Text_Display (same reason), and some Forms emulation widgets (didn't see the point). The first two I will probably add some time in the future.

Regarding the -fpic issue: I will add a sentence to the relevant wiki page ...

@MangelMaxime
Copy link
Author

Ok thanks for your answer.
But would you say that it is possible to write a simple text editor ? (Just trying to see the limit :) )

@siffiejoe
Copy link
Owner

A simple one? Sure. Just use an fl.Input widget with "FL_MULTILINE_INPUT" or "FL_MULTILINE_INPUT_WRAP"as its type. However if you need syntax highlighting or different fonts, you'd have to subclass the widget to add custom drawing and event handling (or use the Fl_Text_Editor class). Both is currently not possible in Lua.

@MangelMaxime
Copy link
Author

Ok thanks for the answer. I will try it.

I was thinking to build one with minimal synthax highlighting so if I understand well the subclass need to be done via cpp ?
Sorry for all this questions, it's my first time using lua with a cpp binding like the one of fltk4lua.

@siffiejoe siffiejoe self-assigned this Oct 30, 2016
@bogbasic
Copy link

bogbasic commented Sep 6, 2020

Very helpful thread. I spent an evening trying to sort this out and I wouldn't have managed without this info, so many thanks.

As MangelMaxime says, the main things are:
Delete any FLTK .a files already in /usr/local/lib, scrub your FTLK installation folder and re-extract everything again from source.
For compiling FLTK again, use this command: ./configure CFLAGS="-fpic" CXXFLAGS="-fpic"
instead of just ./configure before the usual make and sudo make install.
For fltk4lua:
git clone --recurse-submodules https://github.com/siffiejoe/lua-fltk4lua.git (** see below)
Edit Makefile and change lines 5-6 from 5.2 to 5.3 as follows:
DLL_INSTALL_DIR = /usr/lib/lua/5.3
LUA_INCDIR = /usr/include/lua5.3

Then make and sudo make install.

** I suspect sudo luarocks install fltk4lua would have worked instead of cloning the git version.

This seems to work for me on Lubuntu 20.04 so please do put a mention on the wiki page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants