For the following simple makefile, is it possible to:
call insmod after make
call rmmod after clean
obj-m+=hello.o
all:
make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) clean
As a dev, I would expect make to just produce a binary, and not do any other changes on my system. I would suggest you use a typical approach and do the install/rmmod/insmod/whatever via make install:
MODULE = trololo
...
install:
rmmod $(MODULE)
insmod $(MODULE).ko
And then you build:
make
And remove/install module:
sudo make install
Related
I installed it from source all according to boost manual with help from several discussions from stackoverflow:
1. apt-get essentials for boost
2. ./bootstrap
3. ./b2
Still getting errors, can someone tell from experience on what os examples work. I've tried to install boost for mac but there were linking errors... 1.70 boost is not necessary, maybe previous versions, I just want to try beast in my project (it was introduced in 1.66).
I m trying to build example from beast:
https://www.boost.org/doc/libs/1_70_0/libs/beast/example/advanced/server/advanced_server.cpp
Makefile:
CC=g++
CFLAGS=-pthread
LDFLAGS=
SOURCES=main.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXE=qm
all: $(SOURCES) $(EXE)
$(EXE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $#
.cpp.o:
$(CC) $(CFLAGS) $< -o $#
terminal:
g++ -pthread main.cpp -o main.o
g++ main.o -o qm
/usr/bin/ld: main.o: ZTIv: invalid version 10 (max 0)
main.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:11: recipe for target 'qm' failed
make: *** [qm] Error 1
I installed boost from source version 1.7... I've tried to search for this error without any results.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
Answer:
Just take latest examples from git repos. It helped me, good luck!
When I try to install vowpal wabbit on CentOS (vmware image) I keep getting this error :
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-unused-local-typedef" [enabled by default]
make[1]: *** [lda_core.lo] Error 1
make[1]: Leaving directory `/home/tom/vowpal_wabbit/vowpalwabbit'
make: *** [install-recursive] Error 1
full error info :
Making install in vowpalwabbit
make[1]: Entering directory `/home/tom/vowpal_wabbit/vowpalwabbit'
depbase=`echo lda_core.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I/usr/include -I/include -Wall -Wno-unused-local-typedef -pedantic -ffast-math -O3 -fomit-frame-pointer -fno-strict-aliasing -DNDEBUG -std=gnu++11 -MT lda_core.lo -MD -MP -MF $depbase.Tpo -c -o lda_core.lo lda_core.cc &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I/usr/include -I/include -Wall -Wno-unused-local-typedef -pedantic -ffast-math -O3 -fomit-frame-pointer -fno-strict-aliasing -DNDEBUG -std=gnu++11 -MT lda_core.lo -MD -MP -MF .deps/lda_core.Tpo -c lda_core.cc -fPIC -DPIC -o .libs/lda_core.o
lda_core.cc: In function ‘T ldamath::lgamma(T)’:
lda_core.cc:361:94: error: there are no arguments to ‘BOOST_STATIC_ASSERT_MSG’ that depend on a template parameter, so a declaration of ‘BOOST_STATIC_ASSERT_MSG’ must be available [-fpermissive]
BOOST_STATIC_ASSERT_MSG(true, "ldamath::lgamma is not defined for this type and math mode.");
^
lda_core.cc:361:94: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
lda_core.cc: In function ‘T ldamath::digamma(T)’:
lda_core.cc:367:95: error: there are no arguments to ‘BOOST_STATIC_ASSERT_MSG’ that depend on a template parameter, so a declaration of ‘BOOST_STATIC_ASSERT_MSG’ must be available [-fpermissive]
BOOST_STATIC_ASSERT_MSG(true, "ldamath::digamma is not defined for this type and math mode.");
^
lda_core.cc: In function ‘T ldamath::exponential(T)’:
lda_core.cc:373:99: error: there are no arguments to ‘BOOST_STATIC_ASSERT_MSG’ that depend on a template parameter, so a declaration of ‘BOOST_STATIC_ASSERT_MSG’ must be available [-fpermissive]
BOOST_STATIC_ASSERT_MSG(true, "ldamath::exponential is not defined for this type and math mode.");
^
lda_core.cc: In function ‘T ldamath::powf(T, T)’:
lda_core.cc:379:92: error: there are no arguments to ‘BOOST_STATIC_ASSERT_MSG’ that depend on a template parameter, so a declaration of ‘BOOST_STATIC_ASSERT_MSG’ must be available [-fpermissive]
BOOST_STATIC_ASSERT_MSG(true, "ldamath::powf is not defined for this type and math mode.");
^
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-unused-local-typedef" [enabled by default]
make[1]: *** [lda_core.lo] Error 1
make[1]: Leaving directory `/home/tom/vowpal_wabbit/vowpalwabbit'
make: *** [install-recursive] Error 1
Please help. How can I solve it? I already have "g++ (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)" version.
This is linking issue between files please run following commands
Testing run
# yum install devtoolset-2-gcc-4.8.2 devtoolset-2-gcc-c++-4.8.2
# /opt/rh/devtoolset-2/root/usr/bin/gcc --version
export
ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
hash -r
gcc --version
for more info : http://www.computerhope.com/unix/uln.htm
This is what I do on CentOs 6.8 before running pip install vowpalwabbit both to conda or to main python distribution which builds native part and a python egg. Contains commented lines for a case of building a docker image. Pretty sure the same should help with just building the vowpal-wabbit library.
The original problem with BOOST_STATIC_ASSERT_MSG is being fixed by installing boost-devel:1.59.
yum -y install wget make python-devel zlib-devel
# Boost 1.59 required for vowpal wabbit, Boost 1.41 is going with CentOs 6.8 image and repo
wget http://repo.enetres.net/enetres.repo -O /etc/yum.repos.d/enetres.repo
yum -y install boost-devel
# This step is done for the original author, but will be needed if you didn't install updated gcc/g++ yet.
# GCC and G++ 4.8.2 for vowpal wabbit build, 4.4.x is going with CentOs 6.8 image by default.
# Don't go with too new gcc versions like gcc 5.x, it will not work
wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
yum -y install devtoolset-2-gcc devtoolset-2-gcc-c++ devtoolset-2-binutils devtoolset-2-runtime devtoolset-2-libstdc++-devel
scl enable devtoolset-2 bash
# Set PATH, because "scl enable" does not have any effects inside "docker build"
#-docker- PATH /opt/rh/devtoolset-2/root/usr/bin:$PATH
# Set CC, CXX, LD variables for make, because "scl enable" does not have any effects inside "docker build"
#-docker- ENV CC /opt/rh/devtoolset-2/root/usr/bin/gcc
#-docker- ENV CXX /opt/rh/devtoolset-2/root/usr/bin/g++
#-docker- ENV LD /opt/rh/devtoolset-2/root/usr/bin/ld
# Python 2.7 for vowpal wabbit, CentOs 6.8 comes with python 2.6
# --enable-shared flag is important for the vowpal wabbit build
cd /opt &&\
wget --no-check-certificate https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz &&\
tar xf Python-2.7.6.tar.xz &&\
cd Python-2.7.6 &&\
./configure --enable-shared --prefix=/usr/local &&\
make && make altinstall
ln -s /usr/local/bin/python2.7 /usr/bin/python2.7
echo "/usr/local/lib/python2.7" > /etc/ld.so.conf.d/python27.conf
echo "/usr/local/lib" >> /etc/ld.so.conf.d/python27.conf
ldconfig
After this steps pip install vowpalwabbit or make for the original native library should work.
Related discussion in vowpal-wabbit issues tracker.
As it can be seen in the log I have some errors when trying to compile Aircrack on my Raspberry pi B+ running latest raspbian. I can't manage to find out what's wrong.
(I have also installed libnl)
make -C src all
make[1]: Entering directory '/home/pi/aircrack-ng-1.2-rc1/src'
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=0
-DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3
-Wno-unused-but-set-variable -Wno-array-bounds -Iinclude wpaclean.o
osdep/radiotap/radiotap.o -o wpaclean -Losdep -losdep -lnl-genl-3
-lnl-3
/usr/bin/ld: cannot find -lnl-genl-3
collect2: ld returned 1 exit status
Makefile:189: recipe for target 'wpaclean' failed
make[1]: *** [wpaclean] Error 1
make[1]: Leaving directory '/home/pi/aircrack-ng-1.2-rc1/src'
Makefile:25: recipe for target 'all' failed
make: *** [all] Error 2
Thanks
sudo apt-get install libnl-3-dev
sudo ln -s /lib/arm-linux-gnueabihf/libnl-genl-3.so.200 /lib/arm-linux-gnueabihf/libnl-genl-3.so
You have installed libnl-3-dev but it doesn't create proper library link.
Try "sudo make" and "sudo make install"
You also might need to install the libssl-dev package if you havent done so already.
I try to pack my application and static link all libraries. But I get this error.The Makefile is shown below:
CC = gcc
INCPATH = -I/home/johnny/Application/FileBasedReG/include/RealityGrid
LIBS = -L/home/johnny/Application/FileBasedReG/lib/RealityGrid -lReG_Steer -l:libxml2.a -l:libncurses.a -l:libm.a -l:libz.a -l:libtermcap.a
OBJECTS = mini_steerer.o
TARGET = mini_steerer
###### Compile ######
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CC) $(INCPATH) -o $(TARGET) $(OBJECTS) $(LIBS)
mini_steerer.o: ./mini_steerer.c ./mini_steerer.h
$(CC) -c $(INCPATH) -o mini_steerer.o ./mini_steerer.c
I think I need to add one or two more static libraries, but I can't find what they are.
On a debian / ubuntu system, apt-get install liblzma-dev will do the trick. Link with -llzma.
You're probably missing the liblzma.a, which should have come as a dependency from libxml2, if you had got it from a package.
I'm getting recurring errors when using make on Mac OS Mountain Lion v10.8.4.
I tried to install libev, and, after running ./configure, I ran make and got:
libtool: link: gcc -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -o .libs/libev.4.dylib .libs/ev.o .libs/event.o -O3 -install_name /usr/local/lib/libev.4.dylib -compatibility_version 5 -current_version 5.0 -Wl,-single_module
libtool: link: dsymutil .libs/libev.4.dylib || :
libtool: link: (cd ".libs" && rm -f "libev.dylib" && ln -s "libev.4.dylib" "libev.dylib")
libtool: link: ar cru .libs/libev.a ev.o event.o
ranlib: unrecognized option `-q'
ranlib: Try `ranlib --help' for more information.
ar: internal ranlib command failed
make[1]: *** [libev.la] Error 1
make: *** [all] Error 2
I see a pattern because when I run make when trying to install httpd
I get this error:
libtool: link: rm -fr .libs/libev.4.dylib .libs/libev.4.dylib.dSYM .libs/libev.a .libs/libev.dylib
libtool: link: gcc -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -o .libs/libev.4.dylib .libs/ev.o .libs/event.o -O3 -install_name /usr/local/lib/libev.4.dylib -compatibility_version 5 -current_version 5.0 -Wl,-single_module
libtool: link: dsymutil .libs/libev.4.dylib || :
libtool: link: (cd ".libs" && rm -f "libev.dylib" && ln -s "libev.4.dylib" "libev.dylib")
libtool: link: ar cru .libs/libev.a ev.o event.o
ranlib: unrecognized option `-q'
ranlib: Try `ranlib --help' for more information.
ar: internal ranlib command failed
make[1]: *** [libev.la] Error 1
make: *** [all] Error 2
It looks like I have an issue with ranlib but I'm not sure how to fix it.
I saw somewhere that I should reinstall my developer tools, so I did but it hasn't helped.
First the obvious actions: make sure you have the latest libev release, and Xcode is up to date. The configure system seems outdated, as it detects the (my) host system as i386-apple-darwin12.4.0 rather than x86_64-apple-darwin12.4.0. Though it still seemed to build.
If you have the autotools installed, e.g., autoconf-2.69, automake-1.13.3, and libtool-2.4.2 (which is typically installed as glibtool on OS X), you can run the included autoreconf command with: sh autogen.sh to refresh the configure system. It will issue a few warnings that can be ignored.
./configure CC="clang" CFLAGS="-pipe -W -Wall -O2 [-march=core2]"
Xcode -> Preferences -> Downloads -> Components :
check and install "Command Line Tools if you haven't already, which might be enough. If you still have a terminal open through the process, type the rehash command. Possibly you've done all this, but some Mac developers never leave the IDE.