[Csnd-dev] plugins: illegal instruction
| Date | 2026-10-31 18:45 |
| From | James Hearon |
| Subject | [Csnd-dev] plugins: illegal instruction |
|
re: plugins(libbeosc, libklib, lipathtools, etc.) and getting "illegal instruction" after building or downloading linux binaries, I did further inspection using gdb and found my problem is the sources CMakeLists.txt is using AVX2, which my older processor doesn't
support.
if(LINUX AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|i[3-6]86|AMD64")
#addflag(-mavx2 HAS_AVX2) #causes illegal instruction error XXX for older cpus
if(HAS_AVX2)
message(STATUS "AVX2 enabled for Linux (x86)")
endif()
endif()
Also needed to add target_compile_options for each CMakeLists.txt for each library:
option(BUILD_BEOSC_OPCODES "Build beosc opcodes" ON)
if(BUILD_BEOSC_OPCODES)
make_plugin(beosc beosc.c)
target_compile_options(beosc PRIVATE -mno-avx2) #avoid building with AVX2
endif()
And is some cases a conditional general compiler directive:
make_plugin(else src/else.c)
#avoid building using AVX2
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(else PRIVATE -mno-avx2)
endif()
...then rebuilt and seems working.
|
| Date | 2026-10-31 19:22 | |||
| From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> | |||
| Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] plugins: illegal instruction | |||
|
Makes sense, we should fix CMakeLists.txt to allow for that.
Prof. Victor Lazzarini
Maynooth University
Ireland
On 31 Oct 2026, at 18:45, James Hearon <j_hearon@hotmail.com> wrote:
The information contained in this email may be confidential and privileged. It is intended only for the addressee(s) stated above. If you are not an addressee any use, dissemination, distribution, publication or copying of the information contained in this email is strictly prohibited. If you have received this email in error, please immediately notify us by email at dataprotection@mu.ie and delete this email from your system. Please note that Maynooth University is subject to Freedom of Information and Data Protection laws. We may be required to disclose the content of emails under the FOI Act 2014, the Data Protection Act 2018 or GDPR. Is don seolaí / do na seolaithe thuasluaite amháin an ríomhphost seo. D’fhéadfadh an t-eolas atá ann a bheith rúnda agus faoi phribhléid. Mura seolaí tú, tá cosc iomlán ar aon eolas atá sa ríomhphost seo a úsáid, a scaipeadh, a dháileadh, a fhoilsiú nó a chóipeáil. Má fuair tú an ríomhphost seo trí thimpiste, cuir sin in iúl dúinn láithreach trí ríomhphost a chur chuig dataprotection@mu.ie agus scrios an ríomhphost seo ó do chóras. Tabhair faoi deara go bhfuil Ollscoil Mhá Nuad faoi réir dhlíthe um Shaoráil Faisnéise agus um Chosaint Sonraí. D’fhéadfadh ceangal a bheith orainn ábhar ríomhphoist a nochtadh faoin Acht um Shaoráil Faisnéise 2014, faoin Acht um Chosaint Sonraí 2018 nó faoi GDPR. Registered charity number 20037130
|
| Date | 2026-10-31 19:51 | |||
| From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> | |||
| Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] plugins: illegal instruction | |||
|
Ok I got all confused because you said 'plugins' and mentioned the plugins from csound/plugins. However I see your problem is nothing to do with the csound/plugins repository but with csound/csound.
This problem looks like the csound library being built with -mavx2 globally, rather than a problem specific to the external plugin repository.
libbeosc, libklib, and lipathtools are Csound opcode libraries, not part of the separate csound/plugins repository.
In Csound 7.0.0, USE_AVX2 defaults to ON (CMakeLists.txt line 236), and lines 474–502 add -mavx2 to the global C and C++ flags. That allows every translation unit, including opcode libraries, to contain AVX2 instructions. There is no runtime CPU check, so a
pre-AVX2 CPU raises SIGILL at the first such instruction.
The target-level -mno-avx2 workaround works because target options are appended after the global flags, but patching each library is fragile. It does not cover dependencies or flags injected through CFLAGS/CXXFLAGS, it does not work on MSVC, and it only disables
AVX2 rather than other possible instruction requirements.
On current develop, commit f5bac72c0 makes AVX2 an explicit opt-in: USE_AVX2 defaults to OFF. CI also builds with the default and runs under QEMU with a Nehalem CPU, which has SSE2 but no AVX or AVX2, to catch this regression.
That fix is not in tag 7.0.0, so 7.0.0 source builds and release binaries still have AVX2 enabled by default. Here's what you should do
1) When building 7.0.0 from source, configure with -DUSE_AVX2=OFF. If reusing an existing build directory, set it explicitly and verify it took effect:
2) When using downloaded 7.0.0 binaries, use a build from current develop or the next release containing the fix. Rebuilding only the plugin libraries will not remove AVX2 from the Csound core binaries.
Or, alternatively, just build from the latest develop. There is nothing to be done from our end.
========================================
Prof. Victor Lazzarini
Director
Maynooth University Arts and Humanities Institute
From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of James Hearon <j_hearon@HOTMAIL.COM>
Sent: Saturday 31 October 2026 18:45 To: CSOUND-DEV@LISTSERV.HEANET.IE <CSOUND-DEV@LISTSERV.HEANET.IE> Subject: [EXTERNAL] [Csnd-dev] plugins: illegal instruction
*Warning*This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
re: plugins(libbeosc, libklib, lipathtools, etc.) and getting "illegal instruction" after building or downloading linux binaries, I did further inspection using gdb and found my problem is the sources CMakeLists.txt is using AVX2, which my older processor doesn't
support.
if(LINUX AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|i[3-6]86|AMD64")
#addflag(-mavx2 HAS_AVX2) #causes illegal instruction error XXX for older cpus
if(HAS_AVX2)
message(STATUS "AVX2 enabled for Linux (x86)")
endif()
endif()
Also needed to add target_compile_options for each CMakeLists.txt for each library:
option(BUILD_BEOSC_OPCODES "Build beosc opcodes" ON)
if(BUILD_BEOSC_OPCODES)
make_plugin(beosc beosc.c)
target_compile_options(beosc PRIVATE -mno-avx2) #avoid building with AVX2
endif()
And is some cases a conditional general compiler directive:
make_plugin(else src/else.c)
#avoid building using AVX2
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(else PRIVATE -mno-avx2)
endif()
...then rebuilt and seems working.
The information contained in this email may be confidential and privileged. It is intended only for the addressee(s) stated above. If you are not an addressee any use, dissemination, distribution, publication or copying of the information contained in this email is strictly prohibited. If you have received this email in error, please immediately notify us by email at dataprotection@mu.ie and delete this email from your system. Please note that Maynooth University is subject to Freedom of Information and Data Protection laws. We may be required to disclose the content of emails under the FOI Act 2014, the Data Protection Act 2018 or GDPR. Is don seolaí / do na seolaithe thuasluaite amháin an ríomhphost seo. D’fhéadfadh an t-eolas atá ann a bheith rúnda agus faoi phribhléid. Mura seolaí tú, tá cosc iomlán ar aon eolas atá sa ríomhphost seo a úsáid, a scaipeadh, a dháileadh, a fhoilsiú nó a chóipeáil. Má fuair tú an ríomhphost seo trí thimpiste, cuir sin in iúl dúinn láithreach trí ríomhphost a chur chuig dataprotection@mu.ie agus scrios an ríomhphost seo ó do chóras. Tabhair faoi deara go bhfuil Ollscoil Mhá Nuad faoi réir dhlíthe um Shaoráil Faisnéise agus um Chosaint Sonraí. D’fhéadfadh ceangal a bheith orainn ábhar ríomhphoist a nochtadh faoin Acht um Shaoráil Faisnéise 2014, faoin Acht um Chosaint Sonraí 2018 nó faoi GDPR. Registered charity number 20037130
|