su8 / pinky-bar

Gather some system information and show it in this program
GNU General Public License v3.0
14 stars 5 forks source link

Can't compile with languages in Debian #32

Closed lasers closed 5 years ago

lasers commented 6 years ago

Trying --with-perl.

$ ./configure --prefix=$HOME/.cache --with-perl
$ make  # ERROR

make ==> 589 lines of messages in Debian. https://paste.ubuntu.com/p/jNxvVYS5Tz/

Thought you should know this.

EDIT: Maybe it's because I'm on Debian stable? EDIT: ruby is old too. EDIT: Can't use lua. Missing lua.h. I tried two *-dev packages containing lua.h. Does not do anything. I think my system is too stable for pinkybar.

su8 commented 6 years ago

On FreeBSD, OpenBSD and my system, perl compiles fine but with many warnings comming from the perl itself. Lua on other hand on FreeBSD is in different location and not in /usr/include/lua.h, but in /usr/local/include/lua5.2/lua.h

Which version of perl do you have installed, on my system it's 5.24.3 ?

su8 commented 6 years ago

Can you also provide the output of

perl -MExtUtils::Embed -e ldopts

perl -MExtUtils::Embed -e ccopts
su8 commented 6 years ago

EDIT: ruby is old too.

Ruby requires manual editing of m4/extend.m4 line 291 to point to the correct version of your ruby. Can't figure out how to detect the ruby version and it's cflags/ldflags without using PKG_CHECK_MODULES.

su8 commented 6 years ago

So your perl version is too 5.24 like mine, but it seems it cannot find the lib perl

extend.c: In function ‘call_user_subroutine’:
/usr/lib/x86_64-linux-gnu/perl/5.24/CORE/perl.h:166:16: error: ‘my_perl’ undeclared (first use in this function)

as on this line it's the interpreter itself

https://github.com/su8/pinky-bar/blob/b091a7df763e6c904f35217dc4054771fd675c1c/src/extend.c#L307

edit:

Can you remove the "static" keyword in the above line in src/extend.c and try recompiling.

lasers commented 6 years ago
$ perl -MExtUtils::Embed -e ldopts
-Wl,-E  -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.24/CORE -lperl -ldl -lm -lpthread -lc -lcrypt

$ perl -MExtUtils::Embed -e ccopts
 -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -I/usr/lib/x86_64-linux-gnu/perl/5.24/CORE %

Removing static does not work. Same number of compilation lines.

Version is v5.24.1.

su8 commented 6 years ago

Lib Perl is presented in your output. Maybe the Debian packagers didn't included all Perl features as tested on *BSD and my computer.

lasers commented 6 years ago

Can't make with --with-go too. I will test others sooner or later.

diff --git a/src/Makefail.skel b/src/Makefail.skel
index 8f5567c..228647e 100644
--- a/src/Makefail.skel
+++ b/src/Makefail.skel
@@ -3,7 +3,10 @@ AM_CFLAGS = {amCF} \

 bin_PROGRAMS = pinkybar

-pinkybar_LDADD = $(X_LIBS) $(ALSA_LIBS) $(MPD_LIBS) $(PCI_LIBS) $(DVD_LIBS) $(SENSORS_LIBS) $(CURL_LIBS) $(LIBNL_LZ) $(PERL_LZ) $(LUA_LIBS) $(PYTHON_LZ) $(RUBY_LZ) $(R_LZ) $(ECL_LIBS) $(OCAML_LZ) $(RUST_LIBS) $(GO_LIBS) $(SLANG_LIBS) $(TCL_LIBS) $(SQLITE_LIBS) {bzdlibs}
+pinkybar_LDADD = $(X_LIBS) $(ALSA_LIBS) $(MPD_LIBS) $(PCI_LIBS) $(DVD_LIBS)
+$(SENSORS_LIBS) $(CURL_LIBS) $(LIBNL_LZ) $(PERL_LZ) $(LUA_LIBS) $(PYTHON_LZ) $(RUBY_LZ)
+$(R_LZ) $(ECL_LIBS) $(OCAML_LZ) $(RUST_LIBS) $(GO_LIBS) $(SLANG_LIBS) $(TCL_LIBS)
+$(SQLITE_LIBS) {bzdlibs} pinky2.a
 pinkybar_SOURCES = main.c           \
     common.c                        \
     cpu.c                           \
lasers commented 6 years ago

Can't make with --with-assembly too.

diff --git a/src/Makefail.skel b/src/Makefail.skel
index 8f5567c..6250904 100644
--- a/src/Makefail.skel
+++ b/src/Makefail.skel
@@ -44,6 +44,7 @@ pinkybar_SOURCES = main.c           \
     include/colours/xmobar_colours.h \
     include/colours/x11_colours.h   \
     include/options_generator.h     \
+    ../extra/scripts/pinky.s \
     {srcFiles}

 .ml.o:

Partial lines.

make[2]: Entering directory '~/src/pinky-bar/src'
  CXXLD    pinkybar
extend.o: In function `get_assembly':
~/src/pinky-bar/src/extend.c:485: undefined reference to `uzer_func3'
collect2: error: ld returned 1 exit status
Makefile:506: recipe for target 'pinkybar' failed
make[2]: *** [pinkybar] Error 1
lasers commented 6 years ago

Woo. --ocaml ran okay. Got a Hello World. Can't specify more than once. Hmm. EDIT: Woo. --cpp ran okay. Got a Hello World. Can't specify more than once. Hmm.

lasers commented 6 years ago

I seems to configure, make, make install --with-rust okay.

However, when I ~/.cache/bin/pinkybar --rust, I get a segmentation fault. I tried again with gdb. It printed gdb: unrecognized option '--rust'.

Here's my skel.

diff --git a/src/Makefail.skel b/src/Makefail.skel
index 8f5567c..74ce54a 100644
--- a/src/Makefail.skel
+++ b/src/Makefail.skel
@@ -3,7 +3,7 @@ AM_CFLAGS = {amCF} \

 bin_PROGRAMS = pinkybar

-pinkybar_LDADD = $(X_LIBS) $(ALSA_LIBS) $(MPD_LIBS) $(PCI_LIBS) $(DVD_LIBS) $(SENSORS_LIBS) $(CURL_LIBS) $(LIBNL_LZ) $(PERL_LZ) $(LUA_LIBS) $(PYTHON_LZ) $(RUBY_LZ) $(R_LZ) $(ECL_LIBS) $(OCAML_LZ) $(RUST_LIBS) $(GO_LIBS) $(SLANG_LIBS) $(TCL_LIBS) $(SQLITE_LIBS) {bzdlibs}
+pinkybar_LDADD = $(X_LIBS) $(ALSA_LIBS) $(MPD_LIBS) $(PCI_LIBS) $(DVD_LIBS) $(SENSORS_LIBS) $(CURL_LIBS) $(LIBNL_LZ) $(PERL_LZ) $(LUA_LIBS) $(PYTHON_LZ) $(RUBY_LZ) $(R_LZ) $(ECL_LIBS) $(OCAML_LZ) $(RUST_LIBS) $(GO_LIBS) $(SLANG_LIBS) $(TCL_LIBS) $(SQLITE_LIBS) {bzdlibs} pinky.a
 pinkybar_SOURCES = main.c           \
     common.c                        \
     cpu.c                           \
lasers commented 6 years ago

Can't make with --with-r too.

$ make
Making all in src
make[1]: Entering directory '~/src/pinky-bar/src'
make  all-am
make[2]: Entering directory '~/src/pinky-bar/src'
  CC       extend.o
extend.c:51:24: fatal error: Rinternals.h: No such file or directory
 #include <Rinternals.h>
                        ^
compilation terminated.
Makefile:533: recipe for target 'extend.o' failed

I have /usr/share/R/include/Rinternals.h available... owned by r-base-core.

Should I stop testing scripts? May be easier if you try them in Debian, Ubuntu, Arch, etc.

su8 commented 6 years ago

Assembly is generated and optimized for my computer. Every time you edit Makefail.skel you have to run Perl set.pl distribution and the rest command afterwards. ♥

su8 commented 6 years ago

Here's how to generate and optimize assembly for your machine:

Save it as test.c

char *uzer_func3(void) {
  char *str = "Hello World";
  return str;
}

Then run gcc -S -Os test.c, then update extra/scripts/pinky.s with the content of test.s


I have /usr/share/R/include/Rinternals.h available... owned by

It shouldn't be there, but in /usr/include.

Just pushed a new locations to be searched, you can try again to compile --with-r. If it complains about R home is unset, then export R_HOME=/usr/share/R

May be easier if you try them in Debian, Ubuntu, Arch, etc.

I know Arch and Sabayon that turns every possible option on by default. In Gentoo we have USE flags for that, can't say anything about other distros, it depends on the packagers and their decisions.

su8 commented 6 years ago

However, when I ~/.cache/bin/pinkybar --rust, I get a segmentation fault. I tried again with gdb. It printed gdb: unrecognized option '--rust'

Thanks, the extern was pointing to different function than the used one

https://github.com/su8/pinky-bar/blob/a6bbefc155fef1fe5edbb8d914be73477b67f98f/src/extend.c#L411

https://github.com/su8/pinky-bar/blob/a6bbefc155fef1fe5edbb8d914be73477b67f98f/src/extend.c#L416

lasers commented 6 years ago

--with-rust

...
extend.o: In function `get_rust':
~/src/pinky-bar/src/extend.c:416: undefined reference to `uzer_func2'
~/src/pinky-bar/src/extend.c:418: undefined reference to `Rfree'
collect2: error: ld returned 1 exit status

Scratch that. I forget about src/Makefail.skel stuffs. Working okay.... Hello World.

lasers commented 6 years ago

--with-assembly

Making all in src
make[1]: Entering directory '/home/chris/src/pinky-bar/src'
make  all-am
make[2]: Entering directory '/home/chris/src/pinky-bar/src'
CXXLD    pinkybar
/usr/bin/ld: ../extra/scripts/pinky.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status

I did src/Makefail.skel too.

su8 commented 6 years ago

Can you add -fPIC to AM_CFLAGS in src/Makefail.skel and try again ?

lasers commented 6 years ago

Same thing.

diff --git a/src/Makefail.skel b/src/Makefail.skel
index 8f5567c..87b627e 100644
--- a/src/Makefail.skel
+++ b/src/Makefail.skel
@@ -1,10 +1,11 @@
 AM_CFLAGS = {amCF} \
-  -I/usr/local/include $(LIBNL_CF) $(PERL_CF) $(PYTHON_CF) $(RUBY_CF) $(R_CF) $(OCAML_CF)
+  -I/usr/local/include $(LIBNL_CF) $(PERL_CF) $(PYTHON_CF) $(RUBY_CF) $(R_CF) $(OCAML_CF) -fPIC

 bin_PROGRAMS = pinkybar

 pinkybar_LDADD = $(X_LIBS) $(ALSA_LIBS) $(MPD_LIBS) $(PCI_LIBS) $(DVD_LIBS) $(SENSORS_LIBS) $(CURL_LIBS) $(LIBNL_LZ) $(PERL_LZ) $(LUA_LIBS) $(PYTHON_LZ) $(RUBY_LZ) $(R_LZ) $(ECL_LIBS) $(OCAML_LZ) $(RUST_LIBS) $(GO_LIBS) $(SLANG_LIBS) $(TCL_LIBS) $(SQLITE_LIBS) {bzdlibs}
 pinkybar_SOURCES = main.c           \
+    ../extra/scripts/pinky.s \
     common.c                        \
     cpu.c                           \
     curl.c                          \
su8 commented 6 years ago

Can you try adding the following after make, once you run ./configure - make CC=/usr/bin/gcc -fPIC ?

lasers commented 6 years ago

Like this?

$ make CC=/usr/bin/gcc -fPIC
make: PIC: No such file or directory
make: *** No rule to make target 'PIC'.  Stop.
su8 commented 6 years ago

For go, can you try moving extra/scripts/pinky2.go to src/ and edit the following line to point to pinky2.go. I remember some go version before 1.10 couldn't compile pinky2.go when using sub-folders.

https://github.com/su8/pinky-bar/blob/31fd6b8c5ef341116514317baa0784253732f3a2/src/Makefail.skel#L56

lasers commented 6 years ago

go works fine. It was this I didn't know about.

Every time you edit Makefail.skel you have to run Perl set.pl distribution and the rest command afterwards. ♥

:heart:

lasers commented 6 years ago

--with-slang works fine. --with-tcl does not.

extend.c:64:17: fatal error: tcl.h: No such file or directory

include

I have tcl, tcl-dev, tcl8.6, tcl8.6-dev installed. /usr/include/tcl8.6/tcl.h.

su8 commented 6 years ago

It's tricky as I have to keep updating extend.m4 if I add TCL_CF variable in there. One temporary solution is to add -I/usr/include/tcl8.6 to AM_CFLAGS in src/Makefail.skel.

lasers commented 6 years ago

Temporary solution for tcl confirmed working okay. Ty.

lasers commented 5 years ago

Debian GTFO. I'm not on Debian anymore so I'm going to close this. Many thanks for helping me.