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

Error when make opencv2 : /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to `g_option_group_unref' #7940

Closed
ndinhtuan opened this issue Dec 29, 2016 · 18 comments

Comments

@ndinhtuan
Copy link

System information (version)
  • OpenCV => ❔
  • Operating System / Platform => ❔
  • Compiler => ❔
Detailed description

Hi,
Like title, when I run 'make' in opencv folder, then terminal throw some error :
[ 26%] Linking CXX executable ../../bin/opencv_test_imgproc
//usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to g_option_group_unref' //usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to g_thread_pool_move_to_front'
//usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to `g_sequence_is_empty'
collect2: error: ld returned 1 exit status

What should I do ? Thanks . :D

Steps to reproduce
@alalek
Copy link
Member

alalek commented Dec 29, 2016

What should I do ?

You should provide more relevant information: CMake log (stdout), information about used Linux, failed command line (via make VERBOSE=1), etc.

@wangg12
Copy link

wangg12 commented Feb 18, 2017

same question here. @theiron97 have you solved it?

@yanjunx
Copy link

yanjunx commented Mar 5, 2017

Hi, I just found a link that help solve my problem.
https://groups.google.com/forum/#!msg/caffe-users/Tc2ov81Nqec/iHfVyxwdCAAJ
When I added the Makefile.config file in the folder with Makefile to set Anaconda path and python path, OpenCV can be made correctly.

@01lin
Copy link

01lin commented Jun 23, 2017

@yanjunx you have solve this problem ? How to do ? I donot know your mean

@01lin
Copy link

01lin commented Jun 23, 2017

@theiron97 have you solve problem??

@yanjunx
Copy link

yanjunx commented Jun 23, 2017

Hi @01lin , if you also install Anaconda on your Linux, this problem was caused by not setting up the Anaconda and python path for OpenCV. You can download the Makefile.config file in the link and add it to your OpenCV folder along with the Makefile.

@01lin
Copy link

01lin commented Jun 23, 2017

@yanjunx thanks for your reply, but where to download Makefile.config file ?

@01lin
Copy link

01lin commented Jun 23, 2017

@yanjunx i am sorry , i am a beginner...thanks

@yanjunx
Copy link

yanjunx commented Jun 23, 2017

@01lin not a big deal. It can be downloaded from google group's link I posted before.

@01lin
Copy link

01lin commented Jun 23, 2017

@yanjunx //usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to g_option_group_unref'
i have download Makefile.config file ,and add it to OpenCV/release folder along with the Makefile. But it doesnot work. please give me some advice ,thanks,I am looking forwarded to have your reply.Your kind heart will be appreciated

@01lin
Copy link

01lin commented Jun 23, 2017

@yanjunx My problem is solved through another way- (conda install opencv) . Thanks for your reply.You are so kind. Thank you!!!

@reginalluna
Copy link

@yanjunx My problem is solved through another way- (conda install opencv). Thanks for your reply. You are so kind. Thank you!!
Will it be available to fix by this way? I also saw a solution of removing libgio-2.0.so.0 from ~/anaconda3/lib/ and copying the same file from /usr/lib/x86_64-linux-gnu/ . The test is running, and... hmm, it seems ok to me.


Ok, I think I passed this bug by the solution I mentioned above.

My hands are shaking... It works;

@Net-Maker
Copy link

Hey!

I have been struggling with this problem for several days now! I even ended up deleting some libraries, which ended up causing damage to my Ubuntu system. It took me another whole day to fix it! Haha... it was a frustrating experience!

The actual reason behind this issue is that "{$anaconda}/lib/libgio-2.0xxx" has a different version compared to "/usr/lib/{$arch}/libgio-2.0xxx", and as a result, cmake is unable to locate it. To resolve this, you can try creating a symbolic link. If your error message mentions "/usr/lib/${arch}", you should remove the libgio-2.0xxx file from that location and create a symbolic link to "{$anaconda}/lib/libgio-2.0xxx" instead.

This solution should work for both OpenCV and OpenPose. If you need further clarification or more details, please feel free to ask. I apologize for any limitations in my English expression.

@ZYJ-DE-GIT
Copy link

嘿!

我已经被这个问题困扰好几天了!我什至最终删除了一些库,这对我的 Ubuntu 系统造成了损坏。我又花了一整天的时间才把它修好!哈哈……真是一次令人沮丧的经历!

这个问题背后的实际原因是“{$anaconda}/lib/libgio-2.0xxx”与“/usr/lib/{$arch}/libgio-2.0xxx”相比具有不同的版本,因此,cmake无法找到它要解决此问题,您可以尝试创建符号链接。如果您的错误消息提到“/usr/lib/${arch}”,您应该从该位置创建删除 libgio-2.0xxx 文件,并添加一个指向“{ $anaconda}/lib/libgio-2.0xxx”的符号链接。

该解决方案限制应适用于 OpenCV 和 OpenPose。如果您需要进一步说明或更多详细信息,请随时询问。对于我的英语表达上的任何内容,我深表歉意。

这对我非常有帮助,我的错误消息提到了{$anaconda}/lib/libgio-2.0xxx”有问题,于是我检查了anaconda/myenv/lib,然后将这三个libgio-2.0.so、libgio-2.0.so.0、libgio-2.0.so.0.6901.0删除后,系统便可以正确的自动从usr/lib下链接了,感谢!

@Net-Maker
Copy link

同学你好,这一个解决方案其实也有一些问题,你的ubuntu桌面可能会出bug,或者你的系统在下一次重启的时候会取消掉你之前的操作。引起这个问题真正的原因其实是conda,我建议更好的解决方案是让你的cmake正确连接到anaconda的lib,我最近才学会这一方法,很抱歉没法提供进一步的指导,你可以通过google来学习这个链接过程。

@mbadinga1
Copy link

Hello,
I got the same troubles and I tried with conda install opencv without success ! Any Help?

@blackHorz
Copy link

Hey!

I have been struggling with this problem for several days now! I even ended up deleting some libraries, which ended up causing damage to my Ubuntu system. It took me another whole day to fix it! Haha... it was a frustrating experience!

The actual reason behind this issue is that "{$anaconda}/lib/libgio-2.0xxx" has a different version compared to "/usr/lib/{$arch}/libgio-2.0xxx", and as a result, cmake is unable to locate it. To resolve this, you can try creating a symbolic link. If your error message mentions "/usr/lib/${arch}", you should remove the libgio-2.0xxx file from that location and create a symbolic link to "{$anaconda}/lib/libgio-2.0xxx" instead.

This solution should work for both OpenCV and OpenPose. If you need further clarification or more details, please feel free to ask. I apologize for any limitations in my English expression.

Would you please explain to noobs like us, How you have created a symbolic there?

@Net-Maker
Copy link

Hey!
I have been struggling with this problem for several days now! I even ended up deleting some libraries, which ended up causing damage to my Ubuntu system. It took me another whole day to fix it! Haha... it was a frustrating experience!
The actual reason behind this issue is that "{$anaconda}/lib/libgio-2.0xxx" has a different version compared to "/usr/lib/{$arch}/libgio-2.0xxx", and as a result, cmake is unable to locate it. To resolve this, you can try creating a symbolic link. If your error message mentions "/usr/lib/${arch}", you should remove the libgio-2.0xxx file from that location and create a symbolic link to "{$anaconda}/lib/libgio-2.0xxx" instead.
This solution should work for both OpenCV and OpenPose. If you need further clarification or more details, please feel free to ask. I apologize for any limitations in my English expression.

Would you please explain to noobs like us, How you have created a symbolic there?

Using my own system as an example: {$arch} = x86-64
First, check /usr/lib/{$arch}/libgio-2.0.so: "ls -l /usr/lib/x86-64/libgio-2.0.so*"
Then, multiple files will appear, among which there will definitely be a libgio-2.0.so. This is a symbolic link file, and you will see a "->" that indicates the file it points to, which has the same name but with version information appended.
Next, what you need to do is to find the anaconda folder's lib/ directory, and in there, find another libgio-2.0.so.o and the file it points to.
Delete the symbolic link file under /usr/lib, then use the ln -s command (please Google the usage of this command) to create a symbolic link file of the same name that points to the file indicated by the anaconda/lib's symbolic link file.
Another more effective method is to have your cmake compilation use the system lib to directly point to the anaconda's lib folder, but I cannot provide assistance on this method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants