How to properly compile jitsi-lgpl-dependencies?

Dear Developers,
I’m a little confused with the jitsi-lgpl-dependencies project when I tried to compile it. There are both build.xml and pom.xml, while README-native tells something about compile lame、openh264、ffmpeg and finally jnffmpeg. I wonder what is the right sequence to do all these ant/mvn/make operations. Is pom.xml equal to build.xml? Hope someone could offer a clear list.

The environment is Win10 x64.

Backgroud:
I’m building the lgpl-dependencies project to use libjitsi. I’ve been trying to build and use the libjitsi project tag<v1.0 1096>. Download and mvn install each of its dependencies on github/jitsi. Also removed the exclude lines about lgpl-dependencies in the libjitisi pom(I suppose it should be done to make things work?). However when running the example AVReceive2 it failed on matching the camera encoding fomat, which is H264.

I did some digging and found the problem is in MediaUtils.java. The code below:

if (enableFfmpeg)
{
try
{
h264Enabled
= FFmpeg.avcodec_find_encoder(FFmpeg.CODEC_ID_H264) != 0;
}
catch (Throwable t)
{
logger.debug(“H264 codec not found”, t);
}
}

As the method avcodec_find_encoder(FFmpeg.CODEC_ID_H264) failed to return any encoder the example failed. I guess the reason is that when I mvn install the jitsi-lgpl-dependencies, the openh264 not inclueded.

The ant tasks about compilation relay on parameters for already compiled lame, openh264 and ffmpeg.
So you follow readme first and then do those from the ant.

Hi, it’s me again. Right now I’m stuck in the ‘ant ffmpeg’ step of the README-native doc of the lgpl-dependencies project. I’m working with lgpl-dependecies(93b885d commit)/lame-3.100/openh264-1.7.0/ffmpeg-3.4.8.
I walked into two problems:

  1. enum.AVFILTER_AUTO_CONVERT_NONE in lgpl-dependencies/src/main/c/ffmpeg/FFmpeg.c already defined in ffmpeg project and the #ifndef macro didn’t work, so I deleted it in FFmpeg.c
  2. The major problem when gcc start linking, it seems to omit the lame.h in my lame-3.100/include, I’ve created the include/lame link according to the instruction in windows part of lame building step. The error goes like this:

[cc] gcc -LE:/projects/jitsi/ffmpeg-3.4.8/libavcodec -LE:/projects/jitsi/ffmpeg-3.4.8/libavfilter -LE:/projects/jitsi/ffmpeg-3.4.8/libavformat -LE:/projects/jitsi/ffmpeg-3.4.8/libavutil -LE:/projects/jitsi/ffmpeg-3.4.8/libswscale -LE:/projects/jitsi/openh264/ -m64 -Wl,-ojnffmpeg.dll -Wl,–kill-at -static-libgcc -shared -o libjnffmpeg.so …\target\native_obj\FFmpeg.o -lavformat -lavcodec -lavfilter -lavutil -lswscale -lopenh264
Execute:Java13CommandLauncher: Executing ‘gcc’ with arguments:
‘-LE:/projects/jitsi/ffmpeg-3.4.8/libavcodec’
‘-LE:/projects/jitsi/ffmpeg-3.4.8/libavfilter’
‘-LE:/projects/jitsi/ffmpeg-3.4.8/libavformat’
‘-LE:/projects/jitsi/ffmpeg-3.4.8/libavutil’
‘-LE:/projects/jitsi/ffmpeg-3.4.8/libswscale’
‘-LE:/projects/jitsi/openh264/’
‘-m64’
‘-Wl,-ojnffmpeg.dll’
‘-Wl,–kill-at’
‘-static-libgcc’
‘-shared’
‘-o’
‘libjnffmpeg.so’
‘…\target\native_obj\FFmpeg.o’
‘-lavformat’
‘-lavcodec’
‘-lavfilter’
‘-lavutil’
‘-lswscale’
‘-lopenh264’

The ’ characters around the executable and arguments are
not part of the command.
[cc] C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/10.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: E:/projects/jitsi/ffmpeg-3.4.8/libavcodec/libavcodec.a(libmp3lame.o): in function mp3lame_encode_frame': [cc] E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:200: undefined reference to lame_encode_buffer’
[cc] C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/10.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:203: undefined reference to lame_encode_buffer_int' [cc] C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:216: undefined reference to lame_encode_buffer_float’
[cc] C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/10.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:224: undefined reference to lame_encode_flush' [cc] C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/projects/jitsi/ffmpeg-3.4.8/libavcodec/libavcodec.a(libmp3lame.o): in function mp3lame_encode_close’:
[cc] E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:87: undefined reference to lame_close' [cc] C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/projects/jitsi/ffmpeg-3.4.8/libavcodec/libavcodec.a(libmp3lame.o): in function mp3lame_encode_init’:
[cc] E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:99: undefined reference to lame_init' [cc] C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:103: undefined reference to lame_set_num_channels’
[cc] C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/10.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:104: undefined reference to lame_set_mode' [cc] C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:107: undefined reference to lame_set_in_samplerate’
[cc] C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/10.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:108: undefined reference to lame_set_out_samplerate' [cc] C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:112: undefined reference to lame_set_quality’
[cc] C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/10.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:116: undefined reference to lame_set_VBR' [cc] C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:117: undefined reference to lame_set_VBR_quality’
[cc] C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/10.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:121: undefined reference to lame_set_VBR' [cc] C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:122: undefined reference to lame_set_VBR_mean_bitrate_kbps’
[cc] C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/10.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:124: undefined reference to lame_set_brate' [cc] C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:130: undefined reference to lame_set_lowpassfreq’
[cc] C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/10.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:133: undefined reference to lame_set_bWriteVbrTag' [cc] C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:136: undefined reference to lame_set_disable_reservoir’
[cc] C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/10.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:139: undefined reference to lame_init_params' [cc] C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:145: undefined reference to lame_get_encoder_delay’
[cc] C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/10.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: E:\projects\jitsi\ffmpeg-3.4.8/libavcodec/libmp3lame.c:148: undefined reference to `lame_get_framesize’
[cc] collect2.exe: error: ld returned 1 exit status

BUILD FAILED
E:\projects\jitsi\jitsi-lgpl-dependencies\build.xml:170: gcc failed with return code 1
at net.sf.antcontrib.cpptasks.compiler.CommandLineLinker.link(CommandLineLinker.java:278)
at net.sf.antcontrib.cpptasks.compiler.CommandLineLinkerConfiguration.link(CommandLineLinkerConfiguration.java:117)
at net.sf.antcontrib.cpptasks.CCTask.execute(CCTask.java:803)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.Main.runBuild(Main.java:853)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)

Total time: 2 seconds

Hi,
I’m puzzled a bit about jitsi-lgpl-dependencies/build.xml
see the scripts below.
line 185,186:
linkerarg value="-L${lame}/libmp3lame" if=“is.running.macos”
linkerarg value="-L${lame}/libmp3lame/.libs" if=“is.running.macos”
line 200:
linkerarg value="-lmp3lame" location=“end” if=“is.running.macos”
So why make these lines exclusive for macos? It produces the linking problem in windows system(see the post above). As I commented all these ‘if’ conditions, the building succeeded.

So all those are if macos so they should not affect it on windows.

Sorry, if I didn’t make myself clear.
During my practise on my Win10 PC, the if macos condition affect these lines, and gcc won’t link libmp3lame on the linking stage. Eventually the ant build will fail since the “undefined reference to lame_XXXX” problems.