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

cmd/link: error in linker when building go-opencv on OSX #6283

Closed
gopherbot opened this issue Aug 29, 2013 · 8 comments
Closed

cmd/link: error in linker when building go-opencv on OSX #6283

gopherbot opened this issue Aug 29, 2013 · 8 comments

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Aug 29, 2013

by ngaloppo:

What steps will reproduce the problem?

Build go-opencv as such: 
go build -a -x code.google.com/p/go-opencv/trunk/opencv

What is the expected output?
Successful build of the opencv package

What do you see instead?
Assertion failure in the linker: 
ld: Assertion failed: (_machoSection != 0), function machoSection, file
/SourceCache/ld64/ld64-136/src/ld/ld.hpp, line 641.

This is when running: 
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -o
$WORK/code.google.com/p/go-opencv/trunk/opencv/_obj/_all.o
$WORK/code.google.com/p/go-opencv/trunk/opencv/_obj/_cgo_export.o
$WORK/code.google.com/p/go-opencv/trunk/opencv/_obj/cv.cgo2.o
$WORK/code.google.com/p/go-opencv/trunk/opencv/_obj/cvaux.cgo2.o
$WORK/code.google.com/p/go-opencv/trunk/opencv/_obj/cxcore.cgo2.o
$WORK/code.google.com/p/go-opencv/trunk/opencv/_obj/cxtype.cgo2.o
$WORK/code.google.com/p/go-opencv/trunk/opencv/_obj/highgui.cgo2.o
$WORK/code.google.com/p/go-opencv/trunk/opencv/_obj/opencv.o
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_calib3d.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_contrib.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_core.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_features2d.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_flann.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_gpu.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_highgui.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_imgproc.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_legacy.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_ml.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_nonfree.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_objdetect.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_ocl.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_photo.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_stitching.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_superres.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_ts.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_video.dylib
/usr/local/Cellar/opencv/2.4.5/lib/libopencv_videostab.dylib -Wl,-r -nostdlib
/usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1/x86_64/libgcc.a

These warnings from ld are interesting: 

ld: warning: unexpected dylib
(/usr/local/Cellar/opencv/2.4.5/lib/libopencv_calib3d.dylib) on link line
ld: warning: unexpected dylib
(/usr/local/Cellar/opencv/2.4.5/lib/libopencv_contrib.dylib) on link line
ld: warning: unexpected dylib (/usr/local/Cellar/opencv/2.4.5/lib/libopencv_core.dylib)
on link line
ld: warning: unexpected dylib
(/usr/local/Cellar/opencv/2.4.5/lib/libopencv_features2d.dylib) on link line
ld: warning: unexpected dylib (/usr/local/Cellar/opencv/2.4.5/lib/libopencv_flann.dylib)
on link line
ld: warning: unexpected dylib (/usr/local/Cellar/opencv/2.4.5/lib/libopencv_gpu.dylib)
on link line
ld: warning: unexpected dylib
(/usr/local/Cellar/opencv/2.4.5/lib/libopencv_highgui.dylib) on link line
ld: warning: unexpected dylib
(/usr/local/Cellar/opencv/2.4.5/lib/libopencv_imgproc.dylib) on link line
ld: warning: unexpected dylib
(/usr/local/Cellar/opencv/2.4.5/lib/libopencv_legacy.dylib) on link line
ld: warning: unexpected dylib (/usr/local/Cellar/opencv/2.4.5/lib/libopencv_ml.dylib) on
link line
ld: warning: unexpected dylib
(/usr/local/Cellar/opencv/2.4.5/lib/libopencv_nonfree.dylib) on link line
ld: warning: unexpected dylib
(/usr/local/Cellar/opencv/2.4.5/lib/libopencv_objdetect.dylib) on link line
ld: warning: unexpected dylib (/usr/local/Cellar/opencv/2.4.5/lib/libopencv_ocl.dylib)
on link line
ld: warning: unexpected dylib (/usr/local/Cellar/opencv/2.4.5/lib/libopencv_photo.dylib)
on link line
ld: warning: unexpected dylib
(/usr/local/Cellar/opencv/2.4.5/lib/libopencv_stitching.dylib) on link line
ld: warning: unexpected dylib
(/usr/local/Cellar/opencv/2.4.5/lib/libopencv_superres.dylib) on link line
ld: warning: unexpected dylib (/usr/local/Cellar/opencv/2.4.5/lib/libopencv_ts.dylib) on
link line
ld: warning: unexpected dylib (/usr/local/Cellar/opencv/2.4.5/lib/libopencv_video.dylib)
on link line
ld: warning: unexpected dylib
(/usr/local/Cellar/opencv/2.4.5/lib/libopencv_videostab.dylib) on link line

I found that removing the $LDFLAGS as below successfully results in building:

gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -o
$WORK/code.google.com/p/go-opencv/trunk/opencv/_obj/_all.o
$WORK/code.google.com/p/go-opencv/trunk/opencv/_obj/_cgo_export.o
$WORK/code.google.com/p/go-opencv/trunk/opencv/_obj/cv.cgo2.o
$WORK/code.google.com/p/go-opencv/trunk/opencv/_obj/cvaux.cgo2.o
$WORK/code.google.com/p/go-opencv/trunk/opencv/_obj/cxcore.cgo2.o
$WORK/code.google.com/p/go-opencv/trunk/opencv/_obj/cxtype.cgo2.o
$WORK/code.google.com/p/go-opencv/trunk/opencv/_obj/highgui.cgo2.o
$WORK/code.google.com/p/go-opencv/trunk/opencv/_obj/opencv.o  -Wl,-r -nostdlib
/usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1/x86_64/libgcc.a


Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
OSX

Which version are you using?  (run 'go version')
1.1.2

Please provide any additional information below: 

Full output of "go build -a -x code.google.com/p/go-opencv/trunk/opencv"
attached.

Attachments:

  1. _all.o-2013-07-29-105717.ld-snapshot.zip (43304 bytes)
  2. build.log (38175 bytes)
@robpike
Copy link
Contributor

@robpike robpike commented Aug 31, 2013

Comment 1:

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

@rsc
Copy link
Contributor

@rsc rsc commented Nov 27, 2013

Comment 2:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

@rsc rsc commented Dec 4, 2013

Comment 3:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

@rsc rsc commented Dec 4, 2013

Comment 4:

Labels changed: added repo-main.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title cmd/ld: error in linker when building go-opencv on OSX cmd/link: error in linker when building go-opencv on OSX Jun 8, 2015
@gsymons
Copy link

@gsymons gsymons commented Oct 16, 2018

code.google.com/p/go-opencv/trunk/opencv has moved to https://github.com/chai2010/opencv, but it still fail. As the last update of the repo is Jun 13, 2015, maybe https://github.com/hybridgroup/gocv will be a good alternative.

@odeke-em
Copy link
Member

@odeke-em odeke-em commented Jun 6, 2020

@gsymons thank you for the updates. I kindly ask: could you please try it on Go1.14 but also on gotip aka the latest tree as we've had updates to the linker in the couple of years.

@gsymons
Copy link

@gsymons gsymons commented Jul 2, 2020

@odeke-em I suggest closing this issue as the problem could not be reproduced now. And https://github.com/chai2010/opencv latest version only supports old OpenCV 1.1 which is 4.3.0 now.

@odeke-em
Copy link
Member

@odeke-em odeke-em commented Jul 2, 2020

Thank you for the ping @gsymons, sure I shall close it.

@odeke-em odeke-em closed this Jul 2, 2020
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
5 participants
You can’t perform that action at this time.