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

Link failure with clang 9 #1069

Closed
sambler opened this issue Oct 18, 2019 · 5 comments
Closed

Link failure with clang 9 #1069

sambler opened this issue Oct 18, 2019 · 5 comments

Comments

@sambler
Copy link
Contributor

sambler commented Oct 18, 2019

Problem

Actual behavior:

Linking a binary to liboslexec.so gives undefined reference error

/usr/local/bin/ld: src/liboslexec/liboslexec.so.1.10.7:
undefined reference to `llvm::cfg::Update<llvm::BasicBlock*>::dump() const'

full build log

Building 1.10.7 with clang 9.0 has a linking issue.
Clang 8.0.1 works, the only change made is to use clang 9.0.
Master builds with clang 9.0 but I can't seem to find the right change.

Steps to Reproduce

Use clang 9 to build 1.10.7
Same with LLVM 8.0 and LLVM 9.0 - the llvm::cfg only exists in >=8

Versions

  • OSL branch/version: 1.10.7
  • OS: FreeBSD 12
  • C++ compiler: clang 9.0
  • LLVM version: 1.10.7
  • OIIO version: 2.0.11
@jcelerier
Copy link

jcelerier commented Dec 22, 2019

I have the same issue in another project using LLVM (Faust) - it sounds like a LLVM / clang issue

@lgritz
Copy link
Collaborator

lgritz commented Dec 27, 2019

I'm not sure how to fix this on our end, we don't appear to directly reference it in any of our code.

There is an llvm 9.0.1 that was released last week. Maybe that contains a fix for this?

If OSL master works but not 1.10... I know it's a lot of work (and I would do it myself if I could repro the problem), but maybe you could pick some intermediate commits on the master branch and see if you can narrow down exactly which commit fixed it? There should only be a few candidates, since whatever changed would have to be in one of the few files where we have sequestered all the direct llvm calls. I think that

$ git log src/liboslexec/llvm_util.cpp src/liboslexec/backendllvm.* src/cmake/modules/FindLLVM.cmake

ought to identify all possible commits that might have contained the fix (maybe a dozen or so since 1.10 branched, and probably several can be dismissed trivially by inspection -- having touched those files but not made any relevant changes).

@sambler
Copy link
Contributor Author

sambler commented Jan 6, 2020

Sooo.... after comparing some log files, I found the following fixed this for me.

CXXFLAGS+= -DNDEBUG

It looks like the osl build normally puts this in place, but the FreeBSD ports build system manages to eliminate it. Either way it makes the variation that works for clang 9

@lgritz
Copy link
Collaborator

lgritz commented Jan 6, 2020

The FreeBSD ports system eliminates it?

That seems bad, as this macro might be broadly used to switch between slow debugging behavior and more performant behavior expected from an optimized build. It is definitely expected to be set for optimized production release builds.

@lgritz
Copy link
Collaborator

lgritz commented Jan 7, 2020

Closing since there appears to have been a problem with a fix on @sambler's side.

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

No branches or pull requests

3 participants