gopherdata / gophernotes

The Go kernel for Jupyter notebooks and nteract.
MIT License
3.84k stars 265 forks source link

Error installing on Windows #192

Closed hlalibe closed 4 years ago

hlalibe commented 4 years ago

Trying to install in Windows, after this line in command prompt: ..\Go\src\github.com\gopherdata\gophernotes\zmq-win>build.bat amd64 I get : ..Go/src/github.com/gopherdata/gophernotes/zmq-win/lib-amd64/libzmq.a: error adding symbols: File in wrong format collect2.exe: error: ld returned 1 exit status

Googled it extensively, not sure how to fix this.

cosmos72 commented 4 years ago

The first thing coming to my mind (cannot check now) is this: did you install a 32 or 64 bit mingw? It looks somewhat like an error from 32 vs 64 bit mismatch.

You can check with gcc -v

hlalibe commented 4 years ago

when I run gcc --version in MinGW directory I get: gcc (tdm64-1) 5.1.0

hlalibe commented 4 years ago

I installed MinGW in c:\MinGW\ but I'm trying to install GO on my D: drive, could this create my problem ?

cosmos72 commented 4 years ago

As long as gcc is in your %PATH%, the actual location should not matter. And tdm64 should mean 64 bit, although I expect gcc -v would report more information. In summary, at the moment I don't know why the linker complains. I will try to run some compilation tests on Windows

hlalibe commented 4 years ago

As long as gcc is in your %PATH%, the actual location should not matter. And tdm64 should mean 64 bit, although I expect gcc -v would report more information. In summary, at the moment I don't know why the linker complains. I will try to run some compilation tests on Windows

  • I checked my path and i see C:\TDM-GCC-64\bin
  • sorry, i ran gcc -version instead of gcc -v, i thought they were the same. gcc - v returns: Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=C:/TDM-GCC-64/bin/../libexec/gcc/x86_64-w64-mingw32/5.1.0/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../../../src/gcc-5.1.0/configure --build=x86_64-w64-mingw32 --enable-targets=all --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-libgomp --enable-lto --enable-graphite --enable-cxx-flags=-DWINPTHREAD_STATIC --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-libstdcxx-debug --enable-threads=posix --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libstdcxx-threads --enable-libstdcxx-time --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --prefix=/mingw64tdm --with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=http://tdm-gcc.tdragon.net/bugs Thread model: posix gcc version 5.1.0 (tdm64-1)
cosmos72 commented 4 years ago

Good, you gcc is definitely 64 bit. The line Target: x86_64-... tells exactly that.

If you have two installations of Go toolchain, they can interfere if both are in %PATH%. It could be the cause of the errors.

I recommend temporarily renaming the directory of the Go installation you are not using at the moment, and trying again to build gophernotes

hlalibe commented 4 years ago

Renaming the GO folder created other issues, so i wanted to start from zero and uninstalled GO first. Then I followed the instructions on your page, there is one that is not clear for me: We need to install from this page: https://zeromq.org/download/

So for Windows I downloaded this file: https://dl.bintray.com/zeromq/generic/libzmq-v141-x64-4_3_2.zip

Inside this zip file there are many files and .exe, but it is not clear what to do with the content of this zip file. The page says only to download and extract. But extract it where ? That might be linked to my error message.

cosmos72 commented 4 years ago

ZeroMQ download/installation is not needed on Windows.

The README says:

hlalibe commented 4 years ago

Mmm... But then I'm back to the same place I started I'm afraid. After running: ..Go\src\github.com\gopherdata\gophernotes\zmq-win>build.bat amd64 I get after a few seconds: '# github.com/pebbe/zmq4 .../Go/src/github.com/gopherdata/gophernotes/zmq-win/lib-amd64/libzmq.a: error adding symbols: File in wrong format collect2.exe: error: ld returned 1 exit status

In my first post i realised i missed copy/paste the first line of the error message: '# github.com/pebbe/zmq4

Does it bring anything new ?

Possible similar issue here, they fixed it by reinstalling the libzmq from source. Could it help ? Not entirely sure i understand how to do this. https://github.com/pebbe/zmq4/issues/100

I've got monster data files to analyse and GO is my only solution. I really need to make it work.

cosmos72 commented 4 years ago

Running out of ideas here... In order of "unlikeliness":

  1. try a 32 bit compile
    set GOARCH=386
    build.bat 386
  2. Install a different mingw distribution
  3. Ask to somebody you trust to compile gophernotes for you

[Update] it really looks the same as https://github.com/pebbe/zmq4/issues/100 Then the solution could (hopefully) be to reinstall zmq4 from source, following the relevant instruction

hlalibe commented 4 years ago

ok. I tried option 1. Where/when do i need to set GOARCH=386 ? I entered that command on the command prompt on zmq-win> folder. No error returned. Then I ran build.bat 386 and got:

github.com/pebbe/zmq4

....\Go\pkg\mod\github.com\pebbe\zmq4@v0.0.0-20170917105202-90d69e412a09\ctxoptions_windows.go:21:12: undefined: Context ...\Go\pkg\mod\github.com\pebbe\zmq4@v0.0.0-20170917105202-90d69e412a09\ctxoptions_windows.go:42:12: undefined: Context ...\Go\pkg\mod\github.com\pebbe\zmq4@v0.0.0-20170917105202-90d69e412a09\reactor.go:10:4: undefined: State ...\Go\pkg\mod\github.com\pebbe\zmq4@v0.0.0-20170917105202-90d69e412a09\reactor.go:11:9: undefined: State

thanks for your patience.

cosmos72 commented 4 years ago

I have uploaded a binary release for 64 bit windows at https://github.com/gopherdata/gophernotes/releases/tag/v0.6.1 You can try it if you want.

Anyway, gophernotes is not very comfortable to use on Windows. The reason is: every time you want to import a new (i.e. never imported before) third-party package, you need to recompile gophernotes itself. This is somewhat annoying, but becomes a showstopper if compiling gophernotes fails - as in your case.

It works much better on Linux and Mac OS X - and it's also easier to compile on these systems.

hlalibe commented 4 years ago

Progress. I can now start a Jupyter Notebook, when selecting New and GO, it opens, but then I get this error message: Capture

In my ..\go\bin\ directory i have only gophernotes.exe and libzmq.dll.

Let me know if simple to fix, otherwise I will find a way to run it under Linux.

cosmos72 commented 4 years ago

Yes, some progress. Sorry that you are experiencing all these issue. Just to understand your current situation:

  1. Did you manage to compile it, or you downloaded the binary?
  2. What happens if you run gophernotes.exe from a command prompt? (Going to the directory that contains it)
hlalibe commented 4 years ago
  1. I did not compile, I downloaded your file from here: https://github.com/gopherdata/gophernotes/releases/tag/v0.6.1 , unzipped and copied gophernotes.exe to ..\Go\bin\

  2. If i run gophernotes.exe from command prompt in ..\Go\bin\ I get the exact same popup error message as above after a few seconds.

If it helps, my libzmq.dll is file version 4.1.0.5

cosmos72 commented 4 years ago

Hmm... I have recompiled gophernotes.exe with windows 10, and zipped it with libzmq.dll Let's see if it helps - see https://github.com/gopherdata/gophernotes/releases/tag/v0.6.1

hlalibe commented 4 years ago

Yes ! It is working now, i ran a simple fmt.Println("hello world") instruction and it returns, well, Hello World. Just in time for X'mas ! Grazie mille et Buon Natale !