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

Add support for IPOPT on Mac by pinning to a specific GCC version. #4970

Closed

Conversation

david-german-tri
Copy link
Contributor

@david-german-tri david-german-tri commented Jan 30, 2017

This makes it possible to locate libgfortran.a on Mac, since Homebrew doesn't install or symlink it to a canonical location. It would be much better to use pkg-config, but Homebrew doesn't install a .pc file. It would also be much better to interrogate gfortran directly, as IPOPT itself does, but Bazel apparently provides no mechanism to use the results of a shell command as linker arguments to a cc_library rule.

@soonho-tri for feature review; could you test locally please?

@jamiesnape @BetsyMcPhail The OS X images in CI should be updated to pin gcc 5.4, instead of tracking the head of gcc. Aside and apart from the Bazel issue, I think it's saner to use a version of gfortran on Mac that's consistent with the project's other uses of gcc.

Also, if anyone knows of a way to make brew pin more precise, that would be great.


This change is Reviewable

@soonho-tri
Copy link
Member

@soonho-tri for feature review; could you test locally please?

Sure. BTW, I don't see the reviewable link here.

@soonho-tri
Copy link
Member

Never mind. Just created!

@soonho-tri
Copy link
Member

Review status: 0 of 3 files reviewed at latest revision, 1 unresolved discussion.


a discussion (no related file):
I have the following error on my mac:

$ bazel test //... -c dbg
WARNING: /private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/drake_visualizer/BUILD:2:48: soft_failure.bzl: @drake_visualizer//:drake-visualizer does not work because /Users/soonhok/work/drake-distro/build/install/bin/drake-visualizer was missing.
ERROR: /private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/ipopt/BUILD:121:36: name 'HOMEBREW_GFORTRAN_PATH' is not defined.
ERROR: /private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/ipopt/BUILD:134:27: Traceback (most recent call last):
	File "/private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/ipopt/BUILD", line 127
		cc_library(name = "lib", srcs = IPOPT_LIBS, hdr..., <5 more arguments>)
	File "/private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/ipopt/BUILD", line 132, in cc_library
		select({"//config:linux": LINKOPTS_LINU...})
	File "/private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/ipopt/BUILD", line 134, in select
		LINKOPTS_APPLE
name 'LINKOPTS_APPLE' is not defined.
ERROR: /Users/soonhok/work/drake-distro/drake/solvers/BUILD:175:1: no such target '@ipopt//:lib': target 'lib' not declared in package '' defined by /private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/ipopt/BUILD and referenced by '//drake/solvers:ipopt_solver'.
WARNING: /private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/protobuf_python/protobuf.bzl:90:19: Variables HOST_CFG and DATA_CFG are deprecated in favor of strings "host" and "data" correspondingly.
WARNING: /private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/protobuf_python/protobuf.bzl:96:28: Variables HOST_CFG and DATA_CFG are deprecated in favor of strings "host" and "data" correspondingly.
ERROR: Analysis of target '//drake/systems/trajectory_optimization:direct_collocation' failed; build aborted.
INFO: Elapsed time: 2.971s
ERROR: Couldn't start the build. Unable to run tests.

Comments from Reviewable

@soonho-tri
Copy link
Member

Review status: 0 of 3 files reviewed at latest revision, 1 unresolved discussion.


a discussion (no related file):

Previously, soonho-tri (Soonho Kong) wrote…

I have the following error on my mac:

$ bazel test //... -c dbg
WARNING: /private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/drake_visualizer/BUILD:2:48: soft_failure.bzl: @drake_visualizer//:drake-visualizer does not work because /Users/soonhok/work/drake-distro/build/install/bin/drake-visualizer was missing.
ERROR: /private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/ipopt/BUILD:121:36: name 'HOMEBREW_GFORTRAN_PATH' is not defined.
ERROR: /private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/ipopt/BUILD:134:27: Traceback (most recent call last):
	File "/private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/ipopt/BUILD", line 127
		cc_library(name = "lib", srcs = IPOPT_LIBS, hdr..., <5 more arguments>)
	File "/private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/ipopt/BUILD", line 132, in cc_library
		select({"//config:linux": LINKOPTS_LINU...})
	File "/private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/ipopt/BUILD", line 134, in select
		LINKOPTS_APPLE
name 'LINKOPTS_APPLE' is not defined.
ERROR: /Users/soonhok/work/drake-distro/drake/solvers/BUILD:175:1: no such target '@ipopt//:lib': target 'lib' not declared in package '' defined by /private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/ipopt/BUILD and referenced by '//drake/solvers:ipopt_solver'.
WARNING: /private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/protobuf_python/protobuf.bzl:90:19: Variables HOST_CFG and DATA_CFG are deprecated in favor of strings "host" and "data" correspondingly.
WARNING: /private/var/tmp/_bazel_soonhok/51e1ef8bb59598000e1968965dd33f03/external/protobuf_python/protobuf.bzl:96:28: Variables HOST_CFG and DATA_CFG are deprecated in favor of strings "host" and "data" correspondingly.
ERROR: Analysis of target '//drake/systems/trajectory_optimization:direct_collocation' failed; build aborted.
INFO: Elapsed time: 2.971s
ERROR: Couldn't start the build. Unable to run tests.

On another mac, it works well.


Comments from Reviewable

@david-german-tri
Copy link
Contributor Author

Yeah, sorry, I also am having difficulties after making changes based on the Slack conversation. Stay tuned.

@soonho-tri
Copy link
Member

No need to sorry at all. Thanks a lot for the hard work!!


Review status: 0 of 3 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.


Comments from Reviewable

This makes it possible to locate the Fortran libraries.
@drake-jenkins-bot
Copy link

Jenkins build failed

@david-german-tri
Copy link
Contributor Author

david-german-tri commented Jan 31, 2017

I'm closing this - @jwnimmer-tri has made a better suggestion, namely to use a repository rule. I'd somehow forgotten repository rules could capture shell command outputs.

@drake-jenkins-bot
Copy link

Jenkins build failed

@drake-jenkins-bot
Copy link

Jenkins build passed

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

Successfully merging this pull request may close these issues.

3 participants