Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang issues #73

Closed
cptaffe opened this issue Feb 27, 2016 · 6 comments
Closed

Clang issues #73

cptaffe opened this issue Feb 27, 2016 · 6 comments

Comments

@cptaffe
Copy link

cptaffe commented Feb 27, 2016

Building servo errors with a mozjs build error pertaining to mode_t and pid_t definitions colliding.

I could track the issue down to out/confdefs.h which seems to be generated by mozjs/js/src/js-confdefs.h.in, which includes @ALLDEFINES@ which introduces those defines.

$ ./mach build --dev             
   Compiling script v0.0.1 (file:///home/cpt/src/servo/components/servo)
   Compiling mozjs_sys v0.0.0 (https://github.com/servo/mozjs#5ac99916)
   Compiling selectors v0.5.1
failed to run custom build command for `mozjs_sys v0.0.0 (https://github.com/servo/mozjs#5ac99916)`
Process didn't exit successfully: `/home/cpt/src/servo/target/debug/build/mozjs_sys-e411d274df144795/build-script-build` (exit code: 101)
--- stdout
cd /home/cpt/src/servo/target/debug/build/mozjs_sys-e411d274df144795/out && \
MOZ_TOOLS="" CC="clang" CPP="gcc -E" CXX="clang++" AR="ar" \
/home/cpt/src/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/configure --disable-jemalloc
loading cache ./config.cache
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking build system type... x86_64-unknown-linux-gnu
checking for mawk... mawk
checking for perl5... no
checking for perl... /usr/bin/perl
checking for gcc... clang
checking whether the C compiler (clang  ) works... yes
checking whether the C compiler (clang  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether clang accepts -g... yes
checking for c++... clang++
checking whether the C++ compiler (clang++  ) works... yes
checking whether the C++ compiler (clang++  ) is a cross-compiler... no
checking whether we are using GNU C++... yes
checking whether clang++ accepts -g... yes
checking for ranlib... ranlib
checking for as... /usr/bin/as
checking for ar... ar
checking for ld... ld
checking for strip... strip
checking for windres... no
checking how to run the C preprocessor... gcc -E
checking how to run the C++ preprocessor... clang++ -E
checking for sb-conf... no
checking for ve... no
checking for a BSD compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking for tar archiver... checking for gnutar... no
checking for gtar... no
checking for tar... tar
tar
checking for minimum required perl version >= 5.006... 5.020002
checking for full perl installation... yes
checking for python2.7... /home/cpt/src/servo/python/_virtualenv/bin/python2.7
Creating Python environment
checking Python environment is Mozilla virtualenv... yes
checking for doxygen... :
checking for autoconf... /usr/bin/autoconf
checking for xargs... /usr/bin/xargs
checking for gmake... no
checking for make... /usr/bin/make
checking for X... libraries , headers 
checking for dnet_ntoa in -ldnet... no
checking for dnet_ntoa in -ldnet_stub... no
checking for gethostbyname... no
checking for connect... no
checking for remove... no
checking for shmat... no
checking for IceConnectionNumber in -lICE... yes
checking that static assertion macros used in autoconf tests work... yes
checking for --noexecstack option to as... yes
checking for -z noexecstack option to ld... yes
checking for -z text option to ld... yes
checking for --build-id option to ld... yes
checking whether the C++ compiler supports -Wno-extended-offsetof... yes
checking whether ld has archive extraction flags... yes
checking for 64-bit OS... yes
checking whether the C++ compiler (clang++  -fno-rtti  -Wl,-z,noexecstack -Wl,-z,text -Wl,--build-id) actually is a C++ compiler... yes
checking for ANSI C header files... no
checking for working const... yes
checking for mode_t... no
checking for off_t... no
checking for pid_t... no
checking for size_t... no
checking for ssize_t... no
checking for endian.h... yes
checking for machine/endian.h... no
checking for sys/isa_defs.h... no
checking for gcc c++0x headers bug without rtti... yes
checking whether workaround for gcc c++0x headers conflict with clang works... no
checking for gcc PR49911... no
checking for llvm pr8927... no
checking for dirent.h that defines DIR... no
checking for sys/ndir.h that defines DIR... no
checking for sys/dir.h that defines DIR... no
checking for ndir.h that defines DIR... no
checking for opendir in -lx... no
checking for sys/byteorder.h... no
checking for compat.h... no
checking for getopt.h... yes
checking for sys/bitypes.h... no
checking for memory.h... yes
checking for unistd.h... no
checking for gnu/libc-version.h... yes
checking for nl_types.h... yes
checking for malloc.h... no
checking for X11/XKBlib.h... no
checking for io.h... no
checking for cpuid.h... yes
checking for sys/statvfs.h... yes
checking for sys/statfs.h... yes
checking for sys/vfs.h... yes
checking for sys/mount.h... yes
checking for sys/quota.h... no
checking for linux/quota.h... yes
checking for sys/cdefs.h... yes
checking for linux/perf_event.h... yes
checking for perf_event_open system call... yes
checking for gethostbyname_r in -lc_r... no
checking for library containing dlopen... -ldl
checking for dlfcn.h... yes
checking for socket in -lsocket... no
checking for pthread_create in -lpthreads... no
checking for pthread_create in -lpthread... yes
checking whether clang accepts -pthread... yes
checking whether clang needs -traditional... no
checking for 8-bit clean memcmp... yes
checking for getc_unlocked... yes
checking for _getc_nolock... no
checking for gmtime_r... yes
checking for localtime_r... yes
checking for sin in -lm... yes
checking for log2... yes
checking for log1p... yes
checking for expm1... yes
checking for sqrt1pm1... no
checking for acosh... yes
checking for asinh... yes
checking for atanh... yes
checking for trunc... yes
checking for cbrt... yes
checking for wcrtomb... yes
checking for mbrtowc... yes
checking for res_ninit()... no
checking for nl_langinfo and CODESET... yes
checking for an implementation of va_copy()... no
checking whether va_list can be copied by value... no
checking whether the C++ "using" keyword resolves ambiguity... yes
checking for C++ dynamic_cast to void*... yes
checking for __thread keyword for TLS variables... yes
checking for __attribute__((always_inline))... yes
checking for __attribute__((malloc))... yes
checking for __attribute__((warn_unused_result))... yes
checking for LC_MESSAGES... yes
checking for localeconv... yes
checking NSPR selection... posix-wrapper
checking for gzread in -lz... yes
------ config.log ------
./confdefs.h:13:16: note: expanded from macro 'mode_t'
#define mode_t int
               ^
In file included from configure:12472:
In file included from /usr/include/zlib.h:34:
In file included from /usr/include/x86_64-linux-gnu/zconf.h:421:
/usr/include/x86_64-linux-gnu/sys/types.h:98:17: error: cannot combine with previous 'type-name' declaration specifier
typedef __pid_t pid_t;
                ^
./confdefs.h:15:15: note: expanded from macro 'pid_t'
#define pid_t int
              ^
3 errors generated.
configure: failed program was:
#line 12469 "configure"
#include "confdefs.h"
 #include <stdio.h>
                             #include <string.h>
                             #include <zlib.h> 
int main() {
 #if ZLIB_VERNUM < 0x1230
                             #error "Insufficient zlib version (0x1230 required)."
                             #endif 
; return 0; }
configure: error: Insufficient zlib version for --with-system-zlib (1.2.3 required)
makefile.cargo:82: recipe for target 'all' failed

--- stderr
makefile.cargo:58: extraneous text after 'else' directive
/home/cpt/src/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/configure: 1: /home/cpt/src/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/configure: /home/cpt/src/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/../../python/mozbuild/mozbuild/milestone.py: not found
/home/cpt/src/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/configure: 1: /home/cpt/src/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/configure: /home/cpt/src/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/../../python/mozbuild/mozbuild/milestone.py: not found
/home/cpt/src/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/configure: 1: /home/cpt/src/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/configure: /home/cpt/src/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/../../python/mozbuild/mozbuild/milestone.py: not found
configure: error: Insufficient zlib version for --with-system-zlib (1.2.3 required)
make: *** [all] Error 1
thread '<main>' panicked at 'assertion failed: result.success()', /home/cpt/src/servo/.cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/build.rs:17
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Build completed in 7.17s
@cptaffe
Copy link
Author

cptaffe commented Feb 27, 2016

off_t has the same issue later after you workaround this one. Replacing the lines in the configure file listed in the error that deal with zlib with:

#line 12469 "configure"
int main() {}

also remove the confdefs.h include here:

#line 12857 "configure"
#include <stdio.h>
int main() {
printf("Hello World\n");
; return 0; }

and in mozjs/intl/icu/source/configure (after the same prefix as the other config) we can add:

ac_preproc_ok=true

on line 3762 to override the gcc -E test.

@cptaffe cptaffe changed the title Ubuntu GNOME 15.04 build issues Clang build support Feb 27, 2016
@cptaffe
Copy link
Author

cptaffe commented Feb 27, 2016

Ran into further issues, this time with compiling source code, I'm instinctively blaming clang here. I think it's getting picked as my default compiler.

Yep, CC=gcc CXX=g++ before the build command fixed it.

@cptaffe cptaffe changed the title Clang build support Odd compiler selection Feb 27, 2016
@cptaffe
Copy link
Author

cptaffe commented Feb 27, 2016

Actually, CC=clang CXX=clang++ seems to work well too. I think it was getting a weird mix of gcc and clang which was messing it up pretty hard.

@cptaffe cptaffe closed this as completed Feb 27, 2016
@cptaffe
Copy link
Author

cptaffe commented Feb 27, 2016

Actually, further in the build, there seems to be some issues compiling with clang. I've attached the --- stderr portion of the (very long) output as a file.

On the other hand, I'm using a trunk version of clang.

$ clang --version
Ubuntu clang version 3.8.0-svn257294-1~exp1 (trunk) (based on LLVM 3.8.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /home/cpt/bin

out.txt

@cptaffe cptaffe changed the title Odd compiler selection Clang issues Feb 27, 2016
@cptaffe cptaffe reopened this Feb 27, 2016
@dholbert
Copy link

dholbert commented Nov 29, 2016

I think you can work around this locally without switching to gcc/g++. Just set the following environmental variable before you start building:
export CPP="clang -E"

(This is based on a comment on another issue which might be a dupe of this issue, and it got me past this build error.)

@nox
Copy link
Contributor

nox commented Oct 8, 2019

We can't do much about mixing GCC and Clang IMO, closing.

@nox nox closed this as completed Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants