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

Link directly to local libraries #3154

Closed
wants to merge 1 commit into from
Closed

Conversation

singron
Copy link
Contributor

@singron singron commented Oct 17, 2019

Otherwise previous -L flags could cause the linker to use globally
installed versions of libraries instead of the ones that were just
compiled.

Fix #3087

@singron
Copy link
Contributor Author

singron commented Oct 17, 2019

I tested this on an Arch Linux system that was exhibiting the bug. I don't have an OSX system to test on.

@jomority
Copy link

Works for me on Arch Linux aswell.

@NorfairKing
Copy link

Same here, thanks @singron

@jamesray1
Copy link

jamesray1 commented Oct 22, 2019

I am unable to get Nix to permanently work beyond the length of one terminal session, as detailed in holochain/holochain-rust#1789. That includes installing nix from the AUR, which fails to complete installation. @singron, I tried to build your fork from source and install it from your fix-link branch, but am unable to get past running ./configure

bash: ./configure: No such file or directory
[jr@lm nix]$ ls
bootstrap.sh  contrib   doc       maintainers         misc         perl                release.nix  src
config        COPYING   local.mk  Makefile            mk           README.md           scripts      tests
configure.ac  corepkgs  m4        Makefile.config.in  nix.spec.in  release-common.nix  shell.nix

@singron
Copy link
Contributor Author

singron commented Oct 22, 2019

@jamesray1 you probably have to run ./bootstrap.sh to generate ./configure. See https://github.com/NixOS/nix/blob/master/doc/manual/installation/building-source.xml

@jamesray1
Copy link

jamesray1 commented Oct 23, 2019

@singron thanks, I should probably make a separate issue, but that got an error:

[jr@lm nix]$ ./bootstrap.sh
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force 
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force
configure.ac:118: error: possibly undefined macro: AC_MSG_ERROR
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

I went on any way to run the other commands but those failed:

[jr@lm nix]$ ./configure
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for the canonical Nix system name... x86_64-linux
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking whether g++ supports C++17 features with -std=c++17... yes
checking for ar... ar
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking for struct dirent.d_type... yes
checking for pubsetbuf... yes
checking for statvfs... yes
checking for pipe2... yes
checking for lutimes... yes
checking whether it is possible to create a link to a symlink... yes
checking how to run the C++ preprocessor... g++ -std=c++17 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking locale usability... yes
checking locale presence... yes
checking for locale... yes
checking for bash... /usr/bin/bash
checking for patch... /usr/bin/patch
checking for xmllint... /usr/bin/xmllint
checking for xsltproc... /usr/bin/xsltproc
checking for flex... /usr/bin/flex
checking for bison... /usr/bin/bison
checking for sed... /usr/bin/sed
checking for tar... /usr/bin/tar
checking for bzip2... /usr/bin/bzip2
checking for gzip... /usr/bin/gzip
checking for xz... /usr/bin/xz
checking for dot... no
checking for lsof... /usr/bin/lsof
checking for cat... /usr/bin/cat
checking for tr... /usr/bin/tr
./configure: line 6385: syntax error near unexpected token `1.66,'
./configure: line 6385: `AX_BOOST_BASE(1.66, CXXFLAGS="$BOOST_CPPFLAGS $CXXFLAGS", AC_MSG_ERROR([Nix requires boost.]))'
[jr@lm nix]$ make
  GEN    Makefile.config
/bin/sh: ./config.status: No such file or directory
  CXX    src/build-remote/build-remote.o
cc1plus: fatal error: config.h: No such file or directory
compilation terminated.
make: *** [mk/patterns.mk:3: src/build-remote/build-remote.o] Error 1
[jr@lm nix]$ make install
  GEN    Makefile.config
/bin/sh: ./config.status: No such file or directory
make: *** No rule to make target 'config.h', needed by '/nix/config.h'.  Stop.
[jr@lm nix]$ zsh
➜  nix git:(fix-link) ls
aclocal.m4      config      configure.ac  corepkgs  m4           Makefile.config.in  nix.spec.in  release-common.nix  shell.nix
autom4te.cache  config.log  contrib       doc       maintainers  misc                perl         release.nix         src
bootstrap.sh    configure   COPYING       local.mk  Makefile     mk                  README.md    scripts             tests

@singron
Copy link
Contributor Author

singron commented Oct 23, 2019

@jamesray1 I think you have to install autoconf-archive.

@jamesray1
Copy link

jamesray1 commented Oct 23, 2019

Haha, was already onto it! From this comment, after installing autoconf-archive, and checking that other packages were all installed, I was able to run the first two commands. autoreconf --install didn't help.

➜  nix git:(fix-link) ./bootstrap.sh
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force 
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: configure.ac: not using Automake
autoreconf: Leaving directory `.'
➜  nix git:(fix-link) ./configure
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for the canonical Nix system name... x86_64-linux
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking whether g++ supports C++17 features with -std=c++17... yes
checking for ar... ar
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking for struct dirent.d_type... yes
checking for pubsetbuf... yes
checking for statvfs... yes
checking for pipe2... yes
checking for lutimes... yes
checking whether it is possible to create a link to a symlink... yes
checking how to run the C++ preprocessor... g++ -std=c++17 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking locale usability... yes
checking locale presence... yes
checking for locale... yes
checking for bash... /usr/bin/bash
checking for patch... /usr/bin/patch
checking for xmllint... /usr/bin/xmllint
checking for xsltproc... /usr/bin/xsltproc
checking for flex... /usr/bin/flex
checking for bison... /usr/bin/bison
checking for sed... /usr/bin/sed
checking for tar... /usr/bin/tar
checking for bzip2... /usr/bin/bzip2
checking for gzip... /usr/bin/gzip
checking for xz... /usr/bin/xz
checking for dot... no
checking for lsof... /usr/bin/lsof
checking for cat... /usr/bin/cat
checking for tr... /usr/bin/tr
checking for boostlib >= 1.66 (106600)... yes
checking whether -latomic is needed... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for OPENSSL... yes
checking for BZ2_bzWriteOpen in -lbz2... yes
checking bzlib.h usability... yes
checking bzlib.h presence... yes
checking for bzlib.h... yes
checking for SQLITE3... yes
checking for LIBCURL... yes
checking for EDITLINE... yes
checking for SODIUM... yes
checking for LIBLZMA... yes
checking for lzma_stream_encoder_mt in -llzma... yes
checking for LIBBROTLI... yes
checking for LIBSECCOMP... yes
checking aws/s3/S3Client.h usability... no
checking aws/s3/S3Client.h presence... no
checking for aws/s3/S3Client.h... no
checking for setresuid... yes
checking for setreuid... yes
checking for lchown... yes
checking for strsignal... yes
checking for posix_fallocate... yes
checking for sysconf... yes
checking if you have a recent GNU tar... yes
configure: creating ./config.status
config.status: creating config.h
➜  nix git:(fix-link) make
  GEN    Makefile.config
  GEN    doc/manual/version.txt
  GEN    doc/manual/manual.xmli
  GEN    doc/manual/manual.is-valid
I/O error : Attempt to load network entity http://docbook.org/xml/5.0/rng/docbook.rng
warning: failed to load external entity "http://docbook.org/xml/5.0/rng/docbook.rng"
Relax-NG parser error : xmlRelaxNGParse: could not load http://docbook.org/xml/5.0/rng/docbook.rng
Relax-NG schema http://docbook.org/xml/5.0/rng/docbook.rng failed to compile
make: *** [doc/manual/local.mk:32: doc/manual/manual.is-valid] Error 5
➜  nix git:(fix-link) make install
  MKDIR  /usr/local/include/nix/
install: cannot change permissions of ‘/usr/local/include/nix/’: No such file or directory
make: *** [local.mk:11: /usr/local/include/nix/] Error 1

There is a similar issue for the make error e.g. in #506.

@singron
Copy link
Contributor Author

singron commented Oct 23, 2019

@jamesray1 You can pass --disable-doc-gen to ./configure to workaround the doc errors.

@nixos-discourse
Copy link

@jamesray1
Copy link

jamesray1 commented Oct 23, 2019

Thanks @singron, this works for me!

Otherwise previous -L flags could cause the linker to use globally
installed versions of libraries instead of the ones that were just
compiled.

Fix NixOS#3087
@singron
Copy link
Contributor Author

singron commented Nov 8, 2019

I rebased on a more recent master.

@jamesray1
Copy link

@matthewbauer do you have any updates related to this?

@jamesray1
Copy link

I've been able to use the latest nix so don't need this PR any more.

@edolstra
Copy link
Member

Thanks, I'll close it then.

@edolstra edolstra closed this Dec 12, 2019
@singron
Copy link
Contributor Author

singron commented Dec 12, 2019

@edolstra Can you please reopen? It probably only works for @jamesray1 because the AUR applies this unmerged PR as a patch https://aur.archlinux.org/cgit/aur.git/tree/ldflags.patch?h=nix

@jamesray1
Copy link

jamesray1 commented Dec 13, 2019

@singron I didn't install from the AUR. I used curl https://nixos.org/nix/install | sh (or an alias cn for that).

@singron
Copy link
Contributor Author

singron commented Dec 13, 2019

https://nixos.org/nix/install downloads a prebuilt binary. If you compile nix from source, you will run into this problem and need a fix like the one in this PR.

@dschrempf
Copy link
Contributor

I am also running into this problem; trying to compile version 2.3.3; I am also on Arch Linux. I tried installing autoconf-archive, but that didn't help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants