undefined reference to functions in gzip - gzip

When I was trying to build the Hiawatha webserver, I got the following error:
[ 1%] Linking C executable cgi-wrapper
/usr/bin/ld: CMakeFiles/cgi-wrapper.dir/src/libfs.c.o: in function gzip_file': /home/yliang19/Downloads/hiawatha-11.3/src/libfs.c:403: undefined reference to gzopen64'
/usr/bin/ld: /home/yliang19/Downloads/hiawatha-11.3/src/libfs.c:424: undefined reference to gzclose' /usr/bin/ld: /home/yliang19/Downloads/hiawatha-11.3/src/libfs.c:417: undefined reference to gzwrite'
/usr/bin/ld: /home/yliang19/Downloads/hiawatha-11.3/src/libfs.c:424: undefined reference to `gzclose'
collect2: error: ld returned 1 exit status
But gzip has been installed by default and is already the newest version. The makefile is generated by cmake. Any ideas what's going wrong?
Tried to install gzip and no change was made.
gzip is already the newest version (1.10-4ubuntu4.1).
The following packages were automatically installed and are no longer required:
libflashrom1 libftdi1-2
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 33 not upgraded.
The error stays the same when running "make install".

Related

Difficulty in linking FFTW library with gfortran

I have a c++ program, which uses the FFTW3 library, which I would like to translate to Fortran. I am using Ubuntu 22.04.1.
I installed the FFTW3 library as detailed in Installation on UNIX
The c++ main program is named ksbenchmark.cpp and, using g++, I compile it and link it (to the math and fftw3 libraries) with
g++ -o my_executable.out ksbenchmark.cpp -lm -lfftw3
which works great.
I have translate the c++ code in Fortran, the source file being named ksbenchmrk.f90.
If I issue
gfortran ksbenchmark.f90 -lfftw3 -lm
I get error messages
/usr/bin/ld: /tmp/cca2xMGa.o: in function `ksintegrate_':
ksbenchmark.f90:(.text+0x59): undefined reference to `dfftw_plan_dft_1d_'
/usr/bin/ld: ksbenchmark.f90:(.text+0x94): undefined reference to `dfftw_plan_dft_1d_'
/usr/bin/ld: ksbenchmark.f90:(.text+0xcf): undefined reference to `dfftw_plan_dft_1d_'
/usr/bin/ld: ksbenchmark.f90:(.text+0x4de): undefined reference to `dfftw_execute_'
/usr/bin/ld: ksbenchmark.f90:(.text+0x5db): undefined reference to `dfftw_execute_'
/usr/bin/ld: ksbenchmark.f90:(.text+0x626): undefined reference to `dfftw_execute_'
/usr/bin/ld: ksbenchmark.f90:(.text+0x780): undefined reference to `dfftw_execute_'
/usr/bin/ld: ksbenchmark.f90:(.text+0xa1c): undefined reference to `dfftw_execute_'
collect2: error: ld returned 1 exit status
I have spent the afternoon reading about it, and it seems I may have to use -I and -L flags such as
gfortran test.f90 -L/new/path/to/lib -I/new/path/to/include -lfftw3 -lm
as illustrated in the post Problems linking FFTW with gfortran (symbol(s) not found for architecture x86_64).
The first question is, what paths to use?
I can find files referring to fftw3 in /usr/local/lib as well as in /usr/local/include, but the attempt
gfortran ksbenchmark.f90 -L/usr/local/lib -I/usr/local/include -lfftw3 -lm
returns the same error as before
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: /tmp/ccW2DYGP.o: in function `ksintegrate_':
ksintegrate.f90:(.text+0x62): undefined reference to `dfftw_plan_dft_1d_'
/usr/bin/ld: ksintegrate.f90:(.text+0x9d): undefined reference to `dfftw_plan_dft_1d_'
/usr/bin/ld: ksintegrate.f90:(.text+0xd8): undefined reference to `dfftw_plan_dft_1d_'
/usr/bin/ld: ksintegrate.f90:(.text+0x4df): undefined reference to `dfftw_execute_'
/usr/bin/ld: ksintegrate.f90:(.text+0x5f7): undefined reference to `dfftw_execute_'
/usr/bin/ld: ksintegrate.f90:(.text+0x643): undefined reference to `dfftw_execute_'
/usr/bin/ld: ksintegrate.f90:(.text+0x79d): undefined reference to `dfftw_execute_'
/usr/bin/ld: ksintegrate.f90:(.text+0xa5b): undefined reference to `dfftw_execute_'
collect2: error: ld returned 1 exit status
I am unable to understand which paths to the library are to be used.
How to find where the library is saved?
Why does not g++ need any paths to the library?
I apologise for how trivial the question might seem, I am a total newbie can ensure I put a significant effort in trying to sort this out. Any hint would be most appreciated, thanks
EDIT
Following Vladimir F Героям слава's advice, I tried using the nm command to verify the library contains what is expected to.
In /usr/local/lib
I found libfftw3.a and libfftw3.la files.
Issuing nm libfftw3.a I get quite a long list.
I tried looking for one of the commands I get an error about, dfftw_plan_dft_1d
nm -S libfftw3.a | grep dfftw_plan_dft_1d
and indeed it returns hits
00000000000003a0 0000000000000026 T _Z18dfftw_plan_dft_1d_PP11fftw_plan_sPiPA2_dS4_S2_S2_
0000000000002df0 0000000000000026 T _Z19dfftw_plan_dft_1d__PP11fftw_plan_sPiPA2_dS4_S2_S2_

undefined reference error when trying to build gprc

I tried to build grcp with CMake on Linux, but running into some errors.
Log report
/usr/bin/ld: libgrpc++_test_config.so.1.31.0:undefined reference to 'google::ParseCommandLineFlags(int*, char***, bool)'
I've already installed gflags and gflags-devel package and I tried
ldd libgrpc++_test_config.so.1.31.0
but there is no link to gflags...
I think the cmake/gflags.cmake has some error in line 28 because find_package target is gflags but the next line TARGET become gflags:: gflags...
This is my build command:
cmake ../.. -DgRPC_INSTALL=ON -DCMAKE_BUILD_TYPE=Release -DgRPC_CARES_PROVIDER=package -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_SSL_PROVIDER=package -DgRPC_ZLIB_PROVIDER=package -DgRPC_GFLAGS_PROVIDER=package -DgRPC_BUILD_TESTS=ON -DBUILD_SHARED_LIBS=ON
make
make install

Issues installing apache httpd 2.4.20 with ldap

I am trying to configure apache using the following command:
./configure --prefix=/opt/nms/app/apache --with-apr=/home/kvanapal/httpd-2.4.20/srclib/apr --with-apr-util=/home/kvanapal/httpd-2.4.20/srclib/apr-util/apu--config --enable-mods-shared=all --with-ldap --with-included-apr --with-included-apr-util --enable-ldap
After this I am running the make command and this gives the following error towards the end:
server/.libs/libmain.a(exports.o):(.data+0x3f0): undefined reference to `apr_ldap_url_parse'
server/.libs/libmain.a(exports.o):(.data+0x3f8): undefined reference to `apr_ldap_url_parse_ext'
server/.libs/libmain.a(exports.o):(.data+0x400): undefined reference to `apr_ldap_is_ldapi_url'
server/.libs/libmain.a(exports.o):(.data+0x408): undefined reference to `apr_ldap_is_ldaps_url'
server/.libs/libmain.a(exports.o):(.data+0x410): undefined reference to `apr_ldap_is_ldap_url'
server/.libs/libmain.a(exports.o):(.data+0x418): undefined reference to `apr_ldap_rebind_remove'
server/.libs/libmain.a(exports.o):(.data+0x420): undefined reference to `apr_ldap_rebind_add'
server/.libs/libmain.a(exports.o):(.data+0x428): undefined reference to `apr_ldap_rebind_init'
server/.libs/libmain.a(exports.o):(.data+0x430): undefined reference to `apr_ldap_set_option'
server/.libs/libmain.a(exports.o):(.data+0x438): undefined reference to `apr_ldap_get_option'
server/.libs/libmain.a(exports.o):(.data+0x440): undefined reference to `apr_ldap_info'
server/.libs/libmain.a(exports.o):(.data+0x448): undefined reference to `apr_ldap_init'
server/.libs/libmain.a(exports.o):(.data+0x450): undefined reference to `apr_ldap_ssl_deinit'
server/.libs/libmain.a(exports.o):(.data+0x458): undefined reference to `apr_ldap_ssl_init'
collect2: error: ld returned 1 exit status
make[1]: *** [httpd] Error 1
What could be causing this issue?

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

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.

spnavcfg - SpaceNavigator in Arch Linux

Attempting to install my SpaceNavigator on arch linux using the open source spacenavd service. The service starts up fine, and I have the libspacenav and spacenavd packages installed. I am attempting to build spnavcfg from the sourceforge website.
http://sourceforge.net/projects/spacenav/files/
I downloaded libspacenav and spacenavd from the AUR, ran makepkg -s, and then sudo pacman -U and installed the packages locally, no issues.
spacenavcfg is another story, will probably have to build my own ABS package before I can use pacman on it, however when I extract the contents from sourceforge, it does not compile. I can successfully run sudo ./configure, but when I type 'make', I get the following error:
gcc -o spnavcfg spnavcfg.o front.o back.o cfgfile.o `pkg-config --libs gtk+-2.0`
/usr/bin/ld: front.o: undefined reference to symbol 'XOpenDisplay'
/usr/lib/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:16: recipe for target 'spnavcfg' failed
make: *** [spnavcfg] Error 1
I have not been able to figure out what the issue is, the usual google/forum trolling has not yielded any answers.
Thanks!
Barrett
Try with this AUR PKGBUILD this time: https://aur.archlinux.org/packages/spnavcfg/