diff --git a/src/native/build.xml b/src/native/build.xml
index bf2906d11ff85cd72ba89c863d1b2bc35756f8a9..494c3bdd3f5737d743ef2de4ff148d460f485d42 100644
--- a/src/native/build.xml
+++ b/src/native/build.xml
@@ -47,7 +47,10 @@
     </or>
   </condition>
   <condition property="arch" value="64">
-    <os arch="amd64" />
+    <or>
+      <os arch="amd64" />
+      <os arch="x86_64" />
+    </or>
   </condition>
 
   <!--
@@ -256,25 +259,28 @@
 
     <cc outtype="shared" name="gcc" outfile="${native_install_dir}/jnffmpeg" objdir="${obj}">
       <!-- common compiler flags -->
-      <compilerarg value="-std=c99" />
+      <compilerarg value="-D_JNI_IMPLEMENTATION_" />
       <compilerarg value="-D_XOPEN_SOURCE=600" />
-      <compilerarg value="-Wall" />
-      <compilerarg value="-O2" />
+      <compilerarg value="-fPIC" />
       <compilerarg value="-I${ffmpeg}" />
-      <compilerarg value="-D_JNI_IMPLEMENTATION_" />
+      <compilerarg value="-m${arch}" />
+      <compilerarg value="-O2" />
+      <compilerarg value="-std=c99" />
+      <compilerarg value="-Wall" />
 
-      <linkerarg value="-L${ffmpeg}/libavformat" />
       <linkerarg value="-L${ffmpeg}/libavcodec" />
-      <linkerarg value="-L${ffmpeg}/libavutil" />
       <linkerarg value="-L${ffmpeg}/libavfilter" />
+      <linkerarg value="-L${ffmpeg}/libavformat" />
+      <linkerarg value="-L${ffmpeg}/libavutil" />
       <linkerarg value="-L${ffmpeg}/libswscale" />
-      <linkerarg value="-L${x264}" />
       <!--
         Depending on the way that lame is built, libmp3lame.a may be in
         libmp3lame/ or libmp3lame/.libs/.
       -->
       <linkerarg value="-L${lame}/libmp3lame" />
       <linkerarg value="-L${lame}/libmp3lame/.libs" />
+      <linkerarg value="-L${x264}" />
+      <linkerarg value="-m${arch}" />
       <!--
         Static libraries MUST be at the end otherwise they will not be added to
         the shared library.
@@ -284,25 +290,17 @@
       <linkerarg value="-lavfilter" location="end" />
       <linkerarg value="-lavutil" location="end" />
       <linkerarg value="-lswscale" location="end" />
-      <linkerarg value="-lx264" location="end" />
       <linkerarg value="-lmp3lame" location="end" />
+      <linkerarg value="-lx264" location="end" />
 
       <!-- Linux specific flags -->
-      <compilerarg value="-m32" if="cross_32" unless="is.running.macos" />
-      <compilerarg value="-m64" if="cross_64" unless="is.running.macos" />
       <compilerarg value="-I${system.JAVA_HOME}/include" if="is.running.linux" />
       <compilerarg value="-I${system.JAVA_HOME}/include/linux" if="is.running.linux" />
 
-      <linkerarg value="-m32" if="cross_32" unless="is.running.macos" />
-      <linkerarg value="-m64" if="cross_64" unless="is.running.macos" />
       <linkerarg value="-Wl,-Bsymbolic" if="is.running.linux" />
 
       <!-- Mac OS X specific flags -->
-      <compilerarg value="-mmacosx-version-min=10.5" if="is.running.macos"/>
-      <compilerarg value="-arch" if="is.running.macos" />
-      <compilerarg value="x86_64" if="is.running.macos" />
-      <compilerarg value="-arch" if="is.running.macos" />
-      <compilerarg value="i386" if="is.running.macos" />
+      <compilerarg value="-mmacosx-version-min=10.4" if="is.running.macos"/>
       <compilerarg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" if="is.running.macos" />
 
       <!-- ffmpeg/x264 libraries cannot be built as universal binaries
@@ -317,10 +315,6 @@
       -->
       <linkerarg value="-o" location="end" if="is.running.macos" />
       <linkerarg value="libjnffmpeg.jnilib" location="end" if="is.running.macos" />
-      <linkerarg value="-arch" if="is.running.macos" />
-      <linkerarg value="i386" if="is.running.macos" />
-      <linkerarg value="-arch" if="is.running.macos" />
-      <linkerarg value="x86_64" if="is.running.macos" />
       <linkerarg value="-dynamiclib" if="is.running.macos" />
       <linkerarg value="-Wl,-read_only_relocs,suppress" if="is.running.macos" />
 
diff --git a/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c b/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c
index f4b6fde6109003dc74577a5102589e2c184ecc2f..fab8d6f396f9873475831184a4d29900f9183353 100644
--- a/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c
+++ b/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c
@@ -396,7 +396,7 @@ Java_org_jitsi_impl_neomedia_codec_FFmpeg_avcodeccontext_1set_1rc_1eq
         const char *js = (*env)->GetStringUTFChars(env, rc_eq, NULL);
 
         if (js) {
-            s = strdup(js);
+            s = av_strdup(js);
             (*env)->ReleaseStringUTFChars(env, rc_eq, js);
         } else
             s = NULL;