OCaml Compile Error: /usr/bin/ld: cannot find -lstr - linux

I am trying to compile the source code of MEGAM Ocaml library on an Ubuntu 64 machine.
I have OCaml installed (v 3.12.1), using sudo apt-get install ocaml.
I am having an issue when running the "make" command in the terminal on the unzipped source code, with OCaml returning the error:
/user/bin/ld: cannot find -lstr
collect2: error: ld returned 1 exit status
The makefile is producing the following two commands:
ocamldep *.ml > .depend
No error when run
ocamlc -g -custom -o megam str.cma -cclib -lstr bigarray.cma -cclib -lbigarray unix.cma -cclib -lunix -I /usr/lib/ocaml/caml fastdot_c.c fastdot.cmo intHashtbl.cmo arry.cmo util.cmo data.cmo bitvec.cmo cg.cmo wsemlm.cmo bfgs.cmo pa.cmo perceptron.cmo radapt.cmo kernelmap.cmo abffs.cmo main.cmo
Throws the error above when run.
I've tried removing the -lstr from the compile command, it stopped throwing that particular error but started throwing another error (Reference to undefined global 'Bigarray'), which is making me thing it might all be something I missed during the OCaml installation, some kind of PATH or reference I needed to set.
Any help is really appreciated, even if its just a shot in the dark, as am really struggling to come up with anything!

The instructions given here allow me to compile with no error. It boils down to:
locate libcamlstr
which tells me that libcamlstr can be found in /usr/lib/ocaml (YMMV), so I do:
cd /usr/lib/ocaml
sudo ln -s libcamlstr.a libstr.a
Then I'm able to compile the project:
cd /usr/local/src/cil
make clean && ./configure && make

You could just change the makefile from
-lstr
to
-lcamlstr

See the last comment in this bug in the OCaml bug tracker:
Bug 5247

Related

Mozilla syncstorage-rs installation / make fails under RHEL8

I'm currently trying to install Mozilla syncstorage-rs on a RockyLinux machine, and step by step I could reduce the amount of errors, but now I got stuck. I found in Makefile to execute the following command in case of SSL trouble, so I did so cargo build --features grpcio/openssl
and this is fine, this finally works:
cargo build --features grpcio/openssl
Compiling syncstorage v0.10.2 (/var/www/html/syncstorage-rs)
Finished dev [unoptimized + debuginfo] target(s) in 35.59s
But when I try to now run either make run or make test or anything else, I just get:
= note: /usr/bin/ld: /var/www/html/syncstorage-rs/target/debug/deps/libopenssl-dc6f50ea1194640f.rlib(openssl-dc6f50ea1194640f.openssl.9bacb62b-cgu.1.rcgu.o): undefined reference to symbol 'OPENSSL_cipher_name##OPENSSL_1_1_1'
//usr/lib64/libssl.so.1.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
= help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)
error: could not compile `syncstorage` due to previous error
make: *** [Makefile:45: test] Error 101
What am I missing? I thought after building it could be run easily.
So the answer is to use cargo clean before continuing. I don't know why, but there seemed to be some old artifacts even if I hadn't built before. However, after executing cargo clear command, the build openssl runs completely (many lines more than before) and after that, there is one more little step to do:
python3 -m venv venv # creates a virtual environment named "venv"
source venv/bin/activate # enters the virtual environment
python3 -m pip install -r requirements.txt # installs the packages
and finally make run works.
For more details, see https://github.com/mozilla-services/syncstorage-rs/issues/1241
See https://www.youtube.com/watch?v=jdtoyIW4Lec
for a step by step instruction.

undefined reference to `__gcov_exit'?

while I am building glibc library using yocto project it is giving
error: missing attribute ((constructor)) support??
after adding the coverage flags:
TARGET_CFLAGS += "-fprofile-arcs -ftest-coverage"
TARGET_LDFLAGS += "-lgcov -fprofile-arcs -ftest-coverage"
still, I am getting an error for glibc.
Please find the link of config log file : https://drive.google.com/file/d/14tiQJ8JIFE_tDWt3H9tS8zBBQROcZDNa/view
It is not working even after adding the following line in conf/local.conf :
EXTRA_OECONF = "libc_cv_ctors_header=yes"
Even i tried this
EXTRA_OECONF_append = "libc_cv_ctors_header=yes"
please find the config log file generated during compilation : https://drive.google.com/open?id=1kxTu8pt7h_9ty55OywP9Ilmmp04T61Rr
So, How to resolve this error?
Log file error Point
poky-linux/gcc/i586-poky-linux/8.2.0/ld: /tmp/ccxetEc1.o: in function `_GLOBAL__sub_D_00100_1__start':
conftest.c:(.text.exit+0x40): undefined reference to `__gcov_exit'<br>
collect2: error: ld returned 1 exit status<br>
configure:5682: $? = 1<br>
configure:5702: error: missing __attribute__ ((constructor)) support??
You are trying to build glibc with -fprofile-arcs -ftest-coverage in CFLAGS. That will not work. The errors you see are a result of these incorrect compiler flags.
A profiling glibc requires fairly substantial changes throughout the library and needs to be created by building with --enable-profile (which is not the default).
I had this error while I tried to enable coverage on a C project using a C++ test harness (CppUTest). Build system was handled by CMake.
Compilers and gcov were aligned on the same version (gcc --version, g++ --version and gcov --version gave the same version) but it seems that my build system was generated with a gcc 5 (resulting to an additional included directory by the linker: usr/lib/gcc/x86_64-linux-gnu/5). I clean the build tree and generated it again thanks to CMake which fixed the error.

Running gem5 with DramSim2

So I've been able to build gem5 and run full system simulation . Now i want to integrate it with dramSim2 .I cloned the dramsim2 into ext directory in gem5. I ran the following command to build the .opt file
again
scons build/ARM/gem5.opt
The error it throws is -
build/dramsim2/DRAMSim2/BusPacket.cpp: In member function 'void
DRAMSim::BusPacket::print(uint64_t, bool)':
build/dramsim2/DRAMSim2/BusPacket.cpp:63:2: error: nonnull
argument
'this' compared to NULL [-Werror=nonnull-compare]
if (this == NULL)
^~
build/dramsim2/DRAMSim2/BusPacket.cpp: In member function 'void
DRAMSim::BusPacket::print()':
build/dramsim2/DRAMSim2/BusPacket.cpp:104:2: error: nonnull
argument
'this' compared to NULL [-Werror=nonnull-compare]
if (this == NULL) //pointer use makes this a necessary precaution
^~
cc1plus: all warnings being treated as errors
scons: *** [build/dramsim2/DRAMSim2/BusPacket.os] Error 1
scons: building terminated because of errors.
Anyone know what it means ?
Dramsim2 is outdated, and its original author stop actively maintaining the project. Although you may want to fix the codes as described here, can you simply test if the build passes the failure point by additionally giving -Wno-nonnull compilation switch?
I solved this problem . I changed gcc, g++ version.
I changed gcc version from 6.0 to 4.8.
Use this command and change the version.
sudo update-alternatives --config gcc
sudo update-alternatives --config g++

possibly undefined macro: AC_SUBST

I am trying to build a project and it throws me an error :
autoreconf: running: /usr/bin/autoconf --force
configure.ac:19: error: possibly undefined macro: AC_SUBST
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1
I am very new to build tools, thats why this error is driving me crazy.
Can someone help me figure out what I should do to resolve this issue?
EDIT : Corresponding line in configure.ac is :
Hey I still not able to figure out whats wrong with my configure.ac.
My configure.ac looks like this :
PKG_CHECK_MODULES(libcurl, libcurl)
AP_VERSION=2.2.4
AP_CHECK_APACHE([$AP_VERSION], [
LIBTOOL="`$APR_CONFIG --apr-libtool`"
AC_SUBST([LIBTOOL])
MODULE_CFLAGS="$AP_CFLAGS"
AC_SUBST([MODULE_CFLAGS])
MODULE_LDFLAGS="`$APR_CONFIG --link-libtool` `$APU_CONFIG --link-libtool`"
AC_SUBST([MODULE_LDFLAGS])
BIN_LDFLAGS="`$APR_CONFIG --link-libtool` `$APU_CONFIG --link-libtool` `$APR_CONFIG --ldflags --libs` `$APU_CONFIG --ldflags --libs`"
AC_SUBST([BIN_LDFLAGS])
prefix="$AP_PREFIX"
], AC_MSG_ERROR([*** Apache version $AP_VERSION not found!]))
It breaks at AC_SUBST([LIBTOOL]). Please help
apt install pkg-config m4 libtool automake autoconf
This is an unfortunate way autoconf tends to fail. Check for the last macro that was called before AC_SUBST, that's the real undefined one.

How can I install git on my webserver with a curl.h no such file error

I have been trying to install Git on my web server. When i try "make install" i get the following errors which I cant seem to get past.
[root#site git-core-0.99.6]# make install
gcc -o http-pull.o -c -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' http-pull.c
http-pull.c:6:23: error: curl/curl.h: No such file or directory
http-pull.c:7:23: error: curl/easy.h: No such file or directory
http-pull.c:16: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â*â token
http-pull.c: In function âfetch_indexâ:
http-pull.c:102: warning: implicit declaration of function âcurl_easy_setoptâ
There is alot more of that if you need to see it, but though part of it would cover the issue
It looks like you're missing the curl development package, maybe if you install the source available here (or with the package manager of your distribution), it will work better.
For example, under debian, install libcurl4-gnutls-dev

Resources