nettle-3.0 and gmp-6.0.0 - undefined symbols "gmpz_limbs_write, gmpz_limbs_read..." - gmp

I am trying to compile nettle 3.0 with gmp 6.0.0 and I kept getting missing symbols:
Making all in tools
gcc -g -O2 -ggdb3 -Wno-pointer-sign -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wpointer-arith -Wbad-function-cast -Wnested-externs -L.. pkcs1-conv.o misc.o ../getopt.o ../getopt1.o -lhogweed -lnettle -lgmp -o pkcs1-conv
ld: warning: relocation error: R_386_32: file ../getopt.o: symbol optarg: external symbolic relocation against non-allocatable section .debug_info; cannot be processed at runtime: relocation ignored
Undefined first referenced
symbol in file
__gmpz_limbs_write ../libhogweed.so
__gmpz_limbs_finish ../libhogweed.so
__gmpz_limbs_modify ../libhogweed.so
__gmpn_zero ../libhogweed.so
__gmpz_roinit_n ../libhogweed.so
__gmpn_cnd_sub_n ../libhogweed.so
__gmpn_cnd_add_n ../libhogweed.so
__gmpz_limbs_read ../libhogweed.so
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `pkcs1-conv'
Current working directory /root/nettle-3.0/tools
I installed gmp 6.0.0 to /usr/local, then - in the nettle directory -, I ran ./configure --prefix=/usr/local, then make and got the error above.

It looks nettle is finding an older version first. Have you tried?
./configure --prefix=/usr/local --with-include-path=/usr/local/include --with-lib-path=/usr/local/lib
I found the options by using ./configure --help.

Related

Errors in p4est and cmake when install dealii

Can anyone help me with this issue?
In order to use dealii, I tried to install p4est using the command
./configure && make && make install
and
cmake .. -DP4EST_DIR=/usr/local -DDEAL_II_WITH_P4EST=ON -DDEAL_II_WITH_MPI=ON -DCMAKE_INSTALL_PREFIX=/usr/local
under "build" folder, but some error occurs.
I also opened the file dealii-9.0.0/build/CMakeFiles/CMakeError.log, it says:
Source file was:
int main() { return 0; }
Performing C++ SOURCE FILE Test rt_LIBRARY failed with the following output:
Change Dir: /Users/chuxiaoyun/Downloads/dealii-9.0.0/build/CMakeFiles/CMakeScratch/TryCompile-Fscvq9
Run Build Command(s):/usr/bin/make -f Makefile cmTC_bc7f9/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_bc7f9.dir/build.make CMakeFiles/cmTC_bc7f9.dir/build
Building CXX object CMakeFiles/cmTC_bc7f9.dir/src.cxx.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -Drt_LIBRARY -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -mmacosx-version-min=11.6 -MD -MT CMakeFiles/cmTC_bc7f9.dir/src.cxx.o -MF CMakeFiles/cmTC_bc7f9.dir/src.cxx.o.d -o CMakeFiles/cmTC_bc7f9.dir/src.cxx.o -c /Users/chuxiaoyun/Downloads/dealii-9.0.0/build/CMakeFiles/CMakeScratch/TryCompile-Fscvq9/src.cxx
Linking CXX executable cmTC_bc7f9
/opt/homebrew/Cellar/cmake/3.25.0/bin/cmake -E cmake_link_script CMakeFiles/cmTC_bc7f9.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -mmacosx-version-min=11.6 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_bc7f9.dir/src.cxx.o -o cmTC_bc7f9 -lrt
ld: library not found for -lrt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_bc7f9] Error 1
make: *** [cmTC_bc7f9/fast] Error 2
CMake Error at cmake/macros/macro_configure_feature.cmake:112 (MESSAGE):
Could not find the p4est library!
Insufficient p4est installation found!
p4est has to be configured with MPI enabled.
Please ensure that a suitable p4est library is installed on your computer.
If the library is not at a default location, either provide some hints for
autodetection,
$ P4EST_DIR="..." cmake <...>
$ cmake -DP4EST_DIR="..." <...>
or set the relevant variables by hand in ccmake.
Call Stack (most recent call first):
cmake/macros/macro_configure_feature.cmake:269 (FEATURE_ERROR_MESSAGE)
cmake/configure/configure_p4est.cmake:78 (CONFIGURE_FEATURE)
cmake/macros/macro_verbose_include.cmake:19 (INCLUDE)
CMakeLists.txt:124 (VERBOSE_INCLUDE)
I guess I haven't installed p4est correctly, so I configure it again.
# p4est-2.8 ./configure --enable-mpi.
( Here shows we are using MPI. I also tried p4est-2.8 ./configure --enable-mpi --prefix=/usr/local)
Then I tried to build and install p4est, but it gives me an error during installation:
# make
# ➜ p4est-2.8 make install
/Applications/Xcode.app/Contents/Developer/usr/bin/make install-recursive
Making install in sc
/Applications/Xcode.app/Contents/Developer/usr/bin/make install-am
build-aux/install-sh -c -d '/Users/xiaoyun/Downloads/p4est-2.8/local/lib'
/bin/sh ./libtool --mode=install /usr/bin/install -c src/libsc.la '/Users/xiaoyun/Downloads/p4est-2.8/local/lib'
libtool: install: /usr/bin/install -c src/.libs/libsc.0.dylib /Users/xiaoyun/Downloads/p4est-2.8/local/lib/libsc.0.dylib
install: /Users/xiaoyun/Downloads/p4est-2.8/local/lib/libsc.0.dylib: Permission denied
make[4]: *** [install-libLTLIBRARIES] Error 71
make[3]: *** [install-am] Error 2
make[2]: *** [install] Error 2
make[1]: *** [install-recursive] Error 1
I have no idea why the permission is denied, I also tried sudo make install:
objc[71909]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x20230f7e8) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x10c9082c8). One of the two will be used. Which one is undefined.
objc[71909]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x20230f838) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x10c908318). One of the two will be used. Which one is undefined.
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Operation not permitted
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Operation not permitted
make: getcwd: Operation not permitted
make: Nothing to be done for `install'.

Contrafold-se install error: error: unknown FP unit 'sse'

I am trying to install contrafold-se (link to github here: https://github.com/csfoo/contrafold-se), and I am getting this error when I run 'make' in src:
g++ -O3 -mfpmath=sse -msse -msse2 -msse3 -DEVIDENCE_SR -DEVIDENCE_PARS -DNDEBUG -W -pipe -Wundef -Winline --param large-function-growth=100000 -Wall -c Contrafold.cpp
clang: warning: argument unused during compilation: '-msse' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-msse2' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '--param large-function-growth=100000' [-Wunused-command-line-argument]
error: unknown FP unit 'sse'
error message
I see that contrafold-se installation has been tested on certain versions of g++ but I am using a macbook, and when I run g++ --version, I get:
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: arm64-apple-darwin21.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Thanks for your help!

SRS configure error in Mac pro m1 (arm64 cpu)- ld: symbol(s) not found for architecture i386

Operation on 'Mac M1 pro' which cpu is arm64 architecture.
on srs branch: 4.0release
do
cd trunk
./configure --osx
Get error as below:
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [apps/openssl] Error 1
make: *** [all] Error 2
Build openssl-1.1-fit failed.
Log is:
User config: --osx
Detail config: --prefix=/usr/local/srs --config=conf/srs.conf --hls=on --hds=off --dvr=on --ssl=on --https=on --ssl-1-0=off --ssl-local=off --sys-ssl=off --transcode=on --ingest=on --stat=on --http-callback=on --http-server=on --stream-caster=on --http-api=on --utest=off --cherrypy=off --srt=off --rtc=on --simulator=off --cxx11=off --cxx14=off --ffmpeg-fit=on --nasm=on --srtp-nasm=on --clean=on --gperf=off --gmc=off --gmd=off --gmp=off --gcp=off --gprof=off --static=off --shared-st=off --shared-srt=off --shared-ffmpeg=off --log-verbose=off --log-info=off --log-trace=on --gcov=off --debug=off --debug-stats=off --cross-build=off --cc=gcc --cxx=g++ --ar=ar --ld=gcc --randlib=randlib
SRS_WORKDIR: ., SRS_OBJS_DIR: objs, SRS_OBJS: ./objs, SRS_PLATFORM: Platform-Darwin-21.2.0-Clang13.1.6-SRS4-arm64
Alias python2 as python
Checking gcc/g++/gdb/make.
Required tools are ok.
OSX detected, install tools if needed
OSX install tools success
SED is sed_utility
The state-threads is ok.
Building openssl-1.1-fit.
Operating system: i686-apple-darwinDarwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000
Configuring OpenSSL version 1.1.1b (0x1010102fL) for darwin-i386-cc
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile
...
gcc -I. -Iinclude -fPIC -arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DRC4_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPADLOCK_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/Users/hangwu/git/srs/trunk/objs/Platform-Darwin-21.2.0-Clang13.1.6-SRS4-arm64/openssl-1.1-fit/_release/ssl\"" -DENGINESDIR="\"/Users/hangwu/git/srs/trunk/objs/Platform-Darwin-21.2.0-Clang13.1.6-SRS4-arm64/openssl-1.1-fit/_release/lib/engines-1.1\"" -DNDEBUG -DOPENSSL_NO_HEARTBEATS -MMD -MF apps/app_rand.d.tmp -MT apps/app_rand.o -c -o apps/app_rand.o apps/app_rand.c
...
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [apps/openssl] Error 1
make: *** [all] Error 2
Build openssl-1.1-fit failed.
What's the possible reason for this error?
Is there any way to avoid it?
It seems the gcc config param '-arch i386' is not right for my environment, is it the root cause of this error?
Now, at 2022.08.22, Apple M1 is ok to build and run SRS 5.0. Please see issue M1: Not possible to build on Apple Silicon for detail.
We have the docker images for linux/arm/v7 and linux/arm64/v8, it should work on Apple M1 also, see #3058.
Aside from openssl build issue, we also adopt the ST(state-threads) for Apple M1. Apart from the ST(state-threads) adaption, the configure script was updated to identify M1.
ST also is avaialble for Apple M1 now, please see #22.

cmake 3.10 cant internally test the blas library

I cant get working my blas library with cmake. I have arch-linxux, both blas and cmake are installed with pacman. Cant understand where is problem :-(. I made cmake to print out the output of macro CHECK_FORTRAN_FUNCTION_EXISTS, because it fails there. Maybe I dont have proper configuration of ld?
My simple testing CMakeLists.txt:
cmake_minimum_required(VERSION 2.8)
project(Test C Fortran)
find_package(BLAS)
Error part from output:
-- Looking for Fortran sgemm
-- Change Dir: /home/jiri/test_lapack/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_486fc/fast"
/usr/bin/make -f CMakeFiles/cmTC_486fc.dir/build.make CMakeFiles/cmTC_486fc.dir/build
make[1]: Entering directory '/home/jiri/test_lapack/CMakeFiles/CMakeTmp'
Building Fortran object CMakeFiles/cmTC_486fc.dir/testFortranCompiler.f.o
/usr/bin/gfortran -c /home/jiri/test_lapack/CMakeFiles/CMakeTmp/testFortranCompiler.f -o CMakeFiles/cmTC_486fc.dir/testFortranCompiler.f.o
Linking Fortran executable cmTC_486fc
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_486fc.dir/link.txt --verbose=1
/usr/bin/gfortran CMakeFiles/cmTC_486fc.dir/testFortranCompiler.f.o -o cmTC_486fc /usr/local/lib64/libblas.a
/usr/bin/ld: /usr/local/lib64/libblas.a(sgemm.f.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib64/libblas.a(xerbla.f.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_486fc.dir/build.make:99: cmTC_486fc] Error 1
make[1]: Leaving directory '/home/jiri/test_lapack/CMakeFiles/CMakeTmp'
make: *** [Makefile:126: cmTC_486fc/fast] Error 2
-- Looking for Fortran sgemm - not found

Error installing global on Arch linux

I was trying to install global from source. I run
./configure --with-exuberant-ctags=/usr/bin/ctags
and it runs OK. However, when I run
make
it gives the error
/bin/sh ../libtool --tag=CC --mode=link gcc -g -O2 -o gtags-cscope gtags-cscope.o alloc.o basename.o
build.o command.o display.o edit.o exec.o find.o help.o history.o input.o logdir.o mouse.o mygetenv.o mypop
en.o ../libparser/libgloparser.a ../libutil/libgloutil.a ../libdb/libglodb.a ../libglibc/libgloglibc.a -llt
dl -lncurses
libtool: link: gcc -g -O2 -o gtags-cscope gtags-cscope.o alloc.o basename.o build.o command.o display.o edi
t.o exec.o find.o help.o history.o input.o logdir.o mouse.o mygetenv.o mypopen.o ../libparser/libgloparser
.a ../libutil/libgloutil.a ../libdb/libglodb.a ../libglibc/libgloglibc.a -lltdl -lncurses
/usr/bin/ld: input.o: undefined reference to symbol 'erasechar'
/usr/lib/libtinfo.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:461: gtags-cscope] Error 1
make[2]: Leaving directory '/home/pspencil/tmp/global-6.5.7/gtags-cscope'
make[1]: *** [Makefile:517: all-recursive] Error 1
make[1]: Leaving directory '/home/pspencil/tmp/global-6.5.7'
make: *** [Makefile:424: all] Error 2
I have installed the package ncurses which apparently should provide the erase char symbol. I cannot find anything useful on Google.
Explicitly link the tinfo library.
NCurses uses tinfo, from what I have read ncurses should include the tinfo functionality in it's own library, maybe this has changed recently.