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

Compilation fails on FreeBSD #304

Closed
tomster opened this issue Jul 25, 2014 · 30 comments
Closed

Compilation fails on FreeBSD #304

tomster opened this issue Jul 25, 2014 · 30 comments

Comments

@tomster
Copy link

tomster commented Jul 25, 2014

I tried to compile nix 1.7 from tarball (as the installer script explicitly does not support FreeBSD, eventhough the nix homepage claims otherwise.

I installed the following packages in a FreeBSD 10 jail:

  • curl
  • perl5
  • openssl
  • bash
  • pkgconf
  • sqlite3
  • cpanm
  • gmake

and the following perl modules:

  • DBI
  • DBD::SQLite
  • WWW::Curl

This allowed ./configure to run through. yay!

however, running make yields the following::

root@nix:~/nix-1.7 # gmake
  LD     src/boost/format/libnixformat.so
/usr/bin/ld: unrecognized option '--no-copy-dt-needed-entries'
/usr/bin/ld: use the --help option for usage information
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [src/boost/format/libnixformat.so] Error 1
root@nix:~/nix-1.7 # 

After manually removing the offending option (is it required?) in mk/lib.mk:

root@nix:~/nix-1.7 # gmake
  LD     src/libstore/libnixstore.so
/usr/bin/ld: cannot find -lsqlite3
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [src/libstore/libnixstore.so] Error 1

eventhough the library has been installed:

root@nix:~/nix-1.7 # ls /usr/local/lib/libsqlite3.*
/usr/local/lib/libsqlite3.a     /usr/local/lib/libsqlite3.so.0
/usr/local/lib/libsqlite3.so        /usr/local/lib/libsqlite3.so.0.8.6

any idea what needs to be done?

what is the state of FreeBSD support?

@tomster
Copy link
Author

tomster commented Jul 25, 2014

two minutes after posting the above issue, i found it myself, doh!

need to set the LD flags for FreeBSD like so:

LDFLAGS="-L/usr/local/lib/" ./configure

@tomster
Copy link
Author

tomster commented Jul 25, 2014

however, now i get the following:

[root@nix ~/nix-1.7]# gmake
  LD     src/libstore/libnixstore.so
  LD     src/libmain/libnixmain.so
  LD     src/nix-hash/nix-hash
  CXX    src/nix-store/dotgraph.o
  CXX    src/nix-store/nix-store.o
  CXX    src/nix-store/xmlgraph.o
  LD     src/nix-store/nix-store
  CXX    src/nix-instantiate/nix-instantiate.o
In file included from src/nix-instantiate/nix-instantiate.cc:3:
In file included from src/libexpr/eval.hh:3:
In file included from src/libexpr/value.hh:3:
src/libexpr/symbol-table.hh:74:18: error: no member named 'tr1' in namespace 'std'
    typedef std::tr1::unordered_set<string> Symbols;
            ~~~~~^
src/libexpr/symbol-table.hh:74:36: error: expected member name or ';' after declaration specifiers
    typedef std::tr1::unordered_set<string> Symbols;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
src/libexpr/symbol-table.hh:78:5: error: unknown type name 'Symbols'; did you mean 'Symbol'?
    Symbols symbols;
    ^~~~~~~
    Symbol
src/libexpr/symbol-table.hh:21:7: note: 'Symbol' declared here
class Symbol
      ^
src/libexpr/symbol-table.hh:83:19: error: use of undeclared identifier 'Symbols'; did you mean 'Symbol'?
        std::pair<Symbols::iterator, bool> res = symbols.insert(s);
                  ^~~~~~~
                  Symbol
src/libexpr/symbol-table.hh:21:7: note: 'Symbol' declared here
class Symbol
      ^
src/libexpr/symbol-table.hh:83:28: error: no member named 'iterator' in 'nix::Symbol'; did you mean 'operator'?
        std::pair<Symbols::iterator, bool> res = symbols.insert(s);
                  ~~~~~~~~~^
src/libexpr/symbol-table.hh:83:44: error: C++ requires a type specifier for all declarations
        std::pair<Symbols::iterator, bool> res = symbols.insert(s);
                                           ^~~
src/libexpr/symbol-table.hh:83:58: error: no member named 'insert' in 'nix::Symbol'
        std::pair<Symbols::iterator, bool> res = symbols.insert(s);
                                                 ~~~~~~~ ^
src/libexpr/symbol-table.hh:89:24: error: no member named 'size' in 'nix::Symbol'
        return symbols.size();
               ~~~~~~~ ^
8 errors generated.
gmake: *** [src/nix-instantiate/nix-instantiate.o] Error 1

now what?

@lucabrunox
Copy link
Contributor

On 25/07/2014 15:21, Tom Lazar wrote:

two minutes after posting the above issue, i found it myself, doh!

need to set the LD flags for FreeBSD like so:

|LDFLAGS="-L/usr/local/lib/" ./configure|

Yes probably /usr/local is not in the ld path by default.

@lucabrunox
Copy link
Contributor

On 25/07/2014 15:26, Tom Lazar wrote:

however, /now/ i get the following:

|[root@nix ~/nix-1.7]# gmake
LD src/libstore/libnixstore.so
LD src/libmain/libnixmain.so
LD src/nix-hash/nix-hash
CXX src/nix-store/dotgraph.o
CXX src/nix-store/nix-store.o
CXX src/nix-store/xmlgraph.o
LD src/nix-store/nix-store
CXX src/nix-instantiate/nix-instantiate.o
In file included from src/nix-instantiate/nix-instantiate.cc:3:
In file included from src/libexpr/eval.hh:3:
In file included from src/libexpr/value.hh:3:
src/libexpr/symbol-table.hh:74:18: error: no member named 'tr1' in namespace 'std'
typedef std::tr1::unordered_set Symbols;
~~~~~^
src/libexpr/symbol-table.hh:74:36: error: expected member name or ';' after declaration specifiers
typedef std::tr1::unordered_set Symbols;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
src/libexpr/symbol-table.hh:78:5: error: unknown type name 'Symbols'; did you mean 'Symbol'?
Symbols symbols;
^~~~~~~
Symbol
src/libexpr/symbol-table.hh:21:7: note: 'Symbol' declared here
class Symbol
^
src/libexpr/symbol-table.hh:83:19: error: use of undeclared identifier 'Symbols'; did you mean 'Symbol'?
std::pair<Symbols::iterator, bool> res = symbols.insert(s);
^~~~~~~
Symbol
src/libexpr/symbol-table.hh:21:7: note: 'Symbol' declared here
class Symbol
^
src/libexpr/symbol-table.hh:83:28: error: no member named 'iterator' in 'nix::Symbol'; did you mean 'operator'?
std::pair<Symbols::iterator, bool> res = symbols.insert(s);
~~~~~~~~~^
src/libexpr/symbol-table.hh:83:44: error: C++ requires a type specifier for all declarations
std::pair<Symbols::iterator, bool> res = symbols.insert(s);
^~~
src/libexpr/symbol-table.hh:83:58: error: no member named 'insert' in 'nix::Symbol'
std::pair<Symbols::iterator, bool> res = symbols.insert(s);
~~~~~~~ ^
src/libexpr/symbol-table.hh:89:24: error: no member named 'size' in 'nix::Symbol'
return symbols.size();
~~~~~~~ ^
8 errors generated.
gmake: *** [src/nix-instantiate/nix-instantiate.o] Error 1
|

now what?

Old g++ version or such? Or different on freebsd.

@vcunat
Copy link
Member

vcunat commented Jul 25, 2014

IMHO the general state is that noone maintained (Free)BSD support for the last year (roughly). We even used to have FreeBSD builders on hydra.nixos.org, but there was practically noone interested...

Recently nix started using some newer c++ features, e.g. the unordered sets as you can see. It's c++11 and some compilers provided before in tr::.

@vcunat
Copy link
Member

vcunat commented Jul 25, 2014

BTW, isn't FreeBSD-10 practically gcc-free (using clang for everything)?

@tomster
Copy link
Author

tomster commented Jul 25, 2014

yes, FreeBSD 10 uses clang for everything AFAIK.

will try to install gpp and compile again

@tomster
Copy link
Author

tomster commented Jul 25, 2014

ok, i installed gcc and then had to symlink /usr/local/bin/gcc47 to /usr/local/bin/gcc for the configure script to pick it up (it then said gcc: ok) but when i then try to make it i get:

[root@nix ~/nix-1.7]# gmake
  CXX    src/nix-instantiate/nix-instantiate.o
In file included from src/nix-instantiate/nix-instantiate.cc:3:
In file included from src/libexpr/eval.hh:3:
In file included from src/libexpr/value.hh:3:
src/libexpr/symbol-table.hh:74:18: error: no member named 'tr1' in namespace 'std'
    typedef std::tr1::unordered_set<string> Symbols;
            ~~~~~^
src/libexpr/symbol-table.hh:74:36: error: expected member name or ';' after
      declaration specifiers
    typedef std::tr1::unordered_set<string> Symbols;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
src/libexpr/symbol-table.hh:78:5: error: unknown type name 'Symbols'; did you mean
      'Symbol'?
    Symbols symbols;
    ^~~~~~~
    Symbol
src/libexpr/symbol-table.hh:21:7: note: 'Symbol' declared here
class Symbol
      ^
src/libexpr/symbol-table.hh:83:19: error: use of undeclared identifier 'Symbols'; did
      you mean 'Symbol'?
        std::pair<Symbols::iterator, bool> res = symbols.insert(s);
                  ^~~~~~~
                  Symbol
src/libexpr/symbol-table.hh:21:7: note: 'Symbol' declared here
class Symbol
      ^
src/libexpr/symbol-table.hh:83:28: error: no member named 'iterator' in
      'nix::Symbol'; did you mean 'operator'?
        std::pair<Symbols::iterator, bool> res = symbols.insert(s);
                  ~~~~~~~~~^
src/libexpr/symbol-table.hh:83:44: error: C++ requires a type specifier for all
      declarations
        std::pair<Symbols::iterator, bool> res = symbols.insert(s);
                                           ^~~
src/libexpr/symbol-table.hh:83:58: error: no member named 'insert' in 'nix::Symbol'
        std::pair<Symbols::iterator, bool> res = symbols.insert(s);
                                                 ~~~~~~~ ^
src/libexpr/symbol-table.hh:89:24: error: no member named 'size' in 'nix::Symbol'
        return symbols.size();
               ~~~~~~~ ^
8 errors generated.

@domenkozar
Copy link
Member

cc @edolstra

@edolstra
Copy link
Member

Nix used to compile fine on FreeBSD even with the std::tr1 stuff (last build log: http://hydra.nixos.org/build/7300160/log/raw).

@tomster
Copy link
Author

tomster commented Jul 25, 2014

@edolstra thanks for the log build, that gave me some interesting configure arguments to play around with!

however, the main problem at the moment seems to be, that eventhough i have gcc 4.8.4 installed it still complains about /usr/bin/ld: unrecognized option '--no-copy-dt-needed-entries' and that when i remove the flag i get the errors above.

i feel that the goal is not too far away, though :)

@tomster
Copy link
Author

tomster commented Jul 25, 2014

perhaps my ld is just too old?

/usr/bin/ld --version
GNU ld 2.17.50 [FreeBSD] 2007-07-03
Copyright 2007 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.

@edolstra
Copy link
Member

No, it's probably that the makefiles have changed since the FreeBSD machines became unavailable. The --no-copy-dt-needed-entries should not be passed on FreeBSD, I guess. See https://github.com/NixOS/nix/blob/master/mk/lib.mk#L36

@tomster
Copy link
Author

tomster commented Jul 25, 2014

@edolstra ah, thanks for that. now at least i know i don't need to try to get it working with this flag.

however, from googling the error message it seems that the fix needs to be performed in the source files, rather than in the configuration?

perhaps this means, that nix in its current state simply cannot be built on FreeBSD?

@tomster
Copy link
Author

tomster commented Jul 25, 2014

at any rate the, claim on the start page of of nixos.org is misleading and should be removed until the issue is fixed, especially given the fact that the non-support has been going on for a year already, no?

@vcunat
Copy link
Member

vcunat commented Jul 25, 2014

The homepage change can wait a while -- if you solve it within a few days, it will be correct again ;-)

@tomster
Copy link
Author

tomster commented Jul 25, 2014

@vcunat, i like your attitude :) but like i said above, i'm now absolutely out of my depth. i'm not a C(++) hacker at all and while i'm happy to tweak makefiles and compiler flags i'm in no position to fix the underlying code and have hit a dead end for now.

@vcunat
Copy link
Member

vcunat commented Jul 25, 2014

To me it looks like misconfiguration. According to my quick searches, gcc-4.7 should support std::unordered_set even directly, without the tr:: part.

@shlevy
Copy link
Member

shlevy commented Jul 25, 2014

You may need --std=c++11 for the std::unordered_set directly

@tomster
Copy link
Author

tomster commented Jul 25, 2014

@shlevy i tried your suggestion by changing the relevant line in the top-level Makefile to:

GLOBAL_CXXFLAGS += -std=c++11

re-ran configure and then gmake.

no dice...

In file included from src/libexpr/value.hh:3:
src/libexpr/symbol-table.hh:74:18: error: no member named 'tr1' in namespace 'std'
    typedef std::tr1::unordered_set<string> Symbols;
            ~~~~~^

@tomster
Copy link
Author

tomster commented Jul 25, 2014

@vcunat ok, misconfiguration sounds good (in this context :-)

also, i've updated to gcc 4.8.4 as that's the version @chaoflow uses on his NixOS machine.

@vcunat
Copy link
Member

vcunat commented Jul 25, 2014

IMHO the problem is in the source trying the tr:: prefix, as with c++11 it should be already just `std::unordered_set...``. Currently I have no idea how this is detected in nix source.

@tomster
Copy link
Author

tomster commented Jul 25, 2014

@vcunat so it looks more like a source problem than configuration?

@kini
Copy link
Member

kini commented Nov 1, 2014

Any updates on this? I'm curious whether Nix now works on FreeBSD again.

@tomster
Copy link
Author

tomster commented Nov 3, 2014

@kini i haven't tried again since reporting this. have you? for all we know it could work now :-) (given that there are new versions of FreeBSD and nix available now)

@vcunat
Copy link
Member

vcunat commented Nov 3, 2014

I believe that using gcc instead of clang should work (as a work-around).

@kini
Copy link
Member

kini commented Nov 3, 2014

@tomster, I haven't tried because I don't (yet) have a FreeBSD system :) I'll be setting one up soon, and wondered if I'd be able to use nix on it. @vcunat, thanks, I guess that should work!

@domenkozar
Copy link
Member

@edolstra are there plans to bring back the FreeBSD machine?

@edolstra
Copy link
Member

edolstra commented Nov 4, 2014

@iElectric Not really. The FreeBSD VMs are unreachable since we had to turn off IPv6 in the build farm. And in any case, they're probably out-dated.

@tomster
Copy link
Author

tomster commented Nov 5, 2014

thanks for the updates @iElectric and @edolstra

as the person who created the issue in the first place i'm taking the liberty of closing it if there are no imminent plans for supporting FreeBSD.

while i'm interested in principle i just don't have the time to setup a build environment for this or conduct any further tests of my own.

i guess i'l just stick to pkg for the time being :)

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

7 participants