Closed Bug 880213 Opened 12 years ago Closed 12 years ago

build on uClibc: error: '_SC_NPROCESSORS_ONLN' was not declared in this scope

Categories

(Core :: WebRTC, defect)

20 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: natanael.copa, Unassigned)

Details

(Whiteboard: [WebRTC][blocking-webrtc-])

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20130417 Firefox/20.0 (Nightly/Aurora) Build ID: 20130417094959 Steps to reproduce: tried to build Firefox on Alpine Linux, which uses uClibc instead of glibc. Actual results: ccache g++ -o event.o -c -I../../../../../../../dist/system_wrappers -include /home/ncopa/aports/main/xulrunner/src/mozilla-release/config/gcc_hidden.h -DMOZ_GLUE_IN_PROGRAM -DNO_NSPR_10_SUPPORT -DWEBRTC_SVNREVISION="\"Unavailable_issue687\"" -D_FILE_OFFSET_BITS=64 -DCHROMIUM_BUILD -DUSE_LIBJPEG_TURBO=1 -DUSE_NSS=1 -DENABLE_ONE_CLICK_SIGNIN -DGTK_DISABLE_SINGLE_INCLUDES=1 -D_ISOC99_SOURCE=1 -DENABLE_REMOTING=1 -DENABLE_WEBRTC=1 -DENABLE_CONFIGURATION_POLICY -DENABLE_INPUT_SPEECH -DENABLE_NOTIFICATIONS -DENABLE_GPU=1 -DUSE_OPENSSL=1 -DENABLE_EGLIMAGE=1 -DUSE_SKIA=1 -DENABLE_TASK_MANAGER=1 -DENABLE_WEB_INTENTS=1 -DENABLE_EXTENSIONS=1 -DENABLE_PLUGIN_INSTALLATION=1 -DENABLE_PROTECTOR_SERVICE=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_BACKGROUND=1 -DENABLE_AUTOMATION=1 -DENABLE_PRINTING=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DWEBRTC_LOGGING -DWEBRTC_MOZILLA_BUILD -DWEBRTC_LINUX -DWEBRTC_THREAD_RR -D__STDC_FORMAT_MACROS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -I. -I/home/ncopa/aports/main/xulrunner/src/mozilla-release/media/webrtc/trunk/webrtc/system_wrappers/source/../.. -I/home/ncopa/aports/main/xulrunner/src/mozilla-release/media/webrtc/trunk/webrtc/system_wrappers/source/../../.. -I/home/ncopa/aports/main/xulrunner/src/mozilla-release/media/webrtc/trunk/webrtc/system_wrappers/source/spreadsortlib -I/home/ncopa/aports/main/xulrunner/src/mozilla-release/media/webrtc/trunk/webrtc/system_wrappers/source/../interface -fPIC -Os -fomit-frame-pointer -pipe -Wall -Wpointer-arith -Woverloaded-virtual -Werror=return-type -Wtype-limits -Wempty-body -Wno-invalid-offsetof -Wcast-align -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -std=gnu++0x -pthread -pipe -DNDEBUG -DTRIMMED -g -Os -freorder-blocks -fomit-frame-pointer -m32 -mmmx -Os -fomit-frame-pointer -pipe -DMOZILLA_CLIENT -include ../../../../../../../mozilla-config.h -MD -MF .deps/event.o.pp /home/ncopa/aports/main/xulrunner/src/mozilla-release/media/webrtc/trunk/webrtc/system_wrappers/source/event.cc event_posix.cc /home/ncopa/aports/main/xulrunner/src/mozilla-release/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_info.cc: In static member function 'static WebRtc_UWord32 webrtc::CpuInfo::DetectNumberOfCores()': /home/ncopa/aports/main/xulrunner/src/mozilla-release/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_info.cc:40:33: error: '_SC_NPROCESSORS_ONLN' was not declared in this scope /home/ncopa/aports/main/xulrunner/src/mozilla-release/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_info.cc:40:53: error: 'sysconf' was not declared in this scope make[7]: *** [cpu_info.o] Error 1 make[7]: *** Waiting for unfinished jobs... Expected results: build success
Attached patch sysconf.patch (obsolete) — Splinter Review
The problem is a missing include. Fix is trivial.
Component: Untriaged → WebRTC
Product: Firefox → Core
QA Contact: jsmith
Are you looking for someone to review your patch here?
Whiteboard: [WebRTC][blocking-webrtc-]
this makes webrtc compile with Linux/uClibc. Note that last hunk fixes something that I cannot imagine will work on any platform. I don't really like the way works here though. It is something like: "if linux then... oh wait.. if linux but no android then.. oh wait if linux but not android and not gonk then... oh wait... if linux but not android and not gonk and not uclibc then...". (guess what will happen when somone tries to build firefox on musl libc...) What I think would be a better approach is to use autoconf to test for get_nprocs(3) and define HAVE_GET_NPROCS. something like: AC_MSG_CHECKING([for get_nprocs]) AC_COMPILE_IFELSE([#include <sys/sysinfo.h> int main() { get_nprocs(); return 0; }], AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_GET_NPROCS, 1, [Define this if get_nprocs is available]), AC_MSG_RESULT([no]))
Attachment #759098 - Attachment is obsolete: true
If someone wants to review it, feel free to do so. I still wanted to share what i found out for the next person bumping into this.
Comment on attachment 805883 [details] [diff] [review] patch for firefox-24.0 I'll note this is upstream code. If you really want this fixed, you should file an issue for uclibc support at webrtc.org (and provide a patch). note that it doesn't use configure; it's built with a chromium-like build setup, gyp, etc.
Attachment #805883 - Flags: review+
I'm a bit confused here. The first patch (now obsoleted?) fixes an include, which makes sense as uClibc is supposed to handle _SC_NPROCESSORS_ONLN for a few years/releases already. It's also a plain bug in the code, regardless of libc, that the unistd.h include is missing. The second patch seems to neglect fixing the bug and works around it by using a define dance?
This appears to be fixed in firefox-26.0.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: