Undefined reference to `clock_gettime', modify makefile? [duplicate] - linux

This question already has answers here:
C++ error: undefined reference to 'clock_gettime' and 'clock_settime'
(4 answers)
Closed 4 years ago.
I know that this question has been asked elsewhere, for example here, but I could not find the solution to my specific problem in there.
I have been trying to install the software Ipopt on Linux, followed the instructions in the documentation, but when I run make I obtain the following error:
/obs/xxx/Ipopt-3.12.8/build/ThirdParty/ASL/.libs/libcoinasl.so: undefined reference to `clock_gettime'
collect2: ld returned 1 exit status
make[3]: *** [ipopt] Error 1
make[3]: Leaving directory `/xxx_home/xxx/Ipopt-3.12.8/build/Ipopt/src/Apps/AmplSolver'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/xxx_home/xxx/Ipopt-3.12.8/build/Ipopt/src/Apps'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/xxx_home/xxx/Ipopt-3.12.8/build/Ipopt'
make: *** [all-recursive] Error 1
According to the posts above, the way around this is to include the -lrt flag, but I do not know whether I should insert it in the make file, in what makefile, and where exactly in the makefile. FYI, here is the Ipopt archive that I have been using, where you can find the Makefile, and here is some information about my linux distribution
$ uname -or
3.2.0-0.bpo.4-amd64 GNU/Linux
$ lsb_release -irc
Distributor ID: Debian
Release: 6.0.10
Codename: squeeze
Thank you.

ipopt i see is configured with configure script, reading help from that script i guess you can just ADD_CFLAGS compiler flags:
ADD_CFLAGS=-lrt ./configure
and then run make.

Related

Kernel module on cross-compile kernel: /bin/sh: 1: scripts/basic/fixdep: Exec format error

I'm doing some experiment on rpi4, and trying to reproduce this kernel module from github https://github.com/sysprog21/dont-trace on my rpi4. I encounter this problem:
make -C /lib/modules/`uname -r`/build M=/home/ubuntu/dont-trace modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.65-rt49-preemptrt-full-raspi'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: aarch64-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110
You are using: gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
CC [M] /home/ubuntu/dont-trace/dont_trace.o
/bin/sh: 1: scripts/basic/fixdep: Exec format error
make[2]: *** [scripts/Makefile.build:289: /home/ubuntu/dont-trace/dont_trace.o] Error 126
make[2]: *** Deleting file '/home/ubuntu/dont-trace/dont_trace.o'
make[1]: *** [Makefile:1896: /home/ubuntu/dont-trace] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.65-rt49-preemptrt-full-raspi'
make: *** [Makefile:7: all] Error 2
The kernel here is cross-compiled from x86 server and do show above. I was wondering how to solve this problem & what's the root cause. I can make it on x86 server. It should be something fundamental knowledge I don't understand. Thks!
it seems work this time
My solution might be a bit workaround, but it works. I follow the clues /bin/sh: 1: scripts/basic/fixdep: Exec format error. So I copy the source code to local raspberry pi, and make modules_prepare to construct complete /scripts, then move it into /lib/modules/`uname -r\`/build. It remain the gcc version warning, but work properly.

linux/videodev.h: No such file or directory Ubuntu 14.04

Hi I run into a problem when setting up my web camera for use in Chrome, which needed FlashCam.
When following the installation guide at: http://www.swift-tools.net/Flashcam/
At the step when doing the "make" build I get:
adderollen#andreas-RC530:~/Downloads/flashcam-1.4.5$ make
(cd vloopback; make);
make[1]: Entering directory `/home/adderollen/Downloads/flashcam-1.4.5/vloopback'
make -C /lib/modules/3.13.0-37-generic/build SUBDIRS=/home/adderollen/Downloads/flashcam- 1.4.5/vloopback modules
make[2]: Entering directory `/usr/src/linux-headers-3.13.0-37-generic'
CC [M] /home/adderollen/Downloads/flashcam-1.4.5/vloopback/vloopback.o
/home/adderollen/Downloads/flashcam-1.4.5/vloopback/vloopback.c:166:28: fatal error:
linux/videodev.h: No such file or directory
#include <linux/videodev.h>
^
compilation terminated.
make[3]: *** [/home/adderollen/Downloads/flashcam-1.4.5/vloopback/vloopback.o] Error 1
make[2]: *** [_module_/home/adderollen/Downloads/flashcam-1.4.5/vloopback] Error 2
make[2]: Leaving directory `/usr/src/linux-headers-3.13.0-37-generic'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/adderollen/Downloads/flashcam-1.4.5/vloopback'
make: *** [vloopback/vloopback.ko] Error 2
So I googled some and found this: linux/videodev.h : no such file or directory - OpenCV on ubuntu 11.04
I followed the answer by bukzor, but I still got the same problem. Any one got a solution?
I run Ubuntu 14.04.
Don't you still have such a file on disk? If so, then may be the package which contains such a file was renamed, or may be file was renamed/removed.
find / -name 'videodev.h'
locate videodev.h
using the above commands to check whether you have the file.

Unable to compile GCC, but no specific error given

I'm attempting to compile gcc 4.7.1 on Mint Linux with gcc 4.7.2 and get the following output:
[snip]
ar rc .libs/libgmp.a assert.o compat.o errno.o [snip]
rm -fr .libs/libgmp.lax
creating libgmp.la
(cd .libs && rm -f libgmp.la && ln -s ../libgmp.la libgmp.la)
make[5]: Leaving directory `/home/justin/projects/os/linux/src/gcc-4.7.0/build/gmp'
make[4]: Leaving directory `/home/justin/projects/os/linux/src/gcc-4.7.0/build/gmp'
make[3]: Leaving directory `/home/justin/projects/os/linux/src/gcc-4.7.0/build/gmp'
make[2]: Leaving directory `/home/justin/projects/os/linux/src/gcc-4.7.0/build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/justin/projects/os/linux/src/gcc-4.7.0/build'
make: *** [all] Error 2
I don't even know where to start looking since I don't get a descriptive error! It looks like it compiles GMP successfully and then fails after that, unable to complete whatever the next step should be.
The question is answered in its comments above. To sum up: The error was due to an improper global (presumably environment) variable, much earlier in the scrollback; that because OP was using a -j flag and other currently active branches did continue building.

make[1]: arm-linux-gcc: Command not found in ubuntu [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
what is arm-linux-gcc and how to install this in ubuntu
While I'm trying this command
$ make ARCH=arm devkit8000 defconfig
I get this error:
make[1]: arm-linux-gcc: Command not found
make[1]: arm-linux-gcc: Command not found
scripts/kconfig/conf -s arch/arm/Kconfig
***
*** You have not yet configured your kernel!
*** (missing kernel .config file)
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
make[3]: *** [silentoldconfig] Error 1
make[2]: *** [silentoldconfig] Error 2
make[1]: *** No rule to make target `devkit8000'. Stop.
make: *** [devkit8000] Error 2
How can i solve this error?
Do you have ARM toolchain installed? If there is no such package in Ubuntu you can download it from the internet and add it to your $PATH.
Take a look at what is arm-linux-gcc and how to install this in ubuntu
EDIT:
It might be, that your makefile is looking for different filenames, than you have.
Try locating arm-linux-gnueabi-gcc file. Go to that directory and you may create links for each file with arm-linux-gnueabi- prefix.
Try after sudo su:
ln -s arm-linux-gnueabi-gcc arm-linux-gcc
ln -s arm-linux-gnueabi-cc arm-linux-cc
etc.
Might help, but I do not guarantee. Usually works ;-)

Issue trying to build LLVM and clang

I'm trying to build LLVM and clang on my machine (Ubuntu 12.04). I followed the instructions on http://clang.llvm.org/get_started.html up to step 6 (build LLVM and clang). When I make, I get a whole load of warnings about potentially incompatibly plugin versions (to do with dragonegg?). But the whole thing fails with these messages:
llvm[2]: Linking Debug+Asserts executable llvm-tblgen
/usr/bin/ld: /home/peter/llvm/build/Debug+Asserts/bin/llvm-tblgen: hidden symbol `llvm::Type::~Type()' isn't defined
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make[2]: *** [/home/peter/llvm/build/Debug+Asserts/bin/llvm-tblgen] Error 1
make[2]: Leaving directory `/home/peter/llvm/build/utils/TableGen'
make[1]: *** [TableGen/.makeall] Error 2
make[1]: Leaving directory `/home/peter/llvm/build/utils'
make: *** [all] Error 1
So any help you could give me would be really helpful.
Thanks
I ended up deleting the llvm folder and checking everything out again, and it worked, so I'm just putting it down to bad timing.
You may want to use the existing LLVM packages, as provided by your distributions.
This askubuntu question about LLVM 3.1 could be relevant.
And you should at least do apt-get build-dep llvm-3.1-dev to ensure all dependencies are available.
You could also ask help on some LLVM related mailing list.

Resources