Error during the installation of SVM-light - linux

I am trying to install SVM-Light on the cluster that I am working on but I got the following error:
svm_hideo.o:(.bss+0x38): multiple definition of `verbosity'; svm_common.o:(.bss+0x8): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:59: svm_learn_hideo] Error 1
The steps that I have done for the installation are the following (I followed this tutorial):
wget https://download.joachims.org/svm_light/current/svm_light.tar.gz
gunzip -c svm_light.tar.gz | tar xvf -
ls
kernel.h Makefile svm_common.c svm_hideo.c svm_learn.h svm_light.tar.gz
LICENSE.txt svm_classify.c svm_common.h svm_learn.c svm_learn_main.c svm_loqo.c
make
gcc -c -O3 svm_learn_main.c -o svm_learn_main.o
gcc -c -O3 svm_learn.c -o svm_learn.o
gcc -c -O3 svm_common.c -o svm_common.o
svm_common.c: In function ‘read_model’:
svm_common.c:600:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
600 | fscanf(modelfl,"SVM-light Version %s\n",version_buffer);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:605:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
605 | fscanf(modelfl,"%ld%*[^\n]\n", &model->kernel_parm.kernel_type);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:606:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
606 | fscanf(modelfl,"%ld%*[^\n]\n", &model->kernel_parm.poly_degree);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:607:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
607 | fscanf(modelfl,"%lf%*[^\n]\n", &model->kernel_parm.rbf_gamma);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:608:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
608 | fscanf(modelfl,"%lf%*[^\n]\n", &model->kernel_parm.coef_lin);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:609:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
609 | fscanf(modelfl,"%lf%*[^\n]\n", &model->kernel_parm.coef_const);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:610:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
610 | fscanf(modelfl,"%[^#]%*[^\n]\n", model->kernel_parm.custom);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:612:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
612 | fscanf(modelfl,"%ld%*[^\n]\n", &model->totwords);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:613:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
613 | fscanf(modelfl,"%ld%*[^\n]\n", &model->totdoc);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:614:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
614 | fscanf(modelfl,"%ld%*[^\n]\n", &model->sv_num);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:615:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
615 | fscanf(modelfl,"%lf%*[^\n]\n", &model->b);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:623:5: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
623 | fgets(line,(int)ll,modelfl);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -c -O3 svm_hideo.c -o svm_hideo.o
gcc -O3 svm_learn_main.o svm_learn.o svm_common.o svm_hideo.o -o svm_learn -L. -lm
/mnt/netapp1/Optcesga_FT2_RHEL7/2020/gentoo/22072020/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: svm_hideo.o:(.bss+0x38): multiple definition of `verbosity'; svm_common.o:(.bss+0x8): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:59: svm_learn_hideo] Error 1
I have even tried to install it with conda, but without no success.
conda create myenv
conda activate myenv
conda install -c bioconda svmlight
conda list
# packages in environment:
#
# Name Version Build Channel
_libgcc_mutex 0.1 main
_openmp_mutex 5.1 1_gnu
libgcc-ng 11.2.0 h1234567_1
libgomp 11.2.0 h1234567_1
svmlight 6.02 hec16e2b_4 bioconda
But when I check if the package was installed sucessfully... it is not found.
python
Python 3.9.7 (default, Sep 16 2021, 13:09:58)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import svmlight
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /home/.local/lib/python3.9/site-packages/svmlight.cpython-39-x86_64-linux-gnu.so: undefined symbol: PyCObject_Check
I also tried to install it using different ways:
conda install -c "bioconda/label/cf201901" svmlight
conda install -c bioconda svmlight
pip install svmlight
pip install --no-cache-dir --upgrade svmlight
But nothing...
Is there anybody who knows how to solve it?
Thanks in advance

Solution:
In order to install svm-light, it is necessary to install gcc 8.5.0 using the following code:
conda create myenv
conda activate myenv
conda install -c conda-forge gcc=8.5.0

Bioconda packages are built with a very specific channel specification, namely:
# .condarc
channels:
- conda-forge
- bioconda
- defaults
In order to properly use any Bioconda package, one must adhere to that channel specification. That is, the package should be installed like
## note that one can give packages to the `create` command
conda create -n myenv -c conda-forge -c bioconda svmlight
Also, note that there are two packages, svmlight, which is the compiled C++ library, and pysvmlight, which is a Python wrapper (only supports Python 2.7).

Related

"error: requested alignment '20' is not a positive power of 2" in "__aligned(sizeof(struct __call_single_data));"

I am trying to compile https://github.com/varigit/linux-imx.git for ARCH=arm64 with CROSS_COMPILE=arm-none-eabi-, but I get the error
linux-imx$ make
warning: ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum
warning: LSE atomics not supported by binutils
In file included from ././include/linux/compiler_types.h:65,
from <command-line>:
./include/linux/smp.h:34:26: error: requested alignment '20' is not a positive power of 2
34 | __aligned(sizeof(struct __call_single_data));
| ^~~~~~~~~~~~~~~~~~
./include/linux/compiler_attributes.h:33:68: note: in definition of macro '__aligned'
33 | #define __aligned(x) __attribute__((__aligned__(x)))
| ^
In file included from ./arch/arm64/include/asm/thread_info.h:17,
from ./include/linux/thread_info.h:60,
from ./arch/arm64/include/asm/preempt.h:5,
from ./include/linux/preempt.h:78,
from ./include/linux/smp.h:110,
from ./include/linux/lockdep.h:14,
from ./include/linux/mutex.h:17,
from ./include/linux/kernfs.h:12,
from ./include/linux/sysfs.h:16,
from ./include/linux/kobject.h:20,
from ./include/linux/of.h:17,
from ./include/linux/irqdomain.h:35,
from ./include/linux/acpi.h:13,
from ./include/acpi/apei.h:9,
from ./include/acpi/ghes.h:5,
from ./include/linux/arm_sdei.h:8,
from arch/arm64/kernel/asm-offsets.c:10:
./arch/arm64/include/asm/memory.h: In function 'kaslr_offset':
./arch/arm64/include/asm/memory.h:62:33: warning: left shift count >= width of type [-Wshift-count-overflow]
62 | #define _PAGE_END(va) (-(UL(1) << ((va) - 1)))
| ^~
followed by pages and pages of follow-up errors.
searching online didn't bring up anything. The first two lines are clearly warnings.
the toolchain was wrong, arm-none-eabi- is neither for building linux nor for 64bit. apt-get install gcc-10-aarch64-linux-gnu, CROSS_COMPILE=aarch64-linux-gnu- and sudo ln -s /usr/bin/aarch64-linux-gnu-gcc-10 /usr/bin/aarch64-linux-gnu-gcc was enough.

compiling and cpu architecture error for apple despite being on an ubuntu?

I'm trying to compile something from a github branch. I'm on an ubuntu.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
with the following configuration.
❯ rustup -V
rustup 1.24.3 (ce5817a94 2021-05-31)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.61.0-nightly (d53246fed 2022-03-25)`
❯ cargo -V
cargo 1.61.0-nightly (109bfbd 2022-03-17)
❯ rustup default
nightly-x86_64-unknown-linux-gnu (default)
however when trying to compile I get this error.
error: no rules expected the token `aarch64_apple`
--> /home/ahdee/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/src/cpu.rs:257:13
|
165 | macro_rules! features {
| --------------------- when calling this macro
...
257 | aarch64_apple: true,
| ^^^^^^^^^^^^^ no rules expected this token in macro call
error[E0425]: cannot find value `AES` in module `cpu::arm`
--> /home/ahdee/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/src/aead/aes.rs:381:65
|
381 | if cpu::intel::AES.available(cpu_features) || cpu::arm::AES.available(cpu_features) {
| ^^^ not found in `cpu::arm`
|
help: consider importing this constant
|
15 | use crate::cpu::intel::AES;
|
error[E0425]: cannot find value `PMULL` in module `cpu::arm`
--> /home/ahdee/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/src/aead/gcm.rs:315:26
|
315 | || cpu::arm::PMULL.available(cpu_features)
| ^^^^^ not found in `cpu::arm`
error[E0425]: cannot find value `ARMCAP_STATIC` in this scope
--> /home/ahdee/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/src/cpu.rs:235:41
|

Issue installing any Python version 3.8+ since macOS Monterey update

Prior to the Monterey update, I had a fairly stable method of running x86 versions of Python (3.8, and 3.10) on my M1 Mac by adapting these instructions (basically, arch -x86_64 brew to install x86 versions of Python dependencies and using arch -x86_64 pyenv to install Python).
Since Monterey, whenever I try to install a different version of Python 3.8+ (e.g. 3.9.11), I get this error:
BUILD FAILED (OS X 12.3 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/q6/w2pgnv455zx_swdp919_zsww0000gn/T/python-build.20220324065050.66757
Results logged to /var/folders/q6/w2pgnv455zx_swdp919_zsww0000gn/T/python-build.20220324065050.66757.log
Last 10 log lines:
"_libintl_textdomain", referenced from:
_PyIntl_textdomain in libpython3.9.a(_localemodule.o)
_PyIntl_textdomain in libpython3.9.a(_localemodule.o)
ld: symbol(s) not found for architecture x86_64
ld: symbol(s) not found for architecture x86_64
clang: clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Programs/_testembed] Error 1
make: *** Waiting for unfinished jobs....
make: *** [python.exe] Error 1
I am struggling to find anything significant in the corresponding config.log (top lines included):
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by python configure 3.9, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure --prefix=/Users/joshualee/.pyenv/versions/3.9.11_x86 --libdir=/Users/joshualee/.pyenv/versions/3.9.11_x86/lib --with-openssl=/opt/homebrew/opt/openssl#1.1
## --------- ##
## Platform. ##
## --------- ##
hostname = Macbook-Pro-2.local
uname -m = x86_64
uname -r = 21.4.0
uname -s = Darwin
uname -v = Darwin Kernel Version 21.4.0: Mon Feb 21 20:35:58 PST 2022; root:xnu-8020.101.4~2/RELEASE_ARM64_T6000
/usr/bin/uname -p = i386
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = Mach kernel version:
Darwin Kernel Version 21.4.0: Mon Feb 21 20:35:58 PST 2022; root:xnu-8020.101.4~2/RELEASE_ARM64_T6000
Kernel configured for up to 10 processors.
10 processors are physically available.
10 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1 2 3 4 5 6 7 8 9
Primary memory available: 16.00 gigabytes
Default processor set: 515 tasks, 2684 threads, 10 processors
Load average: 2.49, Mach factor: 7.50
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /opt/homebrew/Cellar/pyenv/2.2.5/libexec
PATH: /opt/homebrew/Cellar/pyenv/2.2.5/plugins/python-build/bin
PATH: /Users/joshualee/.pyenv/shims
PATH: /opt/homebrew/bin
PATH: /opt/homebrew/sbin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /Users/joshualee/.local/bin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2860: checking build system type
configure:2874: result: x86_64-apple-darwin21.4.0
configure:2894: checking host system type
configure:2907: result: x86_64-apple-darwin21.4.0
configure:2937: checking for python3.9
configure:2967: result: no
configure:2937: checking for python3
configure:2953: found /Users/joshualee/.pyenv/shims/python3
configure:2964: result: python3
configure:3058: checking for --enable-universalsdk
configure:3105: result: no
configure:3129: checking for --with-universal-archs
configure:3144: result: no
configure:3300: checking MACHDEP
configure:3351: result: "darwin"
configure:3645: checking for gcc
configure:3672: result: clang
configure:3901: checking for C compiler version
configure:3910: clang --version >&5
Apple clang version 13.1.6 (clang-1316.0.21.2)
Target: x86_64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:3921: $? = 0
configure:3910: clang -v >&5
Apple clang version 13.1.6 (clang-1316.0.21.2)
Target: x86_64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:3921: $? = 0
configure:3910: clang -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:3921: $? = 1
configure:3910: clang -qversion >&5
clang: error: unknown argument '-qversion'; did you mean '--version'?
clang: error: no input files
configure:3921: $? = 1
configure:3941: checking whether the C compiler works
configure:3963: clang -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl#3/include -I/usr/local/opt/xz/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/joshualee/.pyenv/versions/3.9.11_x86/lib -L/usr/local/opt/openssl#3/lib -L/usr/local/opt/xz/lib -L/opt/homebrew/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib conftest.c >&5
ld: warning: directory not found for option '-L/Users/joshualee/.pyenv/versions/3.9.11_x86/lib'
configure:3967: $? = 0
configure:4015: result: yes
configure:4018: checking for C compiler default output file name
configure:4020: result: a.out
configure:4026: checking for suffix of executables
configure:4033: clang -o conftest -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl#3/include -I/usr/local/opt/xz/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/joshualee/.pyenv/versions/3.9.11_x86/lib -L/usr/local/opt/openssl#3/lib -L/usr/local/opt/xz/lib -L/opt/homebrew/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib conftest.c >&5
ld: warning: directory not found for option '-L/Users/joshualee/.pyenv/versions/3.9.11_x86/lib'
configure:4037: $? = 0
configure:4059: result:
configure:4081: checking whether we are cross compiling
configure:4089: clang -o conftest -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl#3/include -I/usr/local/opt/xz/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/joshualee/.pyenv/versions/3.9.11_x86/lib -L/usr/local/opt/openssl#3/lib -L/usr/local/opt/xz/lib -L/opt/homebrew/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib conftest.c >&5
ld: warning: directory not found for option '-L/Users/joshualee/.pyenv/versions/3.9.11_x86/lib'
configure:4093: $? = 0
configure:4100: ./conftest
configure:4104: $? = 0
configure:4119: result: no
configure:4124: checking for suffix of object files
configure:4146: clang -c -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl#3/include -I/usr/local/opt/xz/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include conftest.c >&5
configure:4150: $? = 0
configure:4171: result: o
configure:4175: checking whether we are using the GNU C compiler
configure:4194: clang -c -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl#3/include -I/usr/local/opt/xz/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include conftest.c >&5
configure:4194: $? = 0
configure:4203: result: yes
configure:4212: checking whether clang accepts -g
configure:4232: clang -c -g -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include conftest.c >&5
configure:4232: $? = 0
configure:4273: result: yes
configure:4290: checking for clang option to accept ISO C89
configure:4353: clang -c -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl#3/include -I/usr/local/opt/xz/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include conftest.c >&5
configure:4353: $? = 0
configure:4366: result: none needed
configure:4391: checking how to run the C preprocessor
configure:4422: clang -E -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include conftest.c
configure:4422: $? = 0
configure:4436: clang -E -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include conftest.c
conftest.c:8:10: fatal error: 'ac_nonexistent.h' file not found
#include <ac_nonexistent.h>
^~~~~~~~~~~~~~~~~~
1 error generated.
configure:4436: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define _GNU_SOURCE 1
| #define _NETBSD_SOURCE 1
| #define __BSD_VISIBLE 1
| #define _DARWIN_C_SOURCE 1
| #define _PYTHONFRAMEWORK ""
| /* end confdefs.h. */
| #include <ac_nonexistent.h>
configure:4461: result: clang -E
configure:4481: clang -E -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include conftest.c
configure:4481: $? = 0
configure:4495: clang -E -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include conftest.c
conftest.c:8:10: fatal error: 'ac_nonexistent.h' file not found
#include <ac_nonexistent.h>
^~~~~~~~~~~~~~~~~~
1 error generated.
configure:4495: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define _GNU_SOURCE 1
| #define _NETBSD_SOURCE 1
| #define __BSD_VISIBLE 1
| #define _DARWIN_C_SOURCE 1
| #define _PYTHONFRAMEWORK ""
| /* end confdefs.h. */
| #include <ac_nonexistent.h>
configure:4523: checking for grep that handles long lines and -e
configure:4581: result: /usr/bin/grep
configure:4586: checking for a sed that does not truncate output
configure:4650: result: /usr/bin/sed
configure:4658: checking for --with-cxx-main=<compiler>
configure:4684: result: no
configure:4933: checking for clang++
configure:4966: result: no
configure:5202:
By default, distutils will build C++ extension modules with "clang++".
If this is not intended, then set CXX on the configure command line.
configure:5211: checking for the platform triplet based on compiler characteristics
configure:5361: result: darwin
configure:5369: checking for multiarch
configure:5381: result:
configure:5398: checking for -Wl,--no-as-needed
configure:5414: clang -o conftest -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl#3/include -I/usr/local/opt/xz/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/joshualee/.pyenv/versions/3.9.11_x86/lib -L/usr/local/opt/openssl#3/lib -L/usr/local/opt/xz/lib -L/opt/homebrew/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -Wl,--no-as-needed conftest.c >&5
ld: warning: directory not found for option '-L/Users/joshualee/.pyenv/versions/3.9.11_x86/lib'
ld: unknown option: --no-as-needed
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:5414: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define _GNU_SOURCE 1
| #define _NETBSD_SOURCE 1
| #define __BSD_VISIBLE 1
| #define _DARWIN_C_SOURCE 1
| #define _PYTHONFRAMEWORK ""
| /* end confdefs.h. */
Things I have tried:
re-installing xcode command line tools
re-installing with brew (and arch brew -x86_64) pyenv pre-requisites: openssl, readling, sqlite3 etc.
different CFLAGS and LDFLAGS (I can't remember which but largely, pointing to x86 folders for openssl, zlib, readline, etc.)
I am still fairly new to using M1 Macs so any guidance would be much appreciated.
The solution was to
install gettext library with arch -x86_64 /usr/local/bin/brew install gettext
add path to gettext to pyenv CFLAGS and LDFLAGS in your .zshrc file. (Usually it's at ~/.zshrc)
export LDFLAGS="-L/usr/local/opt/gettext/lib"
export CPPFLAGS="-I/usr/local/opt/gettext/include"
restart terminal

espeak-ng cross compile make install issue

I am trying to cross compile espeak-ng for target=arm-linux-gnueabihf
The sudo make install step gives the following error :
~:~/Downloads/Dependencies/espeak-ng-master$ sudo make install
[sudo] password for abc:
ESPEAK_DATA_PATH=../Downloads/Dependencies/espeak-ng-master src/espeak-ng --compile-intonations && \
ESPEAK_DATA_PATH=../Downloads/Dependencies/espeak-ng-master src/espeak-ng --compile-phonemes && \
touch phsource/phonemes.stamp
src/espeak-ng: line 117: ../Downloads/Dependencies/espeak-ng-master/src/.libs/espeak-ng: cannot execute binary file: Exec format error
src/espeak-ng: line 117: ../Downloads/Dependencies/espeak-ng-master/src/.libs/espeak-ng: Success
Makefile:2590: recipe for target 'phsource/phonemes.stamp' failed
make: *** [phsource/phonemes.stamp] Error 126
I have cross compiled using the following :
./configure CC=arm-linux-gnueabihf-gcc -prefix /opt/myproject-sysroot/usr --build=$MACHTYPE --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
make -B src/speak-ng src/espeak-ng
Configure output
Configuration for eSpeak NG complete.
Source code location: .
C99 Compiler: arm-linux-gnueabihf-gcc
C99 Compiler flags: -Wunused-parameter -Wunused -Wuninitialized -Wreturn-type -Wmissing-prototypes -Wimplicit -g -O2 -std=c99
Sonic: no
PCAudioLib: no
gradle (Android): gradle
ndk-build (Android):
Klatt: yes
MBROLA: yes
Async: yes
Extended Dictionaries:
Russian: no
Chinese (Mandarin): no
Chinese (Cantonese): no
~/Downloads/Dependencies/ESPEAK/espeak-ng-master$ sudo make -B src/speak-ng src/espeak-ng
Output for make command:
---------------
-----------
CC src/libespeak-ng/src_libespeak_ng_la-tr_languages.lo
CC src/libespeak-ng/src_libespeak_ng_la-voices.lo
CC src/libespeak-ng/src_libespeak_ng_la-wavegen.lo
src/libespeak-ng/wavegen.c: In function ‘WavegenFill’:
src/libespeak-ng/wavegen.c:1400:17: warning: variable ‘p_start’ set but not used [-Wunused-but-set-variable]
unsigned char *p_start;
^~~~~~~
CC src/libespeak-ng/src_libespeak_ng_la-klatt.lo
CC src/libespeak-ng/src_libespeak_ng_la-mbrowrap.lo
CC src/libespeak-ng/src_libespeak_ng_la-espeak_command.lo
CC src/libespeak-ng/src_libespeak_ng_la-event.lo
CC src/libespeak-ng/src_libespeak_ng_la-fifo.lo
CCLD src/libespeak-ng.la
arm-linux-gnueabihf-ar: `u' modifier ignored since `D' is the default (see `U')
CCLD src/speak-ng
CC src/espeak-ng.o
src/espeak-ng.c: In function ‘main’:
src/espeak-ng.c:744:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
fread(p_text, 1, filesize, f_text);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CCLD src/espeak-ng
Make install output
~/Downloads/Dependencies/ESPEAK/espeak-ng-master$ sudo make LIBDIR=/opt/myproject-sysroot/usr install
ESPEAK_DATA_PATH=../Downloads/Dependencies/ESPEAK/espeak-ng-master src/espeak-ng --compile-intonations && \
ESPEAK_DATA_PATH=../Downloads/Dependencies/ESPEAK/espeak-ng-master src/espeak-ng --compile-phonemes && \
touch phsource/phonemes.stamp
src/espeak-ng: line 117: ../Downloads/Dependencies/ESPEAK/espeak-ng-master/src/.libs/espeak-ng: cannot execute binary file: Exec format error
src/espeak-ng: line 117: ../Downloads/Dependencies/ESPEAK/espeak-ng-master/src/.libs/espeak-ng: Success
Makefile:2590: recipe for target 'phsource/phonemes.stamp' failed
make: *** [phsource/phonemes.stamp] Error 126

"undef. ref. to XX" and readelf shows "XX UND"

I'm trying to cross compile usb_modeswitch for mips. The compilation worked successfully but it fails at runtime!
# ./usb_modeswitch -W -c zoom_modem_switch
...
./usb_modeswitch: symbol lookup error: /umx/lib/libusb-0.1.so.4: undefined symbol: libusb_init
However, readelf seems to see the function but with the "UND" as Ndx value, what does it mean? Undefined? So why is it listed here if not defined ?
$ ${CROSS_COMPILE}readelf -s libusb-0.1.so.4 | grep libusb_init
54: 000037b0 0 FUNC GLOBAL DEFAULT UND libusb_init
115: 000037b0 0 FUNC GLOBAL DEFAULT UND libusb_init
Very frustrating! What am I missing ?

Resources