Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 571228 - sys-libs/libomp on ABI=x32 - runtime/src/z_Linux_util.c:154:6: error: #error Wrong code for setaffinity system call
Summary: sys-libs/libomp on ABI=x32 - runtime/src/z_Linux_util.c:154:6: error: #error ...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Bernard Cafarelli
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: x32
  Show dependency tree
 
Reported: 2016-01-07 23:05 UTC by Bertrand Jacquin
Modified: 2022-07-26 07:33 UTC (History)
8 users (show)

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


Attachments
build.log (build.log,52.95 KB, text/x-log)
2016-01-07 23:05 UTC, Bertrand Jacquin
Details
emerge --info (info.log,16.31 KB, text/x-log)
2016-01-07 23:06 UTC, Bertrand Jacquin
Details
experimental x32 patch (libomp-3.9.1-x32.patch,58.36 KB, patch)
2017-02-23 00:23 UTC, Steven Newbury
Details | Diff
patch for sys-libs/libomp-5.0.1 for building on x32 (libomp-5.0.1-x32.patch,1.25 KB, patch)
2018-01-31 10:40 UTC, Martin 'The Bishop' Scheffler
Details | Diff
patch for sys-libs/libomp-5.0.1 for building on x32 (version 2) (libomp-5.0.1-x32-v2.patch,2.43 KB, patch)
2018-02-01 12:41 UTC, Martin 'The Bishop' Scheffler
Details | Diff
patch for sys-libs/libomp-6.0.9999 for building on x32 (version 3) (libomp-gentoo.patch,50.43 KB, patch)
2018-02-01 20:44 UTC, Martin 'The Bishop' Scheffler
Details | Diff
patch to sys-libs/libomp-6.0.9999 for building on x32 (version 3b) (libomp-gentoo.patch,50.37 KB, patch)
2018-02-01 20:56 UTC, Martin 'The Bishop' Scheffler
Details | Diff
An updated patch for libomp-14.0.4 (x32.patch,47.31 KB, patch)
2022-07-25 11:42 UTC, Kenny Cheng
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bertrand Jacquin 2016-01-07 23:05:23 UTC
Building sys-libs/libomp-3.7.0 for ABI=x32 fail with the following error:

[24/36] /usr/bin/x86_64-pc-linux-gnux32-gcc  -Domp_EXPORTS -Iruntime/src -I/var/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src -I/var/tmp/
portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/i18n -I/var/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/include/41 -I/v
ar/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/thirdparty/ittnotify  -DNDEBUG -march=native -O2 -pipe -fomit-frame-pointer  -fPIC   -D 
USE_ITT_BUILD -D KMP_ARCH_STR="\"Intel(R) 64\"" -D BUILD_I8 -D KMP_LIBRARY_FILE=\"libomp.so\" -D KMP_VERSION_MAJOR=5 -D KMP_NESTED_HOT_TEAMS -D CACHE_LINE=64 -
D KMP_ADJUST_BLOCKTIME=1 -D BUILD_PARALLEL_ORDERED -D KMP_ASM_INTRINS -D USE_ITT_NOTIFY=1 -D INTEL_ITTNOTIFY_PREFIX=__kmp_itt_ -D KMP_USE_VERSION_SYMBOLS -D _G
NU_SOURCE -D _REENTRANT -D BUILD_TV -D USE_CBLKDATA -D KMP_GOMP_COMPAT -D USE_LOAD_BALANCE -D KMP_TDATA_GTID -D KMP_USE_ASSERT -D KMP_DYNAMIC_LIB -D KMP_STATS_
ENABLED=0 -D USE_DEBUGGER=0 -D OMPT_SUPPORT=0 -D OMPT_BLAME=1 -D OMPT_TRACE=1 -D OMP_50_ENABLED=0 -D OMP_41_ENABLED=1 -D OMP_40_ENABLED=1 -D OMP_30_ENABLED=1 -
D KMP_USE_ADAPTIVE_LOCKS=1 -D KMP_DEBUG_ADAPTIVE_LOCKS=0 -D KMP_USE_INTERNODE_ALIGNMENT=0  -DNDEBUG -std=c++11 -fno-exceptions -Wno-sign-compare -Wno-unused-fu
nction -Wno-unused-value -Wno-unused-variable -Wno-switch -Wno-unknown-pragmas -Wno-missing-field-initializers -Wno-missing-braces -Wno-comment -x c++ -MMD -MT
 runtime/src/CMakeFiles/omp.dir/kmp_ftn_cdecl.c.o -MF runtime/src/CMakeFiles/omp.dir/kmp_ftn_cdecl.c.o.d -o runtime/src/CMakeFiles/omp.dir/kmp_ftn_cdecl.c.o -c
 /var/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/kmp_ftn_cdecl.c
FAILED: /usr/bin/x86_64-pc-linux-gnux32-gcc  -Domp_EXPORTS -Iruntime/src -I/var/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src -I/var/tmp/
portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/i18n -I/var/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/include/41 -I/v
ar/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/thirdparty/ittnotify  -DNDEBUG -march=native -O2 -pipe -fomit-frame-pointer  -fPIC   -D 
USE_ITT_BUILD -D KMP_ARCH_STR="\"Intel(R) 64\"" -D BUILD_I8 -D KMP_LIBRARY_FILE=\"libomp.so\" -D KMP_VERSION_MAJOR=5 -D KMP_NESTED_HOT_TEAMS -D CACHE_LINE=64 -
D KMP_ADJUST_BLOCKTIME=1 -D BUILD_PARALLEL_ORDERED -D KMP_ASM_INTRINS -D USE_ITT_NOTIFY=1 -D INTEL_ITTNOTIFY_PREFIX=__kmp_itt_ -D KMP_USE_VERSION_SYMBOLS -D _G
NU_SOURCE -D _REENTRANT -D BUILD_TV -D USE_CBLKDATA -D KMP_GOMP_COMPAT -D USE_LOAD_BALANCE -D KMP_TDATA_GTID -D KMP_USE_ASSERT -D KMP_DYNAMIC_LIB -D KMP_STATS_
ENABLED=0 -D USE_DEBUGGER=0 -D OMPT_SUPPORT=0 -D OMPT_BLAME=1 -D OMPT_TRACE=1 -D OMP_50_ENABLED=0 -D OMP_41_ENABLED=1 -D OMP_40_ENABLED=1 -D OMP_30_ENABLED=1 -
D KMP_USE_ADAPTIVE_LOCKS=1 -D KMP_DEBUG_ADAPTIVE_LOCKS=0 -D KMP_USE_INTERNODE_ALIGNMENT=0  -DNDEBUG -std=c++11 -fno-exceptions -Wno-sign-compare -Wno-unused-fu
nction -Wno-unused-value -Wno-unused-variable -Wno-switch -Wno-unknown-pragmas -Wno-missing-field-initializers -Wno-missing-braces -Wno-comment -x c++ -MMD -MT
 runtime/src/CMakeFiles/omp.dir/z_Linux_util.c.o -MF runtime/src/CMakeFiles/omp.dir/z_Linux_util.c.o.d -o runtime/src/CMakeFiles/omp.dir/z_Linux_util.c.o -c /v
ar/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/z_Linux_util.c
/var/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/z_Linux_util.c:154:6: error: #error Wrong code for setaffinity system call.
 #    error Wrong code for setaffinity system call.
      ^
/var/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/z_Linux_util.c:159:6: error: #error Wrong code for getaffinity system call.
 #    error Wrong code for getaffinity system call.
      ^
In file included from /var/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/kmp_itt.h:23:0,
                 from /var/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/z_Linux_util.c:18:
/var/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/thirdparty/ittnotify/ittnotify.h:1761:28: warning: always_inline function might not be inlinable [-Wattributes]
 ITT_INLINE __itt_id ITTAPI __itt_id_make(void* addr, unsigned long long extra)
                            ^
In file included from /var/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/thirdparty/ittnotify/ittnotify_static.c:27:0:
/var/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/thirdparty/ittnotify/ittnotify.h:1761:28: warning: always_inline function might not be inlinable [-Wattributes]
 ITT_INLINE __itt_id ITTAPI __itt_id_make(void* addr, unsigned long long extra)
                            ^
In file included from /var/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/thirdparty/ittnotify/ittnotify_static.c:11:0:
/var/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/thirdparty/ittnotify/ittnotify_config.h:301:17: warning: always_inline function might not be inlinable [-Wattributes]
 ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
                 ^
/var/tmp/portage/sys-libs/libomp-3.7.0/work/openmp-3.7.0.src/runtime/src/thirdparty/ittnotify/ittnotify_config.h:286:17: warning: always_inline function might not be inlinable [-Wattributes]
 ITT_INLINE long __TBB_machine_fetchadd4(volatile void* ptr, long addend)
                 ^
ninja: build stopped: subcommand failed.
 * ERROR: sys-libs/libomp-3.7.0::gentoo failed (compile phase):
 *   (no error message)
 * 
 * Call stack:
 *     ebuild.sh, line  133:  Called src_compile
 *   environment, line 3480:  Called multilib-minimal_src_compile
 *   environment, line 2588:  Called multilib_foreach_abi 'multilib-minimal_abi_src_compile'
 *   environment, line 2819:  Called multibuild_foreach_variant '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_compile'
 *   environment, line 2523:  Called _multibuild_run '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_compile'
 *   environment, line 2521:  Called _multilib_multibuild_wrapper 'multilib-minimal_abi_src_compile'
 *   environment, line  600:  Called multilib-minimal_abi_src_compile
 *   environment, line 2582:  Called multilib_src_compile
 *   environment, line 3031:  Called cmake-utils_src_compile
 *   environment, line  850:  Called _execute_optionally 'src_compile'
 *   environment, line  396:  Called enable_cmake-utils_src_compile
 *   environment, line 1055:  Called cmake-utils_src_make
 *   environment, line  865:  Called ninja_src_make
 *   environment, line 3095:  Called die
 * The specific snippet of code:
 *       "$@" || die

Full build log attached as long as emerge --info


Reproducible: Always
Comment 1 Bertrand Jacquin 2016-01-07 23:05:52 UTC
Created attachment 422258 [details]
build.log
Comment 2 Bertrand Jacquin 2016-01-07 23:06:11 UTC
Created attachment 422260 [details]
emerge --info
Comment 3 Bernard Cafarelli gentoo-dev 2016-03-10 12:59:38 UTC
Thanks for the report!
I suppose ABI=x32 will have to be dropped from 3.7.* packages, unless the fix is easy. Does 3.8.0 work?
Comment 4 iGentoo 2016-10-03 10:51:33 UTC
/usr/include/asm/unistd_32.h:243:#define __NR_sched_setaffinity 241
/usr/include/asm/unistd_32.h:244:#define __NR_sched_getaffinity 242

/usr/include/asm/unistd_64.h:207:#define __NR_sched_setaffinity 203
/usr/include/asm/unistd_64.h:208:#define __NR_sched_getaffinity 204

/usr/include/asm/unistd.h:5:#define __X32_SYSCALL_BIT	0x40000000
/usr/include/asm/unistd_x32.h:185:#define __NR_sched_setaffinity (__X32_SYSCALL_BIT + 203)
/usr/include/asm/unistd_x32.h:186:#define __NR_sched_getaffinity (__X32_SYSCALL_BIT + 204)
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-11-20 22:36:58 UTC
Still happening with current git. I'll have to look at it eventually, I want to give LLVM a proper x32 support.
Comment 6 Steven Newbury 2017-02-23 00:23:51 UTC
Created attachment 464760 [details, diff]
experimental x32 patch

I've had a go at porting this one.  It compiles/emerges fine, not yet tested further.

I'm trying to bring up a x32 system again...
Comment 7 Martin 'The Bishop' Scheffler 2018-01-31 10:40:50 UTC
Created attachment 517226 [details, diff]
patch for sys-libs/libomp-5.0.1 for building on x32

The patch from last year for sys-libs/libomp-3.7.0 does not work because the code changed very much.
With this patch i was able to build and install sys-libs/libomp-5.0.1 .
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-01-31 11:03:52 UTC
Thanks for the patch. Does the test suite pass with it? Was it submitted upstream by any chance?
Comment 9 Martin 'The Bishop' Scheffler 2018-02-01 08:13:56 UTC
To answer your questions: no and no.
will look deeper into it...
Comment 10 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-02-01 08:38:44 UTC
Thanks a lot. In any case, if it's an improvement over the previous state (even if not reproduced in tests), it's worth submitting upstream. Please let me know if you need me to do that for you.
Comment 11 Martin 'The Bishop' Scheffler 2018-02-01 12:41:49 UTC
Created attachment 517358 [details, diff]
patch for sys-libs/libomp-5.0.1 for building on x32 (version 2)

I revisited my patch and added two more mods to silence one compiler warning and correct one test failing. On pure 64bit build one other test fails anyway so i did not edit out the very same failure on x32.

Could you give me a pointer how to send this to upstream?

p.s. one small assembly patch for x32 is in the gentoo build already, should this go to upstream too?
Comment 12 Martin 'The Bishop' Scheffler 2018-02-01 12:56:36 UTC
please disregard the "p.s." from before, this was from another package ;)
Comment 13 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-02-01 12:59:27 UTC
For a start, you'd need to rebase it against master/trunk. I think you shouldn't have problems building/testing it against LLVM 5.0.1 though. If you need me to test it with -9999, just let me know and I'll try it (I have x32-enabled compiler here).

This is the main doc on submitting patches:
https://llvm.org/docs/DeveloperPolicy.html

This one's if you're going to use Phabricator (I'd recommend that):
https://llvm.org/docs/Phabricator.html

Please add me (mgorny) as subscriber for any patches you submit. You can either ask whoever reviews them to commit them for you, or I can do that.
Comment 14 Martin 'The Bishop' Scheffler 2018-02-01 15:19:54 UTC
I did as instructed. Looks like libomp-7 is to be released soon, hope this fix gets into it before.
Comment 15 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-02-01 15:48:32 UTC
If you asked for docs, you should've read them ;-P. Make a patch with -U9999, and add openmp-commits as subscriber, and some reviewers from git/svn blame.
Comment 16 Martin 'The Bishop' Scheffler 2018-02-01 16:28:19 UTC
I've read your advice. Did dump the patch to upstream first, the rest will follow.
Comment 17 Martin 'The Bishop' Scheffler 2018-02-01 20:44:52 UTC
Created attachment 517494 [details, diff]
patch for sys-libs/libomp-6.0.9999 for building on x32 (version 3)

I realized the former patches did not cut it.
Now, X32 is implemented as distinct arch instead of a dirty hack to just make it compile.
Comment 18 Martin 'The Bishop' Scheffler 2018-02-01 20:56:57 UTC
Created attachment 517502 [details, diff]
patch to sys-libs/libomp-6.0.9999 for building on x32 (version 3b)

bug-bugfix.
Comment 19 Marcelo Teixeira Ruggeri 2019-06-09 17:21:31 UTC
Bug persists to day in all versions I tried: 6.0.1-r1, 7.1.0, 8.0.0.

I could only build it by commenting the malfunction '#ifndef' lines 
193 //#ifndef __NR_sched_setaffinity
194 #define __NR_sched_setaffinity 203
//...
198 //#ifndef __NR_sched_getaffinity
199 #define __NR_sched_getaffinity 204
//...
within '/var/tmp/portage/sys-libs/libomp-8.0.0/work/openmp-8.0.0.src/runtime/src/kmp_affinity.h'
Comment 20 Kenny Cheng 2022-07-25 11:42:40 UTC
Created attachment 794255 [details, diff]
An updated patch for libomp-14.0.4

Here is an updated patch for libomp-14.0.4 which based on previous patch.
Comment 21 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-26 07:33:44 UTC
(In reply to Kenny Cheng from comment #20)
> Created attachment 794255 [details, diff] [details, diff]
> An updated patch for libomp-14.0.4
> 
> Here is an updated patch for libomp-14.0.4 which based on previous patch.

Could you send the patch upstream? https://reviews.llvm.org/