Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 605958

Summary: media-libs/opensubdiv-3.1.1: nvcc fatal : Stray '"' character
Product: Gentoo Linux Reporter: Jura <me>
Component: Current packagesAssignee: Jonathan Scruggs (RETIRED) <dracwyrm>
Status: RESOLVED FIXED    
Severity: normal CC: agrigo2001, creideiki+gentoo-bugzilla, me, proxy-maint
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log
opensubdiv-3.1.1-skip-osd-regression.patch
build.log after patching
Remove the quotes around the version string that trips up newer versions of cmake

Description Jura 2017-01-17 09:08:42 UTC
Created attachment 460432 [details]
build.log

Can't update media-libs/opensubdiv-3.1.0 -> media-libs/opensubdiv-3.1.1, compile error:

nvcc fatal   : Stray '"' character
CMake Error at osd_static_gpu_generated_cudaKernel.cu.o.Gentoo.cmake:224 (message):
  Error generating
  /var/tmp/portage/media-libs/opensubdiv-3.1.1/work/opensubdiv-3.1.1_build/opensubdiv/CMakeFiles/osd_static_gpu.dir/osd/./osd_static_gpu_generated_cudaKernel.cu.o
Comment 1 brothermechanic 2017-01-23 19:15:17 UTC
same for me

emerge --info
https://paste.pound-python.org/show/uK0XelOY7qyspvWbiJrU/
Comment 2 Jonathan Scruggs (RETIRED) gentoo-dev 2017-01-23 23:48:39 UTC
Looks like this has to do with CUDA. I'll see if Adrian can debug this.
Comment 3 Adrian 2017-01-24 01:15:18 UTC
I will look at this on the weekend.
Comment 4 Jonathan Scruggs (RETIRED) gentoo-dev 2017-01-24 08:18:28 UTC
What version of GGC and CUDA toolkits are you two using?
Comment 5 Jura 2017-01-24 08:21:43 UTC
sys-devel/gcc-5.4.0-r2
dev-util/nvidia-cuda-toolkit-8.0.44
Comment 6 Jonathan Scruggs (RETIRED) gentoo-dev 2017-01-24 08:38:58 UTC
(In reply to Adrian from comment #3)
> I will look at this on the weekend.

Adrian, found this upstream bug: nvcc fatal : Stray '"' character
Same error at the end. They were able to use CMake 3.5.0, but OpenSubDiv was able to compile.
Comment 7 Jonathan Scruggs (RETIRED) gentoo-dev 2017-01-24 09:40:08 UTC
Created attachment 461144 [details, diff]
opensubdiv-3.1.1-skip-osd-regression.patch

Hey all,

Can you try something for me?

# mkdir -p /etc/portage/patches/media-libs/opensubdiv-3.1.1/

Then copy the attached patch with the same name as the description of it to that newly made directory

# emerge =opensubdiv-3.1.1

Then let me know if it succeeds.

NOTE to Adrian, if this works then that means that Regression is compiling even through I hard disabled it as upstream is supposed to be fixing the issue that you needed the patch for.
Comment 8 Jonathan Scruggs (RETIRED) gentoo-dev 2017-01-27 15:47:55 UTC
Did the patch that I posted work for anyone?

Thanks.
Comment 9 Jura 2017-01-27 17:10:09 UTC
Created attachment 461618 [details]
build.log after patching

Patch not work for me
Comment 10 Bluey The Dog 2017-01-28 09:55:53 UTC
I tried the patch as Jon requested and it still failed to build. I got basically the same build log as Jura, nvcc fatal : Stray '"' character.

I'm also running the same versions of gcc & nvidia as Jura.
Comment 11 Adrian 2017-01-30 11:59:47 UTC
The error also occurs for me and is not resolved by the patch.

I was able to manually compile after editing the generated CMakefiles for osd_*.gpu to remove all the \".

I think a patch to fix the quoting of the options to nvcc should resolve the issue, will post it here once I have completed it.
Comment 12 Adrian 2017-02-01 14:01:08 UTC
Created attachment 462088 [details, diff]
Remove the quotes around the version string that trips up newer versions of cmake

CMakeLists.txt creates a definition for OPENSUBDIV_VERSION_STRING in which the version string is quoted e.g.
OPENSUBDIV_VERSION_STRING="3.x.x"

Code generated by the CMake module FindCUDA transforms this into an improperly quoted semicolon separated list:
set(CUDA_NVCC_COMPILE_DEFINITIONS "OPENSUBDIV_VERSION_STRING="3.x.x";OPENSUBDIV ... ")

This variable is then used to create a command line to compile the cuda kernel, but the processing results in dangling quotes and compilation fails. The current version of FindCUDA code was introduced upstream around 5 months ago (commit 6442709b). Reportedly older versions of CMake (eg 3.5.0) work without issue.

By removing the quotes from the version string on creation, newer versions of CMake are able to process the list of compiler definitions correctly and compilation succeeds.

Upstream is aware of this issue and has created an internal ticket for it. So there may be an alternative fix available at a later date.
Comment 13 Jonathan Scruggs (RETIRED) gentoo-dev 2017-02-01 14:58:28 UTC
Adrian, would you be able to post your patch idea in the upstream bug report to see what they say about it, if you haven't already? It affects Windows as well, so it's a vital fix. You don't need a pull request, just copy and paste the text in a comment using a code block. 

Cheers.
Comment 14 Adrian 2017-02-01 23:24:21 UTC
I have submitted the patch upstream for review.

While doing so I did some further testing and found that the FindCUDA module changes were merged into CMake 3.7.0. The last version of CMake that compiles opensubdiv without the patch is 3.6.3.
Comment 15 Adrian 2017-03-17 01:12:46 UTC
My patch fixes the stray " character issue, but fails if users compile the examples as OPENSUBDIV_VERSION_STRING is no longer actually a string. I have submitted additional corrections upstream to integrate it properly using string tokenisation where necessary.

If we need to allow users to build the examples then we should integrate these additional changes into opensubdiv, otherwise we can just mask the examples until the issue is corrected upstream.
Comment 16 Brian L 2017-05-01 20:20:35 UTC
Here's a patch I found online doesn't remove the osd_regression and compiles and works.  Confirmed working took me awhile to find this as the current patch didn't work for me from here.

mkdir -p /etc/portage/patches/media-libs/opensubdiv-3.1.1/

--- a/CMakeLists.txt	2017-02-01 23:20:22.590219192 +1100
+++ b/CMakeLists.txt	2017-02-01 23:19:59.923600152 +1100
@@ -48,7 +48,7 @@
     string(REGEX REPLACE "^v" "" OSD_SONAME ${OSD_SONAME})
 
     add_definitions(
-        -DOPENSUBDIV_VERSION_STRING="${OSD_SONAME}"
+        -DOPENSUBDIV_VERSION_STRING=${OSD_SONAME}
     )
 
 #-------------------------------------------------------------------------------
Comment 17 Karl-Johan Karlsson 2017-06-19 20:55:46 UTC
The patch in comment 16 fixes the improper quotes for me.

Versions:
sys-devel/gcc-6.3.0
dev-util/nvidia-cuda-toolkit-8.0.61
media-libs/opensubdiv-3.1.1

So now I get far enough to see that CUDA doesn't work with GCC 6, but that's another bug...
Comment 18 Larry the Git Cow gentoo-dev 2017-09-23 08:38:13 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=072d9adafab829b7f934637f7ba8a8f29c2ea3db

commit 072d9adafab829b7f934637f7ba8a8f29c2ea3db
Author:     Jonathan Scruggs <j.scruggs@gmail.com>
AuthorDate: 2017-09-21 09:14:47 +0000
Commit:     David Seifert <soap@gentoo.org>
CommitDate: 2017-09-23 08:36:15 +0000

    media-libs/opensubdiv: Version bump to 3.3 and remove ati-drivers
    
    * Fixed compile error about stray quotes
    * Changed hardcoded paths to GNUInstallDirs which
      fixed multilib-strict check fail
    
    Closes: https://bugs.gentoo.org/605958
    Closes: https://bugs.gentoo.org/611844
    Closes: https://github.com/gentoo/gentoo/pull/5751

 media-libs/opensubdiv/Manifest                     |  1 +
 .../files/opensubdiv-3.3.0-fix-quotes.patch        | 13 +++++
 .../opensubdiv-3.3.0-use-gnuinstalldirs.patch      | 39 ++++++++++++++
 media-libs/opensubdiv/opensubdiv-3.1.0.ebuild      |  2 -
 media-libs/opensubdiv/opensubdiv-3.1.1.ebuild      |  9 +++-
 media-libs/opensubdiv/opensubdiv-3.3.0.ebuild      | 63 ++++++++++++++++++++++
 6 files changed, 123 insertions(+), 4 deletions(-)