Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 739474 - media-gfx/blender: Fails to build with musl
Summary: media-gfx/blender: Fails to build with musl
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Adrian
URL: https://developer.blender.org/D8588
Whiteboard:
Keywords: PATCH, PullRequest
Depends on:
Blocks: musl-porting
  Show dependency tree
 
Reported: 2020-08-29 02:19 UTC by tonemgub
Modified: 2022-09-01 02:06 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
The __linux__ check is causing the HAVE_MALLOC_STATS to be evaluated as true (blender-3.2.2-malloc_stats-musl.patch,634 bytes, patch)
2022-08-14 09:17 UTC, listout
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tonemgub 2020-08-29 02:19:12 UTC
Building blender with musl currently fails. Void Linux patch resolves the issue. Bug also filed at upstream URL.


Reproducible: Always
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-02-26 02:21:45 UTC
Please provide the build.log of it failing if it's still an issue.

But latest version of the patch: https://raw.githubusercontent.com/void-linux/void-packages/master/srcpkgs/blender/patches/0001-musl-fixes.patch
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-02-26 02:22:18 UTC
(In reply to Sam James from comment #2)
> Please provide the build.log of it failing if it's still an issue.
> 
> But latest version of the patch:
> https://raw.githubusercontent.com/void-linux/void-packages/master/srcpkgs/
> blender/patches/0001-musl-fixes.patch

We can try push this through upstream but I'd need a log first (or motivation to build it myself on musl) to verify the patch.
Comment 4 listout 2022-08-14 09:15:24 UTC
the __linux__ check is causing the issue. I was able to fix it with the following patch

```diff
diff --git a/intern/guardedalloc/intern/mallocn_intern.h b/intern/guardedalloc/intern/mallocn_intern.h
index f8b16ff..a5783d1 100644
--- a/intern/guardedalloc/intern/mallocn_intern.h
+++ b/intern/guardedalloc/intern/mallocn_intern.h
@@ -17,8 +17,7 @@
 #undef HAVE_MALLOC_STATS
 #define USE_MALLOC_USABLE_SIZE /* internal, when we have malloc_usable_size() */
 
-#if defined(__linux__) || (defined(__FreeBSD_kernel__) && !defined(__FreeBSD__)) || \
-    defined(__GLIBC__)
+#if (defined(__FreeBSD_kernel__) && !defined(__FreeBSD__)) || defined(__GLIBC__)
 #  include <malloc.h>
 #  define HAVE_MALLOC_STATS
 #elif defined(__FreeBSD__)
```
Comment 5 listout 2022-08-14 09:17:27 UTC
Created attachment 799577 [details, diff]
The __linux__ check is causing the HAVE_MALLOC_STATS to be evaluated as true
Comment 6 listout 2022-08-14 09:19:23 UTC
Looks like blender need some other patches too, for musl. I'll make a PR once ready
Comment 7 Larry the Git Cow gentoo-dev 2022-09-01 02:06:25 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=07f1954e0dd0fb941be3396f15257793f791b23a

commit 07f1954e0dd0fb941be3396f15257793f791b23a
Author:     brahmajit das <listout@protonmail.com>
AuthorDate: 2022-08-23 15:39:17 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-09-01 02:01:54 +0000

    media-gfx/blender: Upstream musl libc fixes backport
    
    These are some of the patch that I submitted upstream and have been
    accepted. They will be a part of next blender release. However, this PR
    is a backport of those fixes for blender 3.2.2.
    
    Please refer:
    https://github.com/blender/blender/commit/f197b1a1f1bbc0334310fb1c911327246767a1a3, and
    https://github.com/blender/blender/commit/7be7280c5710f7831789cdde140d010722be9068
    
    Closes: https://bugs.gentoo.org/739474
    
    Signed-off-by: brahmajit das <listout@protonmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/26860
    Signed-off-by: Sam James <sam@gentoo.org>

 media-gfx/blender/blender-3.2.2.ebuild             |   5 +
 .../files/blender-3.2.2-musl-glibc-prereq.patch    |  27 ++++
 ...der-3.2.2-support-building-with-musl-libc.patch | 177 +++++++++++++++++++++
 3 files changed, 209 insertions(+)