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

Cannot compile nimble on Ubuntu Linux 14.04 (i686) #278

Closed
h3rald opened this issue Nov 12, 2016 · 16 comments
Closed

Cannot compile nimble on Ubuntu Linux 14.04 (i686) #278

h3rald opened this issue Nov 12, 2016 · 16 comments

Comments

@h3rald
Copy link

@h3rald h3rald commented Nov 12, 2016

I downloaded and installed nim on a linux system, but I am unable to compile nimble.

When I execute nim e install_tools.nims, I get the following error:

 (...)
 Hint: gcc -c  -w  -I/opt/nim/lib -o /home/h3rald/tmp/nim-0.15.2/dist/nimble/src/nimcache/nimble_nimble.o /home/h3rald/tmp/nim-0.15.2/dist/nimble/src/nimcache/nimble_nimble.c [Exec]
 Error: execution of an external program failed: 'gcc -c  -w  -I/opt/nim/lib -o /home/h3rald/tmp/nim-0.15.2/dist/nimble/src/nimcache/nimble_nimble.o /home/h3rald/tmp/nim-0.15.2/dist/nimble/src/nimcache/nimble_nimble.c'
 stack trace: (most recent call last)
 install_tools.nims(10)
 lib/system/nimscript.nim(221) selfExec
 lib/system/nimscript.nim(221, 7) Error: unhandled exception: FAILED: /opt/nim/bin/nim c --noNimblePath -p:compiler -o:./bin/nimble dist/nimble/src/nimble.nim

...which is weird, especially because if I run just the following command:

 gcc -c  -w  -I/opt/nim/lib -o /home/h3rald/tmp/nim-0.15.2/dist/nimble/src/nimcache/nimble_nimble.o /home/h3rald/tmp/nim-0.15.2/dist/nimble/src/nimcache/nimble_nimble.c

...I get no errors whatsoever.

Here's some more info on my system:

Nim version (installed in /opt/nim, /opt/nim/bin is in $PATH):

  $ nim -v
  Nim Compiler Version 0.15.2 (2016-10-22) [Linux: i386]
  Copyright (c) 2006-2016 by Andreas Rumpf

  git hash: 9f895c6f5a4133f6c06324be3f4032b273a48971
  active boot switches: -d:release

Linux version/distro:

 $ uname -a
 Linux h3raldbox 3.13.0-34-generic #60-Ubuntu SMP Wed Aug 13 15:49:09 UTC 2014 i686 i686 i686 GNU/Linux

GCC version:

 $ gcc -v
 Using built-in specs.
 COLLECT_GCC=gcc
 COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.8/lto-wrapper
 Target: i686-linux-gnu
 Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.3' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-i386/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-i386 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-i386 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
 Thread model: posix
 gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)

Things I also tried:

  • cloning the nimble git repo and compiling it (same error)
  • setting the compiler to clang (same error)

I am able to compile any other nim program except nimble. :(

Any ideas?

--- EDIT

Meanwhile I upgraded to ubuntu 16.04.1 -- same problem :(

@dom96

This comment has been minimized.

Copy link
Member

@dom96 dom96 commented Nov 13, 2016

Nimble should be bundled with every Nim release now so compiling it yourself shouldn't be necessary.

@h3rald

This comment has been minimized.

Copy link
Author

@h3rald h3rald commented Nov 13, 2016

Hi!

What do you mean with "bundled" exactly? I installed nim version 0.15.2 (I built it using build.sh, as usual), and there's no nimble executable in the /bin directory, and nothing in tools.

As far as I can tell the install_nimble.nims and installations.nims scripts download it by cloning the nimble repo.

Maybe I am just missing something really obvious here... :)

1 similar comment
@h3rald

This comment has been minimized.

Copy link
Author

@h3rald h3rald commented Nov 13, 2016

Hi!

What do you mean with "bundled" exactly? I installed nim version 0.15.2 (I built it using build.sh, as usual), and there's no nimble executable in the /bin directory, and nothing in tools.

As far as I can tell the install_nimble.nims and installations.nims scripts download it by cloning the nimble repo.

Maybe I am just missing something really obvious here... :)

@dom96

This comment has been minimized.

Copy link
Member

@dom96 dom96 commented Nov 13, 2016

oh right. The source code is only bundled not the executable, my bad.

Does running nim c --noNimblePath -p:compiler -o:./bin/nimble dist/nimble/src/nimble.nim work?

@h3rald

This comment has been minimized.

Copy link
Author

@h3rald h3rald commented Nov 13, 2016

Nope... :( same error!

@dom96

This comment has been minimized.

Copy link
Member

@dom96 dom96 commented Nov 14, 2016

Can you show me the error that you get when you execute that?

@h3rald

This comment has been minimized.

Copy link
Author

@h3rald h3rald commented Nov 14, 2016

Sure:

 Hint: gcc -c  -w  -I/opt/nim/lib -o /home/h3rald/tmp/nim-0.15.2/dist/nimble/src/nimcache/nimble_nimble.o /home/h3rald/tmp/nim-0.15.2/dist/nimble/src/nimcache/nimble_nimble.c [Exec]
 Error: execution of an external program failed: 'gcc -c  -w  -I/opt/nim/lib -o /home/h3rald/tmp/nim-0.15.2/dist/nimble/src/nimcache/nimble_nimble.o /home/h3rald/tmp/nim-0.15.2/dist/nimble/src/nimcache/nimble_nimble.c'

The thing that really spins me out is the fact that compiling that file with gcc manually actually works! So why doesn't it work when the nim compiler calls gcc as an external program?

@dom96

This comment has been minimized.

Copy link
Member

@dom96 dom96 commented Nov 14, 2016

hrm, can you try compiling with the --parallelBuild:1 flag? nim c --parallelBuild:1 --noNimblePath -p:compiler -o:./bin/nimble dist/nimble/src/nimble.nim

Also maybe try removing the other flags, like --noNimblePath and the -o:...

@h3rald

This comment has been minimized.

Copy link
Author

@h3rald h3rald commented Nov 14, 2016

  • Enabled parallelBuild as you said, no change
  • Removed -o, no change
  • Removed -o and --noNimblePath, no change

It is always coming up with the same error "execution of external program failed", even though if I execute it manually it compiles!

@dom96

This comment has been minimized.

Copy link
Member

@dom96 dom96 commented Nov 14, 2016

Well. I'm stumped. @Araq please help.

On Monday, 14 November 2016, Fabio Cevasco notifications@github.com wrote:

  • Enabled parallelBuild as you said, no change
  • Removed -o, no change
  • Removed -o and --noNimblePath, no change

It is always coming up with the same error "execution of external program
failed", even though if I execute it manually it compiles!


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#278 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPDe5KKkqMLuSzdHDjf2tus8IZYlP7hks5q-LjcgaJpZM4KwaBF
.

@Araq

This comment has been minimized.

Copy link
Member

@Araq Araq commented Nov 15, 2016

This is just a hypothesis, of course, but I have seen this before. Your machine doesn't have enough RAM to compile Nimble, the RAM suffices for the Nim compiler but not for Nim invoking GCC. When you execute GCC manually you do this after Nim has finished and so the memory that Nim takes is available for GCC.

That Nimble is a bigger Nim program that the compiler itself is weird (bootstrapping works after all on your machine, right?), but on my machine the nimble binary is twice the size of Nim's so Nimble is definitely more taxing than Nim itself (we need to investigate why that is, in theory Nimble should be smaller).

@h3rald

This comment has been minimized.

Copy link
Author

@h3rald h3rald commented Nov 15, 2016

Interesting... The machine I am trying to compile nimble on actually only has 512MB of RAM!

However I did try to compile another nim program of mine (LiteStore) on the same machine and it worked fine... The resulting executable (in release mode) is over 2MB:

 Hint: operation successful (46133 lines compiled; 12.587 sec total; 60.508MiB; Release Build) [SuccessX]

How big is nimble?

@dom96

This comment has been minimized.

Copy link
Member

@dom96 dom96 commented Nov 15, 2016

That must be the problem. Nimble includes compiler sources and so it likely requires more RAM to build than the compiler itself.

Solution would be to enable swap.

That said, I think we should do better here. An error message that says "out of memory" would be nice. (that's a Nim bug though).

@Araq

This comment has been minimized.

Copy link
Member

@Araq Araq commented Nov 15, 2016

That said, I think we should do better here. An error message that says "out of memory" would be nice. (that's a Nim bug though).

Seems impossible to do, Linux performs memory overcommit, processes crash with segmentation faults for OOM.

@Araq

This comment has been minimized.

Copy link
Member

@Araq Araq commented Nov 15, 2016

However I did try to compile another nim program of mine (LiteStore) on the same machine and it worked fine... The resulting executable (in release mode) is over 2MB:

Well the final executable size hardly is correlated with how much RAM is used during compilation. Doesn't surprise me at all.

@dom96

This comment has been minimized.

Copy link
Member

@dom96 dom96 commented Nov 25, 2016

Closing this because it isn't a Nimble issue.

@dom96 dom96 closed this Nov 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.