electron-userland / electron-prebuilt

🎂 Retired project. See README
http://npm.im/electron
MIT License
759 stars 128 forks source link

undefined symbol: g_bytes_unref #182

Closed soichih closed 7 years ago

soichih commented 8 years ago

I am using electron-prebuilt version 1.3.3

I've git cloned electron-quick-start ( https://github.com/electron/electron-quick-start.git) and did npm install (node version 4.5.0). When I try to do npm start, I get following error messages.

$ npm start

> electron-quick-start@1.0.0 start /gpfs/home/h/a/hayashis/Karst/git/electron-quick-start
> electron .

/gpfs/home/h/a/hayashis/Karst/git/electron-quick-start/node_modules/electron-prebuilt/dist/electron: symbol lookup error: /gpfs/home/h/a/hayashis/Karst/git/electron-quick-start/node_modules/electron-prebuilt/dist/electron: undefined symbol: g_bytes_unref

npm ERR! Linux 2.6.32-642.3.1.el6.x86_64
npm ERR! argv "/gpfs/home/h/a/hayashis/Karst/app/node-v4.5.0-linux-x64/bin/node" "/gpfs/home/h/a/hayashis/Karst/app/node-v4.5.0-linux-x64/bin/npm" "start"
...

I am using RHEL 6.8, and ldd dump showing following libraries linked,

$ ldd /gpfs/home/h/a/hayashis/Karst/git/electron-quick-start/node_modules/electron-prebuilt/dist/electron
    linux-vdso.so.1 =>  (0x00007fffc39ec000)
    libnode.so => /gpfs/home/h/a/hayashis/Karst/git/electron-quick-start/node_modules/electron-prebuilt/dist/libnode.so (0x00007f9a847c3000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x000000380e200000)
    libgtk-x11-2.0.so.0 => /usr/lib64/libgtk-x11-2.0.so.0 (0x0000003819600000)
    libgdk-x11-2.0.so.0 => /usr/lib64/libgdk-x11-2.0.so.0 (0x0000003817e00000)
    libatk-1.0.so.0 => /usr/lib64/libatk-1.0.so.0 (0x0000003819e00000)
    libgio-2.0.so.0 => /lib64/libgio-2.0.so.0 (0x0000003811600000)
    libpangocairo-1.0.so.0 => /usr/lib64/libpangocairo-1.0.so.0 (0x0000003816200000)
    libgdk_pixbuf-2.0.so.0 => /usr/lib64/libgdk_pixbuf-2.0.so.0 (0x0000003818600000)
    libcairo.so.2 => /usr/lib64/libcairo.so.2 (0x000000381a600000)
    libpango-1.0.so.0 => /usr/lib64/libpango-1.0.so.0 (0x0000003818200000)
    libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x0000003812e00000)
    libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x0000003813200000)
    libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x000000380fe00000)
    libdbus-1.so.3 => /lib64/libdbus-1.so.3 (0x0000003810200000)
    libXi.so.6 => /usr/lib64/libXi.so.6 (0x0000003814200000)
    libXcursor.so.1 => /usr/lib64/libXcursor.so.1 (0x0000003816600000)
    libXdamage.so.1 => /usr/lib64/libXdamage.so.1 (0x0000003815a00000)
    libXrandr.so.2 => /usr/lib64/libXrandr.so.2 (0x0000003815600000)
    libXcomposite.so.1 => /usr/lib64/libXcomposite.so.1 (0x0000003819200000)
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x0000003812a00000)
    libXfixes.so.3 => /usr/lib64/libXfixes.so.3 (0x0000003814a00000)
    libXrender.so.1 => /usr/lib64/libXrender.so.1 (0x0000003813a00000)
    libX11.so.6 => /usr/lib64/libX11.so.6 (0x0000003811a00000)
    libXtst.so.6 => /usr/lib64/libXtst.so.6 (0x0000003812600000)
    libXss.so.1 => /usr/lib64/libXss.so.1 (0x0000003810e00000)
    libgconf-2.so.4 => /usr/lib64/libgconf-2.so.4 (0x000000381c600000)
    libgmodule-2.0.so.0 => /lib64/libgmodule-2.0.so.0 (0x0000003810600000)
    librt.so.1 => /lib64/librt.so.1 (0x000000380ea00000)
    libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x000000380f200000)
    libnss3.so => /usr/lib64/libnss3.so (0x0000003816a00000)
    libnssutil3.so => /usr/lib64/libnssutil3.so (0x0000003814e00000)
    libsmime3.so => /usr/lib64/libsmime3.so (0x000000381d200000)
    libnspr4.so => /lib64/libnspr4.so (0x0000003817200000)
    libffmpeg.so => /gpfs/home/h/a/hayashis/Karst/git/electron-quick-start/node_modules/electron-prebuilt/dist/libffmpeg.so (0x00007f9a843c6000)
    libasound.so.2 => /lib64/libasound.so.2 (0x0000003815200000)
    libcups.so.2 => /usr/lib64/libcups.so.2 (0x0000003780c00000)
    libdl.so.2 => /lib64/libdl.so.2 (0x000000380de00000)
    libexpat.so.1 => /lib64/libexpat.so.1 (0x0000003811e00000)
    libstdc++.so.6 => /N/soft/rhel6/gcc/4.9.2/lib64/libstdc++.so.6 (0x00007f9a840b2000)
    libm.so.6 => /lib64/libm.so.6 (0x000000380da00000)
    libgcc_s.so.1 => /N/soft/rhel6/gcc/4.9.2/lib64/libgcc_s.so.1 (0x00007f9a83e9c000)
    libc.so.6 => /lib64/libc.so.6 (0x000000380d600000)
    /lib64/ld-linux-x86-64.so.2 (0x000000380d200000)
    libpangoft2-1.0.so.0 => /usr/lib64/libpangoft2-1.0.so.0 (0x000000381a200000)
    libXinerama.so.1 => /usr/lib64/libXinerama.so.1 (0x0000003813e00000)
    libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x000000380fa00000)
    libresolv.so.2 => /lib64/libresolv.so.2 (0x000000380f600000)
    libz.so.1 => /lib64/libz.so.1 (0x000000380e600000)
    libselinux.so.1 => /lib64/libselinux.so.1 (0x000000380ee00000)
    libpng12.so.0 => /usr/lib64/libpng12.so.0 (0x0000003812200000)
    libpixman-1.so.0 => /usr/lib64/libpixman-1.so.0 (0x0000003817a00000)
    libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x0000003810a00000)
    libORBit-2.so.0 => /usr/lib64/libORBit-2.so.0 (0x000000381ae00000)
    libplc4.so => /lib64/libplc4.so (0x0000003818a00000)
    libplds4.so => /lib64/libplds4.so (0x0000003817600000)
    libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x000000381da00000)
    libkrb5.so.3 => /lib64/libkrb5.so.3 (0x000000381b200000)
    libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x000000381b600000)
    libcom_err.so.2 => /lib64/libcom_err.so.2 (0x0000003815e00000)
    libgnutls.so.26 => /usr/lib64/libgnutls.so.26 (0x00007f9a83bf1000)
    libavahi-common.so.3 => /usr/lib64/libavahi-common.so.3 (0x0000003821200000)
    libavahi-client.so.3 => /usr/lib64/libavahi-client.so.3 (0x000000381ea00000)
    libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000003780800000)
    libXau.so.6 => /usr/lib64/libXau.so.6 (0x0000003811200000)
    libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x000000381be00000)
    libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x000000381ba00000)
    libtasn1.so.3 => /usr/lib64/libtasn1.so.3 (0x000000381ca00000)
    libgcrypt.so.11 => /lib64/libgcrypt.so.11 (0x000000381aa00000)
    libfreebl3.so => /lib64/libfreebl3.so (0x0000003780400000)
    libgpg-error.so.0 => /lib64/libgpg-error.so.0 (0x0000003820e00000)

Is electron not supported on RHEL6?

ipsBruno commented 8 years ago

Try

yum install gtk2-devel

tony204 commented 8 years ago

anyone can resolve this problem, it is also happen in my side. [root@aa33d11d8d79 E2E]# DEBUG=nightmare:,electron: xvfb-run node yahoo_test.js electron:stderr /data/instances/01/node_modules/nightmare/node_modules/electron-prebuilt/dist/electron: symbol lookup error: /data/instances/01/node_modules/nightmare/node_modules/electron-prebuilt/dist/electron: undefined symbol: g_bytes_unref +0ms

tony204 commented 8 years ago

i have used the #yum install gtk2-devel , but can't reslove the exception

ipsBruno commented 8 years ago

Aparently your glib is outdated.

tony204 commented 8 years ago

how can i update my glib?

ipsBruno commented 8 years ago

You need compile and replace .so in your lib folder

https://developer.gnome.org/glib/2.48/glib-building.html

Regards ..

tony204 commented 8 years ago

i have checked my gcc, it is 4.8.2 [root@aa33d11d8d79 E2E]# gcc --version gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15) Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@aa33d11d8d79 E2E]# gcc --version gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15) Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

soichih commented 8 years ago

I have gtk2-devel already installed on our machine.

I've been trying to compile glib-2-48, but it looks like the configure script uses some autoconf feature that's too new for my machine.

hayashis@hm015:~/git/glib(glib-2-48) $ ./configure ./configure: line 2020: syntax error near unexpected token 1.11' ./configure: line 2020:AM_INIT_AUTOMAKE(1.11 -Wno-portability no-define no-dist-gzip dist-xz tar-ustar)'

Can someone give me step-by-step instructions on how to get electron working on RHEL6 / CentOS6?

jlison commented 8 years ago

Facing exactly the same problem here. Some help would be greatly appreciated.

soichih commented 8 years ago

@jlison We've managed to compile glib-2.49.4 (don't get confused by GLIBC) from source on our RHEL6 machine and pointed LD_LIBRARY_PATH to those alternative glibs, and I was able to run electron.

jlison commented 8 years ago

@soichih Thank you for replying back! Any chance that you could guide me on how you managed to run electron?

I have tried the following: 1) I updated GLIBC on CentOS 6 successfully (compiled from source)

In my /usr/lib64/

lrwxrwxrwx.  1 root root   19 Oct  6 18:34 libstdc++.so.6 -> libstdc++.so.6.0.18
-rwxr-xr-x.  1 root root 6.2M Oct  6 18:22 libstdc++.so.6.0.13
-rwxr-xr-x.  1 root root 6.2M Oct  6 18:21 libstdc++.so.6.0.18

2) gcc --version is: gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)

3) If I run strings /usr/lib64/libstdc++.so.6 | grep GLIB , I get:

GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBC_2.3
GLIBC_2.2.5
GLIBC_2.3.2
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH

4) I proceed to compile Glib from source:

cd /root/
mkdir glib-source

cd glib-source/

wget http://ftp.gnome.org/pub/GNOME/sources/glib/2.32/glib-2.32.4.tar.xz 
tar -xf glib-2.32.4.tar.xz

cd glib-2.32.4/

./configure --prefix=/usr/local/glib-2.32
make

make install

export LD_LIBRARY_PATH=/usr/local/glib-2.32/lib/

export PKG_CONFIG_PATH=/usr/local/glib-2.32/lib/pkgconfig

5) If I run my node app with electron-wrtc I still get:

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: electron-eval error: Electron process exited with code 127.
Stderr:
/node_modules/electron-prebuilt/dist/electron: symbol lookup error: /node_modules/electron-prebuilt/dist/electron: undefined symbol: g_bytes_unref

    at ChildProcess.<anonymous> (/node_modules/electron-eval/lib/index.js:165:22)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

I am a not very fluent with C, so I am not sure what I may be doing wrong.

am I exporting the wrong paths, or running the command(s) on the wrong place? am I not installing glib correctly?

Any help would be appreciated, and I would be more than happy to write a wiki/tutorial on how to get this error fixed if I manage to understand what I am doing wrong.

soichih commented 8 years ago

@jlison

I don't think you need to update GLIBC... but if it's outdated, you should by all means. :)

The glib-2.23 (the default version for RHEL6.8?) is too old. You need to compile later version. Like I said, we've managed to compile 2.49 and it works. I had to solve some dependency hell before we finally got the glib to compile though..

glibpath=/N/u/hayashis/Karst/lib/gcc-4.7.2
export LD_LIBRARY_PATH=$glibpath/glib-2.49.4-kgesagxmtbemim2denf65on4iixy3miy/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$glibpath/libffi-3.2.1-wk2luzhfdpbievnqqtu24pi774esyqye/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$glibpath/pcre-8.39-itdbuzevbtzqeqrvna47wstwczud67wx/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$glibpath/gettext-0.19.8.1-aoweyaoufujdlobl7dphb2gdrhuhikil/lib:$LD_LIBRARY_PATH
jlison commented 8 years ago

@soichih

We finally got electron running using your files! In our case we had to add a file in /etc/ld.so.conf.d/ listing your new lib dirs. In addition, in case someone else here is trying to fix this error as well, please do not make the n00b mistake of placing your binaries in a directory that may not be readable, such as /root/. That was a stupid error that made us lose quite a lot of time.

Our extra steps: 1) We extracted soichih's binaries in /opt/ 2) cd /etc/ld.so.conf.d/ 3) vi gcc-4.7.2.conf 4) Added the following lines in gcc-4.7.2.conf:

/opt/gcc-4.7.2/glib-2.49.4-kgesagxmtbemim2denf65on4iixy3miy/lib
/opt/gcc-4.7.2/libffi-3.2.1-wk2luzhfdpbievnqqtu24pi774esyqye/lib64
/opt/gcc-4.7.2/pcre-8.39-itdbuzevbtzqeqrvna47wstwczud67wx/lib
/opt/gcc-4.7.2/gettext-0.19.8.1-aoweyaoufujdlobl7dphb2gdrhuhikil/lib

5) Run sudo ldconfig in the CLI to build a new ldconfig cache. 6) Run

sudo ldconfig -p | grep "libglib"

to check that glib-2.49.4 is being loaded properly. Electron binaries should run without errors now, considering that the rest of the required dependencies are installed properly. In our case, we had to update GLIBC as well (compiled from source).

Finally, with your permission, I created a mirror of your binaries: https://jlison.github.io/bin/centos6/soichih/mirror/gcc-4.7.2.tar.gz ...in case your link ever goes down. You really saved me a few hours of waiting to get those binaries compiled!

Thank you so much for all your help! I really appreciate it!

Cheers!

soichih commented 8 years ago

@jlison

I am glad it worked - and thanks for the ldconfig tip. I am hoping that it gets fixed upstream - by electron folks so that nobody has to update the lib soon.

I've removed my link to the binary, but I can give it to whoever asks for it. I tried your link but it's 404 at the moment.

jlison commented 8 years ago

@soichih

Fixed a typo in the link. It should be working now.

Thanks a million again!

ITboy commented 7 years ago

Thanks soichih & jlison very much, It helps me too.

WinPoss commented 7 years ago

Thanks soichih & jlison very much, i have used the means step-by-step , but can't reslove the exception:

sudo ldconfig -p | grep "libglib"
    libglib-2.0.so.0 (libc6,x86-64) => /opt/gcc-4.7.2/glib-2.49.4-kgesagxmtbemim2denf65on4iixy3miy/lib/libglib-2.0.so.0
    libglib-2.0.so.0 (libc6) => /lib/libglib-2.0.so.0
    libglib-2.0.so (libc6,x86-64) => /opt/gcc-4.7.2/glib-2.49.4-kgesagxmtbemim2denf65on4iixy3miy/lib/libglib-2.0.so
    libglib-2.0.so (libc6) => /usr/lib/libglib-2.0.so

and

electron -v
/usr/local/src/node/lib/node_modules/electron-prebuilt/dist/electron: symbol lookup error: /usr/local/src/node/lib/node_modules/electron-prebuilt/dist/electron: undefined symbol: g_bytes_unref

please how should I do to solve the problem?

macetw commented 7 years ago

Those binaries solved my port-to-centos6 problem.

(I also had stolen a libstdc++.so library from a package of Chrome)

I'd like to suggest that they be made part of an official Electron build for CentOS 6, publicly releasable and compiled like it is compiled for Ubuntu 12. CentOS 6 MUST be supported to ethically call Electron supported for Linux.

rinogo commented 7 years ago

+100 on CentOS needing to be fully supported. We spent a decent amount of time writing and testing code that leverages Electron on an OS X machine. When we tried to deploy the code to our dev environment (CentOS 6, which mirrors production), we were in for a big surprise. At this point, after working through several issues already (including recompiling gcc), I'm considering just giving up on Electron entirely.

Only the most dedicated/stubborn users/admins will perform the upgrades needed to get Electron working on CentOS. I totally agree that in order to claim that Linux is supported, straightforward CentOS/RHEL deployment is essential.

rinogo commented 7 years ago

Thanks so much, @soichih and @jlison ! For the benefit of those who see this thread, I've recorded the entire process for getting NightmareJS working on CentOS. I've also included a precompiled gcc 6.3.0 libary. Check it out: http://endorkins.com/2017/04/26/running-nightmarejs-on-centos-6/

Hopefully this helps pay it forward a bit! :)