Re: [Nix-dev] mxe on NixOS

2015-09-01 Thread Andrew Kelley
Wrapping this thread up:

mxe has an environment variable whitelist that was causing the problem.
NixOS relies heavily on environment variables (such as PKG_CONFIG_PATH) to
utilize /nix/store/*. mxe has the whitelist in order to keep the OS
separate from MXE, but it also relies on hard coded paths ("standard
directories"). So mxe simultaneously wants to separate its environment from
the OS environment while interfacing with the OS environment via hard coded
paths. The maintainer recognized it as an MXE limitation, a limitation
which was too hard to overcome for such a non-mainstream OS.

Upstream discussion:
https://github.com/mxe/mxe/issues/723#issuecomment-133584114

Thanks for the assistance in figuring this out, I appreciate it.

On Thu, Aug 20, 2015 at 7:33 PM James Cook  wrote:

> >> * If you can successfully build ordinary glib that way, but can't
> >> build mxe glib, it might be time to take it back to the mxe people.
> >
> > OK so it sounds like maybe this is an mxe issue after all?
>
> Could be. I would report back to the mxe bug, since you've verified
> that you have everything you need to build glib normally (including
> running autogen.sh).
>
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] mxe on NixOS

2015-08-17 Thread Andrew Kelley
On Mon, Aug 17, 2015 at 10:13 PM, James Cook james.c...@utoronto.ca wrote:

 No, I'm not using mxe at all, and I've only tried running autogen.sh.

 Unless someone chimes in and points out why building glib outside
 nix-shell isn't working, a couple of ideas if you haven't already
 tried them:

 * Try starting with the glib derivation: add autoconf, automake and
 libtool to pkgs/development/libraries/glib/default.nix and use
 nix-shell -A glib.


I forked nixpkgs and then did this modification:

diff --git a/pkgs/development/libraries/glib/default.nix
b/pkgs/development/libraries/glib/default.nix
index fb9c361..ad2eba4 100644
--- a/pkgs/development/libraries/glib/default.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -1,5 +1,6 @@
 { stdenv, fetchurl, pkgconfig, gettext, perl, python
 , libiconv, libintlOrEmpty, zlib, libffi, pcre, libelf
+, autoconf, automake, libtool

 # this is just for tests (not in closure of any regular package)
 , coreutils, dbus_daemon, libxml2, tzdata, desktop_file_utils,
shared_mime_info, doCheck ? false
@@ -55,7 +56,7 @@ stdenv.mkDerivation rec {

   setupHook = ./setup-hook.sh;

-  buildInputs = [ libelf ]
+  buildInputs = [ libelf autoconf automake libtool ]
 ++ optionals doCheck [ tzdata libxml2 desktop_file_utils
shared_mime_info ];

   nativeBuildInputs = [ pkgconfig gettext perl python ];


Then I tried `NIX_PATH=nixpkgs=/home/andy/dev/nixpkgs nix-shell -A glib`
but it did not need to recompile glib. Not sure what's going on with that.

Then I tried `nix-build -A glib` which as I understand uses the current
directory (which was /home/andy/dev/nixpkgs) and that did trigger a build
of glib, which succeeded.



 * With that method, can you build vanilla, non-mxe glib?
 (https://github.com/GNOME/glib) If not, we must be doing something
 different...


Do you mean building it from source using ./autogen.sh as you did earlier?

I tried that just now and it worked fine. I used this for nix-shell:

with import nixpkgs {}; {
  glibEnv = stdenv.mkDerivation {
name = glib;
buildInputs = [
  gnome.gtk_doc
  autoconf
  automake
  gnumake
  bison
  cmake
  flex
  gettext
  gperf
  intltool
  libtool
  pkgconfig
  openssl
  ruby
  scons
  unzip
  python
  wget
  zlib
  libffi
];
  };
}

The extra packages are packages that are in the mxe nix-shell environment;
I thought I'd try to keep the environments close to see what would happen.



 * If you can successfully build ordinary glib that way, but can't
 build mxe glib, it might be time to take it back to the mxe people.


OK so it sounds like maybe this is an mxe issue after all?



 James

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] mxe on NixOS

2015-08-17 Thread Andrew Kelley
On Mon, Aug 17, 2015 at 10:01 PM James Cook james.c...@utoronto.ca wrote:

 Thanks. Adding autoconf, automake and libtool to buildInputs for glib
 and running nix-shell -A glib put be in an environment where I can
 successfully run autogen.sh.

 Any idea why it only works in a nix-shell instance? I have autoconf,
 automake, libtool installed via nix-env.

 (Andrew, are you still hoping to get this working?)


Yes I am.

My current strategy is this .nix file:

with import nixpkgs {}; {
  mxeEnv = stdenv.mkDerivation {
name = mxe;
buildInputs = [
  autoconf
  automake
  gnumake
  bison
  cmake
  flex
  gettext
  gperf
  intltool
  libtool
  openssl
  ruby
  scons
  unzip
  pkgconfig
  python
  wget
];
  };
}

Then I use `nix-shell mxe.nix` and attempt to `make glib`, and I get the
issue I originally reported.

Am I understanding correctly that you are doing something slightly
different and successfully able to build glib with mxe?




 James


 On 17 August 2015 at 02:07, Luca Bruno lethalma...@gmail.com wrote:
  Using nix-shell -A glib is wrong if you are going to use autogen.sh,
 because
  autogen.sh is used to build from git not from tarball. So the glib nix
  expression does not have neither autoconf nor automake in the buildInputs
  for this reason.
 
  Put autoconf and automake in the buildInputs of the glib nix expression,
  then it should work.
 
  On Mon, Aug 17, 2015 at 6:45 AM, James Cook james.c...@utoronto.ca
 wrote:
 
  pkg-config is in my environment.
 
  If it means anything, I see the same error if I run ./autogen.sh
  inside nix-shell -A glib (still using my manually-cloned glib).
 
  James
 
  On 16 August 2015 at 01:41, Luca Bruno lethalma...@gmail.com wrote:
  
  
   On Sunday, August 16, 2015, James Cook james.c...@utoronto.ca
 wrote:
  
   To perhaps simplify the problem, does anyone know how to build glib
 on
   a NixOS system the old-fashioned way, without using nix? If I just
 run
   ./autogen.sh in a fresh glib checkout, I get a similar error to the
   one Andrew is getting.
  
   A parallel question: Andrew, are you familiar enough with nixpkgs to
   try writing an nix expression that unpacks mxe and tells it to build
   glib? That might be another approach, though I think it would be nice
   if users had the option of not doing it that way.


I'm not familiar enough to do so currently but I'm willing to learn. I do
agree with you that it would be nice if users had the option of not doing
it this way.


  
   $ ./autogen.sh
   You don't have gtk-doc installed, and thus won't be able to generate
   the documentation.
   autoreconf: Entering directory `.'
   autoreconf: configure.ac: not using Gettext
   autoreconf: running: aclocal --force -I m4macros ${ACLOCAL_FLAGS}
   autoreconf: configure.ac: tracing
   autoreconf: configure.ac: not using Libtool
   autoreconf: running:
  
 /nix/store/prmn46fajbj2ymcw43aqrdfbii1bj8bz-autoconf-2.69/bin/autoconf
   --force
   configure.ac:88: error: possibly undefined macro: AC_DEFINE
 If this token and others are legitimate, please use
   m4_pattern_allow.
 See the Autoconf documentation.
   autoreconf:
  
 /nix/store/prmn46fajbj2ymcw43aqrdfbii1bj8bz-autoconf-2.69/bin/autoconf
   failed with exit status: 1
  
  
   You need pkgconfig in your env.
  
  
   --
   NixOS Linux
  
 
 
 
 
  --
  NixOS Linux

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] mxe on NixOS

2015-07-27 Thread Andrew Kelley
On Mon, Jul 27, 2015 at 1:36 AM Luca Bruno lethalma...@gmail.com wrote:

 On 27/07/2015 07:36, Andrew Kelley wrote:

 mxe (M Cross Environment) is a way to cross compile for Windows. It's a
 pretty great project.

  There's one hitch when using it on NixOS. I guess it expects
 /usr/share/aclocal/pkg.m4 to exist for some reason. I don't completely
 understand it and I'm still pretty new to NixOS. I was hoping to get some
 more experienced people to maybe chime in and point out what MXE could do
 to not break on NixOS.

  Here's the upstream issue:
 https://github.com/mxe/mxe/issues/723#issuecomment-125044881

  Any ideas?

 You are trying to build something outside of a nix build environment.
 Instead of calling make ecc. like you do on every other distro, in Nix
 things are very different. You should write a .nix file describing how the
 package should build and build it. It will be easier.

 Also 99% of the times errors like that are not an upstream issue but your
 own issue on nixos.


Thanks for the reply.

I think I did not succeed in explaining what MXE is and how it works. It
would not make sense to create a nix expression for mxe; one does not build
mxe like a normal application. Instead, one uses mxe to build for Windows.
So compiling software with mxe is more like running a normal application at
runtime rather than building a package.

I think one of two things is the case:

1. The MXE project depends on some hard coded path, and I'd like to try to
find out what that is and send a patch to MXE which would use the proper
way to detect the path instead.
2. autotools depends on some hard coded path, and I'd like to see if it's
possible to fix that bug on NixOS with a patch.
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[Nix-dev] mxe on NixOS

2015-07-26 Thread Andrew Kelley
mxe (M Cross Environment) is a way to cross compile for Windows. It's a
pretty great project.

There's one hitch when using it on NixOS. I guess it expects
/usr/share/aclocal/pkg.m4 to exist for some reason. I don't completely
understand it and I'm still pretty new to NixOS. I was hoping to get some
more experienced people to maybe chime in and point out what MXE could do
to not break on NixOS.

Here's the upstream issue:
https://github.com/mxe/mxe/issues/723#issuecomment-125044881

Any ideas?
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev