Skip to content

Rust doesn't build on Ubuntu 12.04 #14023

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

Closed
brson opened this issue May 8, 2014 · 11 comments
Closed

Rust doesn't build on Ubuntu 12.04 #14023

brson opened this issue May 8, 2014 · 11 comments

Comments

@brson
Copy link
Contributor

brson commented May 8, 2014

It doesn't have g++ > 4.7, which LLVM needs. This is apparently breaking http://rust-ci.org/.

@brson
Copy link
Contributor Author

brson commented May 8, 2014

Instructions for installing newer g++ on Ubuntu 12.04 http://charette.no-ip.com:81/programming/2011-12-24_GCCv47/

@brson
Copy link
Contributor Author

brson commented May 8, 2014

There may not be much we can do here besides pointing to the manual g++ install instructions, and asking Rust CI to either do that or upgrade Ubuntu.

@chris-morgan
Copy link
Member

Rust CI operates on Travis CI servers, which use Ubuntu 12.04. The actual problem there is more that the PPA (also by hansjorg) won’t build for precise. If it were built there, then Rust CI would cease to have problems in that department.

@steveklabnik
Copy link
Member

Can this be closed? This seems like a Rust-ci specific issue, and most people aren't even using the PPA anyway.

@aidanhs
Copy link
Member

aidanhs commented Dec 7, 2014

Instead of using gcc I decided to try clang:

/space/mine/rust/rust $ ./configure --prefix=$(pwd)/../dist --enable-clang && make
[...]
make: llvm
make[1]: Entering directory `/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm'
llvm[1]: Constructing LLVMBuild project information.
make[1]: Leaving directory `/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm'
make[1]: Entering directory `/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm'
make[2]: Entering directory `/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm/lib/Support'
llvm[2]: Compiling APFloat.cpp for Release+Asserts build
In file included from /space/mine/rust/rust/src/llvm/lib/Support/APFloat.cpp:15:
In file included from /space/mine/rust/rust/src/llvm/include/llvm/ADT/APFloat.h:20:
In file included from /space/mine/rust/rust/src/llvm/include/llvm/ADT/APInt.h:19:
In file included from /space/mine/rust/rust/src/llvm/include/llvm/ADT/ArrayRef.h:14:
/space/mine/rust/rust/src/llvm/include/llvm/ADT/STLExtras.h:21:10: fatal error: 'cstddef' file not found
#include <cstddef> // for std::size_t
         ^
1 error generated.
[...]
/space/mine/rust/rust $ locate cstddef
/usr/include/c++/4.6/cstddef
/space/mine/rust/rust $ clang --version
Ubuntu clang version 3.4-1ubuntu3~precise1 (tags/RELEASE_34/final) (based on LLVM 3.4)
Target: x86_64-pc-linux-gnu
Thread model: posix

http://stackoverflow.com/questions/20587228/clang-error-stddef-file-not-found looks similar, but is about 13.10 (and isn't about cstddef).

With verbose mode I can see this is the command:

if  clang++ -Qunused-arguments -I/space/mine/rust/rust/src/llvm/include -I/space/mine/rust/rust/src/llvm/lib/Support -I/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm/include -I/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm/lib/Support  -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3 -fomit-frame-pointer -stdlib=libc++ -std=c++11 -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -fPIC -ffunction-sections -fdata-sections -Wcast-qual    -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcovered-switch-default -Wno-uninitialized -Wno-missing-field-initializers -c -MMD -MP -MF "/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.d.tmp" -MT "/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.o" -MT "/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.d" /space/mine/rust/rust/src/llvm/lib/Support/APFloat.cpp -o /space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.o ; \
                then /bin/mv -f "/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.d.tmp" "/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.d"; else /bin/rm "/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.d.tmp"; exit 1; fi

Any thoughts?

Edit: or is there any significant environment variable of the form C_INCLUDE_* ?

@aidanhs
Copy link
Member

aidanhs commented Dec 13, 2014

Got time to look at this again now.

/space/mine/rust/rust $ clang++ -Qunused-arguments -I/space/mine/rust/rust/src/llvm/include -I/space/mine/rust/rust/src/llvm/lib/Support -I/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm/include -I/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm/lib/Support  -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3 -fomit-frame-pointer -stdlib=libc++ -std=c++11 -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -fPIC -ffunction-sections -fdata-sections -Wcast-qual    -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcovered-switch-default -Wno-uninitialized -Wno-missing-field-initializers -c -MMD -MP -MF "/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.d.tmp" -MT "/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.o" -MT "/space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.d" /space/mine/rust/rust/src/llvm/lib/Support/APFloat.cpp -o /space/mine/rust/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.o
In file included from /space/mine/rust/rust/src/llvm/lib/Support/APFloat.cpp:15:
In file included from /space/mine/rust/rust/src/llvm/include/llvm/ADT/APFloat.h:20:
In file included from /space/mine/rust/rust/src/llvm/include/llvm/ADT/APInt.h:19:
In file included from /space/mine/rust/rust/src/llvm/include/llvm/ADT/ArrayRef.h:14:
/space/mine/rust/rust/src/llvm/include/llvm/ADT/STLExtras.h:21:10: fatal error: 'cstddef' file not found
#include <cstddef> // for std::size_t
         ^
1 error generated.
/space/mine/rust/rust $ cat xx.cpp
#include <cstddef>
int main() {
        return 0;
}
/space/mine/rust/rust $ clang++ xx.cpp
/space/mine/rust/rust $ ./a.out && echo $?
0

So an arg rust gives to clang++ is hiding cstddef?

@aidanhs
Copy link
Member

aidanhs commented Dec 13, 2014

"It doesn't have g++ > 4.7, which LLVM needs."

Right, just actually read the issue. So this is a lost cause I guess :(

Edit: I'm just going to install ppa:ubuntu-toolchain-r, so problem solved from my point of view.

@nyx
Copy link

nyx commented Dec 20, 2014

FWIW I just ran into this issue on a new Ubuntu 14.04.1 LTS desktop installation. I configured HEAD (cc19e33) rust using --enable-clang, attempted to build, and upon failure iteratively installed llvm clang build-essential and g++ (version 4.8) when attempting to build I see the cstddef header file missing error as well even now.

@ghost
Copy link

ghost commented Jan 20, 2015

Hi. I'm having this issue as well, on Linux Manjaro (not ubuntu) with (newer than 4.7) gcc == 4.9.2
There are two results when searching for cstddef:

/usr/include/boost/compatibility/cpp_c_headers/cstddef
/usr/include/c++/4.9.2/cstddef

This is my gcc version 4.9.2:

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc-4.9-20141224/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --disable-multilib --disable-werror --enable-checking=release
Thread model: posix
gcc version 4.9.2 20141224 (prerelease) (GCC) 

Trying to compile latest rust from master with something like this:

$ ./configure --prefix=/usr --disable-rpath --disable-verify-install --disable-debug --enable-manage-submodules --enable-clang --enable-ccache --enable-dist-host-only 
$ make -j1 all
...
make[2]: Entering directory '/home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/lib/Support'
/home/emacs/build/rust-git/makepkg/rust-git/src/rust/src/llvm/autoconf/mkinstalldirs /home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts > /dev/null
/usr/bin/date > /home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/.dir
llvm[2]: Compiling APFloat.cpp for Release+Asserts build
if  ccache clang++ -Qunused-arguments -I/home/emacs/build/rust-git/makepkg/rust-git/src/rust/src/llvm/include -I/home/emacs/build/rust-git/makepkg/rust-git/src/rust/src/llvm/lib/Support -I/home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/include -I/home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/lib/Support  -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3 -fomit-frame-pointer -stdlib=libc++ -std=c++11 -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -fPIC -ffunction-sections -fdata-sections -Wcast-qual -march=native -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -Wno-trigraphs   -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2  -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcovered-switch-default -Wno-uninitialized -Wno-missing-field-initializers -c -MMD -MP -MF "/home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.d.tmp" -MT "/home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.o" -MT "/home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.d" /home/emacs/build/rust-git/makepkg/rust-git/src/rust/src/llvm/lib/Support/APFloat.cpp -o /home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.o ; \
        then /usr/bin/mv -f "/home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.d.tmp" "/home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.d"; else /usr/bin/rm "/home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.d.tmp"; exit 1; fi
In file included from /home/emacs/build/rust-git/makepkg/rust-git/src/rust/src/llvm/lib/Support/APFloat.cpp:15:
In file included from /home/emacs/build/rust-git/makepkg/rust-git/src/rust/src/llvm/include/llvm/ADT/APFloat.h:20:
In file included from /home/emacs/build/rust-git/makepkg/rust-git/src/rust/src/llvm/include/llvm/ADT/APInt.h:19:
In file included from /home/emacs/build/rust-git/makepkg/rust-git/src/rust/src/llvm/include/llvm/ADT/ArrayRef.h:14:
/home/emacs/build/rust-git/makepkg/rust-git/src/rust/src/llvm/include/llvm/ADT/STLExtras.h:21:10: fatal error: 
      'cstddef' file not found
#include <cstddef> // for std::size_t
         ^
1 error generated.
/usr/bin/rm: cannot remove ‘/home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.d.tmp’: No such file or directory
/home/emacs/build/rust-git/makepkg/rust-git/src/rust/src/llvm/Makefile.rules:1514: recipe for target '/home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.o' failed
make[2]: *** [/home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/lib/Support/Release+Asserts/APFloat.o] Error 1
make[2]: Leaving directory '/home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/lib/Support'
/home/emacs/build/rust-git/makepkg/rust-git/src/rust/src/llvm/Makefile.rules:873: recipe for target 'all' failed
make[1]: *** [all] Error 1
make[1]: Leaving directory '/home/emacs/build/rust-git/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm'
/tmp/makepkg/rust-git/src/rust/mk/llvm.mk:60: recipe for target '/tmp/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/Release+Asserts/bin/llvm-config' failed
make: *** [/tmp/makepkg/rust-git/src/rust/x86_64-unknown-linux-gnu/llvm/Release+Asserts/bin/llvm-config] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

real    1m7.847s
user    0m42.023s
sys 0m10.023s

I'll let you know if I fix it.

@ghost
Copy link

ghost commented Jan 20, 2015

tl;dr: fixed by passing --disable-libcpp to rust's ./configure

--------longer read:
found the culprit, turns out that by having -stdlib=libc++ parameter passed to clang++ it will fail as mentioned above with the cstddef error and simply removing it works. But to properly remove it I have to either not specify --enable-libcpp (by default it's NO) or specify --disable-libcpp to the ./configure script of llvm (not of rust). This translates to having to pass --disable-libcpp to the rust ./configure.

(tested to work as specified)

I also found this text, afterwards, to be related (from file: GettingStarted.rst):

When you build Clang, you will need to give *it* access to modern C++11
standard library in order to use it as your new host in part of a bootstrap.
There are two easy ways to do this, either build (and install) libc++ along
with Clang and then use it with the ``-stdlib=libc++`` compile and link flag,
or install Clang into the same prefix (``$HOME/toolchains`` above) as GCC.
Clang will look within its own prefix for libstdc++ and use it if found. You
can also add an explicit prefix for Clang to look in for a GCC toolchain with
the ``--gcc-toolchain=/opt/my/gcc/prefix`` flag, passing it to both compile and
link commands when using your just-built-Clang to bootstrap.

@steveklabnik
Copy link
Member

It seems like this is taken care of now, or at least, as much as it's going to be.

bors added a commit to rust-lang-ci/rust that referenced this issue Feb 13, 2023
fix: config substitution failing extension activation

Closes rust-lang/rust-analyzer#14022

Not sure how a function can appear there, but there is also no reason for us to care about it anyways.
bors pushed a commit to rust-lang-ci/rust that referenced this issue Jan 28, 2025
…lt` (rust-lang#14024)

Receivers which are references to `Option` and `Result`, or who
implement `Deref` to one of those types, will be linted as well.

changelog: [`unnecessary_map_or`]: work with ref and `Deref` to `Option`
and `Result` as well

Fixes rust-lang#14023

**Note:** this patch must be merged after rust-lang#13998 – only the second
commit must be reviewed, the first one repeats the patch in rust-lang#13998 for
mergeability reasons.
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

5 participants