meetecho / janus-gateway

Janus WebRTC Server
https://janus.conf.meetecho.com
GNU General Public License v3.0
8.15k stars 2.47k forks source link

"make dist" issue: postprocessing/pp-cmdline.c not found while executing #1915

Closed justfra closed 4 years ago

justfra commented 4 years ago

Hello,

I've compiled janus-gateway from the tag 0.8.0 and while executing "make dist" to generate a package to be installed on a different machine I get the below error which I'm assuming is caused by the fact that postprocessing/pp-cmdline.c is missing.

I'm currently trying to build from master and facing a compilation issue, although I believe the same issue would occur since I don't see the file in the postprocessing folder of master either.

root@b5ad79995056:~/janus-gateway# make dist 
/usr/bin/make  dist-gzip am__post_remove_distdir='@:'
make[1]: Entering directory '/root/janus-gateway'
`which git` rev-parse HEAD | awk 'BEGIN {print "#include \"version.h\""} {print "const char *janus_build_git_sha = \"" $0"\";"} END {}' > version.c
echo "Tue Jan  7 14:31:18 UTC 2020" | awk 'BEGIN {} {print "const char *janus_build_git_time = \""$0"\";"} END {} ' >> version.c
echo "80" | awk 'BEGIN {} {print "int janus_version = "$0";"} END {} ' >> version.c
echo "0.8.0" | awk 'BEGIN {} {print "const char *janus_version_string = \""$0"\";"} END {} ' >> version.c
pkg-config --modversion nice | awk 'BEGIN {} {print "const char *libnice_version_string = \""$0"\";"} END {} ' >> version.c
make[1]: *** No rule to make target 'postprocessing/pp-cmdline.c', needed by 'distdir'.  Stop.
make[1]: Leaving directory '/root/janus-gateway'
Makefile:3300: recipe for target 'dist' failed
make: *** [dist] Error 2
root@b5ad79995056:~/janus-gateway# exit
lminiero commented 4 years ago

It's not there because it's generated by gengetopt during make. The rule to build it is in the Makefile, so not sure why it's complaining (I never use make dist myself).

justfra commented 4 years ago

Grazie per la risposta! Do you suggest to use any alternative command/method to package the application? I need to install/run it on a different device.

lminiero commented 4 years ago

You can download zipped versions of the code from Github directly, AFAIK.

justfra commented 4 years ago

Thanks. I'm not sure I follow. How the zip version would be different from checking out the same version/tag with git? Maybe I've not explained myself clearly. I'm not running "make dist" directly. I have compiled the code by following the Readme.

These are the commands I've executed (after installing/compiling the dependencies):

git clone https://github.com/meetecho/janus-gateway.git
cd janus-gateway
git checkout v0.8.0
sh autogen.sh
./configure --prefix=/opt/janus --disable-rabbitmq --disable-mqtt
make CFLAGS='-std=c99'
make install
make configs
make dist

So I'm not sure why it would work differently with the zipped versions from Github.

lminiero commented 4 years ago

I'm not running "make dist" directly. I have compiled the code by following the Readme.

But I do see make dist in your commands above, and we don't list make dist anywhere in the README. It's definitely not needed to build or use Janus at all. I mentioned GitHub zipfiles as, if you're calling make dist to get an archive you can copy somewhere else instead of using git, using those zips makes your life much easier instead.

justfra commented 4 years ago

What I meant was that I was running "make" before "make dist" and since you said that file was generated by "make" I thought you were assuming I ran "make dist" before running "make". Anyway, I'm cross compiling for armv7l using a docker container. To do what you suggest I would need to build it directly on the target machine. Am I missing something?

atoppi commented 4 years ago

@justfra try adding --enable-post-processing to ./configure options.

justfra commented 4 years ago

Thanks a lot @atoppi!! Worked like a charm! Just had to install libavutil-dev, libavcodec-dev, libavformat-dev as part of the dependencies.

lminiero commented 4 years ago

That shouldn't be needed though, pp-cmdline.c/.h are only added to the sources when post processing is enabled, and so make dist should ignore them otherwise.

RSATom commented 4 years ago

@justfra you can try snap version of Janus: https://snapcraft.io/janus-gateway I've used it on Raspberry PI.

justfra commented 4 years ago

I realized that "make dist" wasn't quite doing what I expected and now @lminiero suggestion to just use the zipped code from github makes sense. What I was trying to do is create a package with the compiled binary and dependencies which I could just extract/install in the machine(s) where I intend to run it. Coming from the Java world I had just assumed that "dist" would give me just that.. I didn't want to recreate the build environment in the target machine or have to install all the dependencies. What I ended up doing for now is (from inside my Dockerfile) export the following flags before running ./configure:

LDFLAGS="-Wl,--disable-new-dtags,-rpath,'\$\$ORIGIN/../lib' -Wl,-z,origin"

Then after following the build steps as per the README, in order to get all the shared libraries inside the lib folder before final packaging:

ldd /opt/janus/bin/janus | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp -v '{}' /opt/janus/lib/

After that it is just a matter of packaging /opt/janus

I've built the docker image using buildx and target linux/arm/v7.

Right now I'm getting a Setmentation Fault right after starting janus on a Raspberry Pi 4B running Raspbian based on Debian Buster and I'm debugging that.

@lminiero since as you said "make dist" should still ignore pp-cmdline.c/.h when post processing is not enabled, I'm not closing this issue but please do so if you think it's appropriate

justfra commented 4 years ago

@RSATom I'll try it shortly, thanks!

lminiero commented 4 years ago

What I was trying to do is create a package with the compiled binary and dependencies which I could just extract/install in the machine(s) where I intend to run it. Coming from the Java world I had just assumed that "dist" would give me just that..

But that's not how it works with C: we have a ton of dependencies on third party libraries (and they depend on others), and unless they're exactly the same on the target machine as the ones you used to build, nothing will work unless you compile everything statically (which we don't provide support in our Makefile, so you'd be on your own I guess).

@lminiero since as you said "make dist" should still ignore pp-cmdline.c/.h when post processing is not enabled, I'm not closing this issue but please do so if you think it's appropriate

Seems to be working just fine for us, so it's probably something broken in your specific cross-compilation setup. Closing as the other segfault issue you mentioned is unrelated.

lminiero commented 4 years ago

@justfra you can try snap version of Janus: https://snapcraft.io/janus-gateway I've used it on Raspberry PI.

Didn't know this existed. Wasn't made by us, so handle with care as we won't support it.

RSATom commented 4 years ago

@lminiero it's maintained by me. https://github.com/RSATom/janus-gateway-snap It uses unmodified sources from your repo, just adds some folders redirections to make it compatible with snap restrictions.

lminiero commented 4 years ago

@lminiero it's maintained by me. https://github.com/RSATom/janus-gateway-snap It uses unmodified sources from your repo, just adds some folders redirections to make it compatible with snap restrictions.

Thanks for the clarification! And thanks for the link, I'll add it to the resources in the docs :+1: