owntone / owntone-server

Linux/FreeBSD DAAP (iTunes) and MPD audio server with support for AirPlay 1 and 2 speakers (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio.
https://owntone.github.io/owntone-server
GNU General Public License v2.0
2.07k stars 236 forks source link

Question : some help with antlr3 #92

Closed Psychoteur closed 1 year ago

Psychoteur commented 9 years ago

Hello,

I'm looking for some help. I'm trying to install forked-daapd under Freenas 9.3 and I have some problem with antlr3. "configure: error: antlr3 wrapper not found and pre-generated files not available"

I followed the instructions from INSTALL but I must have misunderstood something.

I create a file "antlr3"

!/bin/sh

CLASSPATH=/root/antlr3/download/antlr-3.2.jar exec /usr/local/bin/java -cp $CLASSPATH org.antlr.Tool "@

before that: git clone https://github.com/antlr/antlr3.git

I tried several things like java -cp /path/to/antlr3.jar

I tried my friend google too but I'm running low on solutions.

Thanks.

ejurgensen commented 9 years ago

It's been a while, but here is what I think I did in FreeBSD 10 (thanks to some help from @freultwah): https://github.com/ejurgensen/forked-daapd/compare/ejurgensen:master...freebsd (link edited)

TomHarrop commented 9 years ago

Thanks for posting your FreeBSD instructions. I'm still stuck on FreeNAS 9.3. I'm running

CC=cc CFLAG="-march=native -g -Ofast -pipe -I/usr/local/include -I/usr/include" LDFLAGS="-L/usr/local/lib/ -L/usr/lib" LIBUNISTRING_CFLAGS=-I/usr/local/include LIBUNISTRING_LIBS=-L/usr/local/lib ZLIB_CFLAGS=-I/usr/include ZLIB_LIBS=-L/usr/lib ./configure --with-oss4=/usr/local/lib/oss/include/sys

and getting

checking for iconv... no, consider installing GNU libiconv
checking for libunistring... no, consider installing GNU libunistring
configure: error: GNU libunistring is required

even though I have libunistring & libiconv in /usr/local/lib:

# ls -lh /usr/local/lib/libunistring*
-rw-r--r--  1 root  wheel   2.1M Jan  9 16:36 /usr/local/lib/libunistring.a
lrwxr-xr-x  1 root  wheel    21B Jan  9 16:36 /usr/local/lib/libunistring.so -> libunistring.so.2.0.0
lrwxr-xr-x  1 root  wheel    21B Jan  9 16:36 /usr/local/lib/libunistring.so.2 -> libunistring.so.2.0.0
-rwxr-xr-x  1 root  wheel   1.3M Jan  9 16:36 /usr/local/lib/libunistring.so.2.0.0
# ls -lh /usr/local/lib/libiconv*
-rw-r--r--  1 root  wheel   1.1M Jan  9 15:22 /usr/local/lib/libiconv.a
lrwxr-xr-x  1 root  wheel    17B Jan  9 15:22 /usr/local/lib/libiconv.so -> libiconv.so.2.5.1
lrwxr-xr-x  1 root  wheel    17B Jan  9 15:22 /usr/local/lib/libiconv.so.2 -> libiconv.so.2.5.1
-rw-r--r--  1 root  wheel   1.0M Jan  9 15:22 /usr/local/lib/libiconv.so.2.5.1
lrwxr-xr-x  1 root  wheel    13B Jan  9 15:22 /usr/local/lib/libiconv.so.3 -> libiconv.so.2
ejurgensen commented 9 years ago

And you have the header files in /usr/local/include?

TomHarrop commented 9 years ago

I think so:

# ls -lh /usr/local/include/unistring/
total 68
-r--r--r--  1 root  wheel   1.7k Jan 26 00:06 cdefs.h
-r--r--r--  1 root  wheel   1.2k Jan 26 00:06 iconveh.h
-r--r--r--  1 root  wheel   2.4k Jan 26 00:06 inline.h
-r--r--r--  1 root  wheel   1.4k Jan 26 00:06 localcharset.h
-r--r--r--  1 root  wheel   4.3k Jan 26 00:06 stdbool.h
-r--r--r--  1 root  wheel   4.7k Jan 26 00:06 stdint.h
-r--r--r--  1 root  wheel   1.2k Jan 26 00:06 version.h
-r--r--r--  1 root  wheel   1.1k Jan 26 00:06 woe32dll.h
# ls -lh /usr/local/include/iconv*
-rw-r--r--  1 root  wheel   9.1k Jan  9 15:22 /usr/local/include/iconv.h

You may have noticed I'm not 100% sure what I'm doing here! I appreciate the help though.

TomHarrop commented 9 years ago

Sorry to double post. So I think I had a typo in that configure command that came from the FreeBSD instructions you posted (has CFLAG instead of CFLAGS).

Now, running

CC=cc CFLAGS="-march=native -g -pipe -I/usr/local/include -I/usr/include -I/root/avl-0.3.5 -L/root/avl-0.3.5" LDFLAGS="-L/usr/local/lib/ -L/usr/lib" LIBUNISTRING_CFLAGS=-I/usr/local/include LIBUNISTRING_LIBS=-L/usr/local/lib ZLIB_CFLAGS=-I/usr/include ZLIB_LIBS=-L/usr/lib ./configure --with-oss4=/usr/local/lib/oss/include/sys

I get

checking for iconv... yes
checking for working iconv... yes
checking how to link with libiconv... -liconv
checking for iconv declaration... 
         extern size_t iconv (iconv_t cd, const char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking for libunistring... yes
checking how to link with libunistring... -lunistring
./configure: 15301: Syntax error: word unexpected (expecting ")")
Psychoteur commented 9 years ago

Hello,

@Tom14-
How did you get the line CC=cc (..) to work ? I always CC=cc commande not found.

At least it's good exercice for my tomorrow classes: "how to compile"

freultwah commented 9 years ago

You use bash instead of csh.

ejurgensen commented 9 years ago

@Tom14- you can try disabling line 115 - 119 in configure.ac, and then add these instead: LIBUNISTRING=-lunistring AC_SUBST(LIBUNISTRING)

Then run autoreconf -i, the configure command and then gmake. Be sure to have cleaned up before doing this (make clean and git clean -f).

TomHarrop commented 9 years ago

Thanks, getting a bit further now

checking for timegm... yes
checking for euidaccess... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for off_t... yes
./configure: 13172: Syntax error: word unexpected (expecting ")")
ejurgensen commented 9 years ago

Looks to me like you are not further, but actually shorter now! The check for off_t is before the libunistring checks. I don't understand how that is possible. What are the lines around 13172 in configure about?

TomHarrop commented 9 years ago

Here's 13169–13175:

LIBUNISTRING=-lunistring

PKG_CHECK_MODULES(ZLIB,  zlib )
PKG_CHECK_MODULES(CONFUSE,  libconfuse )
PKG_CHECK_MODULES(AVAHI,  avahi-client >= 0.6.24 )
PKG_CHECK_MODULES(SQLITE3,  sqlite3 >= 3.5.0 )

13172 is PKG_CHECK_MODULES(ZLIB, zlib )

Hmmmmmm, I should have zlib in /usr/lib/ as I'm specifying in the config command but I don't know if it installed properly:

# find /usr/lib | grep zlib
/usr/lib/pkgconfig/zlib.pc
# ls /usr/include/zlib*
/usr/include/zlib.h
ejurgensen commented 9 years ago

What does /bin/sh point to on your platform?

TomHarrop commented 9 years ago

I think it's actually sh

# ls -lh /bin/sh
-r-xr-xr-x  1 root  wheel   143k Jul 11  2014 /bin/sh

I was running the config command from bash though.

I could try symlinking sh to bash, this is a FreeNAS 'jail' so it's not a disaster if I completely bork the system...

ejurgensen commented 9 years ago

Mine is the same, and actually it seems I don't even have bash installed in my FreeBSD vm. I don't understand why your configure script is acting up like that. You can try putting in -lunistring in quotes, so LIBUNISTRING="-lunistring". Mind you, I'm just guessing now...

TomHarrop commented 9 years ago

Alright, I appreciate your time & effort anyway. I'll post over on the FreeNAS forums and see if anyone there has successfully compiled it, and report if I get anywhere.

ejurgensen commented 9 years ago

Well seems that part of the issue may just be that pkgconfig was not installed. See #93.

TomHarrop commented 9 years ago

Great! ./configure is successful:

CC=cc CFLAGS="-march=native -g -pipe -I/usr/local/include -I/usr/include -I$WORKDIR/avl-0.3.5 -L$WORKDIR/avl-0.3.5 -I$WORKDIR/libantlr3c-3.4/include -I$WORKDIR/libantlr3c-3.4 -L$WORKDIR/libantlr3c-3.4/.libs" LDFLAGS="-L/usr/local/lib/ -L/usr/lib" LIBUNISTRING_CFLAGS=-I/usr/local/include LIBUNISTRING_LIBS=-L/usr/local/lib ZLIB_CFLAGS=-I/usr/include ZLIB_LIBS=-L/usr/lib ./configure --enable-flac --enable-musepack --enable-itunes --with-oss4=/usr/src/sys/sys --disable-dependency-tracking

But now I get an error on gmake (sorry!)

main.c:55: warning: 'gcry_thread_cbs' is deprecated (declared at /usr/local/include/gcrypt.h:214)
main.c: In function 'daemonize':
main.c:147: warning: implicit declaration of function 'fork'
main.c:155: warning: implicit declaration of function 'close'
main.c:160: warning: implicit declaration of function 'setsid'
main.c:172: warning: implicit declaration of function 'dup2'
main.c:172: error: 'STDIN_FILENO' undeclared (first use in this function)
main.c:172: error: (Each undeclared identifier is reported only once
main.c:172: error: for each function it appears in.)
main.c:173: error: 'STDOUT_FILENO' undeclared (first use in this function)
main.c:174: error: 'STDERR_FILENO' undeclared (first use in this function)
main.c:179: warning: implicit declaration of function 'chdir'
main.c:185: warning: implicit declaration of function 'getpid'
main.c:191: warning: implicit declaration of function 'geteuid'
main.c:195: warning: implicit declaration of function 'initgroups'
main.c:203: warning: implicit declaration of function 'setegid'
main.c:211: warning: implicit declaration of function 'seteuid'
main.c: In function 'register_services':
main.c:236: warning: implicit declaration of function 'time'
main.c: In function 'main':
main.c:619: warning: implicit declaration of function 'sigemptyset'
main.c:620: warning: implicit declaration of function 'sigaddset'
main.c:625: warning: implicit declaration of function 'pthread_sigmask'
main.c:645: warning: implicit declaration of function 'event_init'
main.c:645: warning: assignment makes pointer from integer without a cast
main.c:782: warning: implicit declaration of function 'event_set'
main.c:851: warning: implicit declaration of function 'unlink'
Makefile:699: recipe for target 'forked_daapd-main.o' failed
gmake[3]: *** [forked_daapd-main.o] Error 1
gmake[3]: Leaving directory '/usr/local/src/forked-daapd/forked-daapd/src'
Makefile:505: recipe for target 'all' failed
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory '/usr/local/src/forked-daapd/forked-daapd/src'
Makefile:532: recipe for target 'all-recursive' failed
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory '/usr/local/src/forked-daapd/forked-daapd'
Makefile:399: recipe for target 'all' failed
gmake: *** [all] Error 2
freultwah commented 9 years ago

Including the OSS headers from anywhere not under /usr/local messes up other includes. I have wasted too many hours trying to find a cure and was not successful. What worked was linking soundcard.h to where the script expects it to be by default.

mkdir -p /usr/local/lib/oss/include/sys/ ln -sf /usr/include/sys/soundcard.h /usr/local/lib/oss/include/sys/

Then, run configure with --with-oss4=/usr/local/lib/oss/include/sys/

Psychoteur commented 9 years ago

Hello, Configure works but gmake is unhappy.

Entering directory '/root/forked-daapd/src' cc -DHAVE_CONFIG_H -I. -I.. -D_GNU_SOURCE -DDATADIR="\"/usr/local/share/forked-daapd\"" -DCONFDIR="\"/usr/local/etc\"" -DSTATEDIR="\"/usr/local/var\"" -DPKGLIBDIR="\"/usr/local/lib/forked-daapd\"" -I/usr/local/lib/oss/include/sys/ -I/usr/include -D_REENTRANT -D_THREAD_SAFE -pthread -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -D_THREAD_SAFE -D_REENTRANT -I/usr/local/include -I/usr/local/include -march=native -g -pipe -I/usr/local/include -I/usr/include -I/root/avl-0.3.5 -L/root/avl-0.3.5 -Wall -D_LARGEFILE_SOURCE -c -o forked_daapd-httpd_daap.o test -f 'httpd_daap.c' || echo './'httpd_daap.c httpddaap.c:110: error: expected '=', ',', ';', 'asm' or 'attribute' before '' token httpd_daap.c: In function 'daap_session_kill': httpd_daap.c:153: error: 'daap_sessions' undeclared (first use in this function) httpd_daap.c:153: error: (Each undeclared identifier is reported only once httpd_daap.c:153: error: for each function it appears in.) httpd_daap.c: In function 'daap_session_register': httpd_daap.c:173: error: 'avl_node_t' undeclared (first use in this function) httpd_daap.c:173: error: 'node' undeclared (first use in this function) httpd_daap.c:193: warning: implicit declaration of function 'avl_search' httpd_daap.c:193: error: 'daap_sessions' undeclared (first use in this function) httpd_daap.c: In function 'daap_session_find': httpd_daap.c:243: error: 'avl_node_t' undeclared (first use in this function) httpd_daap.c:243: error: 'node' undeclared (first use in this function) httpd_daap.c:261: error: 'daap_sessions' undeclared (first use in this function) httpd_daap.c: In function 'daap_init': httpd_daap.c:2890: error: 'daap_sessions' undeclared (first use in this function) httpd_daap.c:2890: warning: implicit declaration of function 'avl_alloc_tree' httpd_daap.c: In function 'daap_deinit': httpd_daap.c:2917: warning: implicit declaration of function 'avl_free_tree' httpd_daap.c:2917: error: 'daap_sessions' undeclared (first use in this function) Makefile:951: recipe for target 'forked_daapd-httpddaap.o' failed gmake[3]: ** [forked_daapd-httpd_daap.o] Error 1 gmake[3]: Leaving directory '/root/forked-daapd/src' Makefile:505: recipe for target 'all' failed gmake[2]: * [all] Error 2 gmake[2]: Leaving directory '/root/forked-daapd/src' Makefile:532: recipe for target 'all-recursive' failed gmake[1]: * [all-recursive] Error 1 gmake[1]: Leaving directory '/root/forked-daapd' Makefile:399: recipe for target 'all' failed gmake: *\ [all] Error 2

TomHarrop commented 9 years ago

Woohoo! Following the final tip from @freultwah above I have just succesfully compiled, installed and launched, so I think it should work now. Unfortunately I can't get to the FreeNAS interface until tomorrow morning to give it access to a storage directory, so right now it's just exiting with

[2015-01-28 18:54:22] [  LOG]       db: Could not open database: unable to open database file
[2015-01-28 18:54:22] [FATAL]     main: Database init failed

@Psychoteur, yesterday I scrapped my jail and started over, trying to compile as many of the dependencies as possible rather than using pkg install. I don't know why, but after that I finally got it to finish configuring. It could have just been that I was missing pkgconf as suggested. I kept a list of what I did, so if you like tomorrow I can post which packages I installed from pkg and which ones I compiled manually?

Psychoteur commented 9 years ago

Yep, you can do it. It was my intention to do a "recap" for others. I did a lot of "make install clean" searching what's needed inside freshports. The one time I did "pkg install" was for oss.

Thanks.

TomHarrop commented 9 years ago

@Psychoteur here are the packages I installed. I'm sure there are many unnecessary ones and I think I installed some of them more than once ;) But I wanted to stick to the defaults when configuring the ports.

From pkg install:

lang/ruby19
devel/libevent2
devel/gmake
textproc/libxml2
devel/automake
security/libgcrypt
x11/xtrans
x11/xcb-proto
devel/boehm-gc
textproc/libxslt
x11/libxcb
graphics/jbigkit
print/freetype2
devel/glib20
graphics/png
graphics/cairo
x11-fonts/libXfont
devel/gobject-introspection
graphics/gdk-pixbuf2
install graphics/gtk-update-icon-cache
x11-toolkits/gtk20
devel/libglade2
net/avahi-gtk
textproc/p5-XML-Parser
multimedia/ffmpeg
devel/p5-Locale-gettext
net/avahi-libdns
x11-toolkits/gtk20
net/avahi-libdns
archivers/zip
archivers/unzip
x11-toolkits/open-motif
audio/alsa-lib
java/openjdk
editors/nano
devel/libavl

From source:

/usr/ports/ports-mgmt/portupgrade
/usr/ports/audio/oss
/usr/ports/devel/libconfuse
/usr/ports/textproc/mxml
/usr/ports/audio/flac
/usr/ports/audio/taglib
/usr/ports/devel/libplist
/usr/ports/devel/dbus
/usr/ports/net/avahi
/usr/ports/devel/libunistring
/usr/ports/devel/libtool
/usr/ports/devel/autotools
/usr/ports/devel/gperf
/usr/ports/databases/sqlite3

Others:

http://zlib.net/zlib-1.2.8.tar.gz
http://www.debian.co.il/debian/pool/main/liba/libavl/libavl_0.3.5.orig.tar.gz
http://www.antlr3.org/download/antlr-3.4-complete.jar
http://www.antlr3.org/download/C/libantlr3c-3.4.tar.gz
Psychoteur commented 9 years ago

Hello,

I will try inside a new jail using a road map to be concise what needed or not. Which openjdk did you use? I used open-jdk6.

Thanks.

TomHarrop commented 9 years ago

I just used pkg install openjdk (like I said I wanted to use defaults as much as possible) which installs 7

$ java -version
openjdk version "1.7.0_71"
OpenJDK Runtime Environment (build 1.7.0_71-b14)
OpenJDK 64-Bit Server VM (build 24.71-b01, mixed mode)
Psychoteur commented 9 years ago

Hello, I'm stuck.

checking for TRE... no configure: error: Package requirements ( tre ) were not met:

Package tre was not found in the pkg-config search path. Perhaps you should add the directory containing `tre.pc' to the PKG_CONFIG_PATH environment variable Package 'tre', required by 'world', not found

I followed the list. Check every package needed. I missed one ?

ejurgensen commented 9 years ago

TRE? Not something forked-daapd depends on, are you building something else?

Psychoteur commented 9 years ago

No, nothing this is why I'm surprised I don't see the relation. I did a clean jail. Did a to-do-list of package needed. Do you think it can be oss related that's the only thing I didn't install ?

My steps: portsnap fetch extract pkg update pkg upgrade cd /usr/ports/editors/nano/ && make install clean cd /usr/ports/devel/libconfuse/ && make install clean cd /usr/ports/multimedia/ffmpeg/ && make install clean cd /usr/ports/textproc/mxml/ && make install clean cd /usr/ports/devel/libevent2/ && make install clean cd /usr/ports/devel/libavl/ && make install clean cd /usr/ports/devel/libunistring/ && make install clean cd /usr/ports/devel/autotools/ && make install clean cd /usr/ports/lang/gawk/ && make install clean cd /usr/ports/devel/gperf/ && make install clean cd /usr/ports/net/avahi/ && make install clean cd /usr/ports/security/libgcrypt/ && make install clean cd /usr/ports/archivers/lzlib/ && make install clean cd /usr/ports/devel/libantlr3c/ && make install clean cd /usr/ports/java/openjdk8-jre/ && make install clean

CC=cc CFLAGS="-march=native -g -pipe -I/usr/local/include -I/usr/include -I/root/avl-0.3.5 -L/root/avl-0.3.5" LDFLAGS="-L/usr/local/lib/ -L/usr/lib" LIBUNISTRING_CFLAGS=-I/usr/local/include LIBUNISTRING_LIBS=-L/usr/local/lib ZLIB_CFLAGS=-I/usr/include ZLIB_LIBS=-L/usr/lib ./configure --with-oss4= --disable-dependency-tracking

Psychoteur commented 9 years ago

Hello, so I tried again: new jail, using pkg install for all needed packages. I did use your script for instructions and I'm still stuck with:

"configure: error: antlr3 wrapper not found and pre-generated files not available"

I don't see why since antlr3 has been compiled and installed, openjdk8 is installed too. I tried to had the file by hand by not sure I did what I'm supposed to do with that file. If I did right it will be working. You deleted your previous link. I remembered using the instructions in that link I had no problem with the wrapper.

I don't know why it's so hard to install inside a jail with Gentoo it's so easy it works inside VirtualBox but I have to do a nfs mount.

Thanks. Best regards.

ejurgensen commented 9 years ago

Do you have the file /usr/local/bin/antlr3? If yes, what does it contain?

If you run "antlr3" on the command line without any prefix, what is the output?

Psychoteur commented 9 years ago

hi,

I've got the file inside the directory and contains:

!/bin/sh

export CLASSPATH CLASSPATH=\$CLASSPATH:/usr/local/share/java/antlr-3.4-complete.jar:/usr/local/share/java /usr/local/bin/java org.antlr.Tool \$* bash: /usr/local/bin/antlr3: Permission denied

and I'm root ! ok let me check my permissions.

Psychoteur commented 9 years ago

after chmod 755 error(7): cannot find or open file: $*

freultwah commented 9 years ago

Lose the backslashes in antlr3. As it is, you're escaping all the variables.

Psychoteur commented 9 years ago

That's ok. Backslash is inside your script. I didn't pay attention ! Silly me ! I will see if it works. I had to do these steps:

export CC=cc

export LIBUNISTRING_CFLAGS=-I/usr/include

export LIBUNISTRING_LIBS=-L/usr/lib

export ZLIB_CFLAGS=-I/usr/include

export ZLIB_LIBS=-L/usr/lib

It compiled and it seems to be installed. I have documented my steps. I had to change a package too. I will post how I did it.

Thanks.

ejurgensen commented 9 years ago

I've modified the script so it installs with permissions 755. I don't know what to do about the backslashes. I can't just remove them, they are necessary for the script to work in Linux and FreeBSD. Probably has something to do with the shell?

Psychoteur commented 9 years ago

Yeah the shell interprets '\' has an escape character as in "find . -name "something" -exec (..) \; " If you add " " what we'll be the result ?

By the way it works. I had to edit the init script too.

I have to go someone broke its nas (not me).

Thanks.

My init file before I go:

"

!/bin/sh

PROVIDE: forked-daapd

REQUIRE: avahi_daemon dbus

Add the following lines to /etc/rc.conf to enable `forked-daapd':

#

forked_daapd_enable="YES"

forked_daapd_flags=""

. /etc/rc.subr

name="forked_daapd" rcvar=set_rcvar

command="/usr/sbin/forked-daapd" command_args="-P /var/run/forked-daapd.pid" pidfile="/var/run/forked-daapd.pid" required_files="/etc/forked-daapd.conf"

read configuration and set defaults

load_rc_config "$name" : ${forked_daapd_enable="NO"}

run_rc_command "$1"

hacketiwack commented 1 year ago

Is this issue still valid? It seems antlr3 is not needed anymore to build OwnTone.

ejurgensen commented 1 year ago

You're right, I'll close this ancient one