How to install and use libnet in mac os? - osx-yosemite

I want to program in C with libnet in Mac OS.
When I type in gcc *.o -o network -lnet, there's an error:
library not found for -lnet.
And when I use homebrew install linnet, is says:
Warning: libnet-1.1.6 already installed.

It is the problem of library PATH.Flow the steps to solve this problem.
First, find where you install the library. For my case, the libnet is located in /usr/local/Cellar/libnet/1.1.6.
Second, run /usr/local/Cellar/libnet/1.1.6/bin/libnet-config.
Third, use -L to add the path when you link.
gcc *.o -L/usr/local/Cellar/libnet/1.1.6/lib -lnet.

Related

Installing janus-gateway error on CentOS7

I want to install janus-gateway on CentOS7.
I read the following document and tried installation.
https://github.com/meetecho/janus-gateway/blob/master/README.md
git clone https://github.com/meetecho/janus-gateway.git
cd janus-gateway
sh autogen.sh
./configure --prefix=/opt/janus
However, configuring janus-gateway will cause an error. The error is as follows.
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for pkg-config... /bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for JANUS... no
configure: error: Package requirements (
glib-2.0 >= 2.34
libconfig
nice
jansson >= 2.5
libssl >= 1.0.1
libcrypto
) were not met:
No package 'nice' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables JANUS_CFLAGS
and JANUS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
I installed libnice(libnice-0.1.3-4.el7.x86_64) in the following way.
yum install libnice
How can I solve it?
Thank you.
try this and rebuild
echo "export PKG_CONFIG_PATH=/usr/lib/pkgconfig" >> ~/.bashrc
source ~/.bashrc
Disclaimer: I am using Ubuntu 18.04 when testing this.
If you are using Ubuntu system and trying to install Janus and running this code
./configure --prefix=/opt/janus
And then getting this error: No package 'nice' found
Make sure you have been installation of the nice from aptitude.
sudo install aptitude
aptitude install libmicrohttpd-dev libjansson-dev \
libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev \
libopus-dev libogg-dev libcurl4-openssl-dev liblua5.3-dev \
libconfig-dev pkg-config gengetopt libtool automake
For some reason installation of nice using the answer from Frank, Ahmet or Zallfire doesn't work in Ubuntu. It has to be installed using aptitude.
You should download libnice source code to install.
https://gitlab.freedesktop.org/libnice/libnice
You need the development libnice.
yum install libnice-devel

install tensorflow from source code, cuda9.1, cuDNN7.0.5, libcublas.so.9.1 not found

ERROR: /home/kenny/Downloads/tensorflow-1.5.0-rc1/tensorflow/contrib/lite/toco/BUILD:326:1: Linking of rule '//tensorflow/contrib/lite/toco:toco' failed (Exit 1)
/usr/bin/ld: warning: libcublas.so.9.1, needed by bazel-out/k8-py3-opt/bin/_solib_local/_U_S_Stensorflow_Scontrib_Slite_Stoco_Ctoco___Utensorflow/libtensorflow_framework.so, not found (try using -rpath or -rpath-link)
Check this issue comment
https://github.com/tensorflow/tensorflow/issues/15656#issuecomment-362104182
The current version of TensorFlow (1.7) does not support CUDA9.1, but you should have several options:
Downgrade to CUDA 9.0
Compile TensorFlow from the source code by your own
Find an existing whl file for you (unofficial release). ex. I fixed the issue by using a whl from https://github.com/mind/wheels
Wait until Tensorflow supports CUDA9.1 :)
Looks like you need to install Cuda 9.1 from Nvidia as a prerequisite to building from source.
I also had similar issue. Probably adding this flag --action_env="LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" in your bazel build command will solve the issue. Make sure you have set the environment variable LD_LIBRARY_PATH as /usr/local/cuda/lib64 or wherever your cuda toolkit installation is present.
EDIT: In case setting up environment variable doesn't work. You can further try by running sudo ldconfig -v|grep 'libcublas.so.9.1'. In my case cuda's version is 9.1 hence I verify for the same. If grep doesn't return the expected library, just try other ways to register your path to ldconfig
It's a weird dynamic link lib error.
Somehow bazel doesn't recognize LD_CONFIG. You'll have to manually update the /etc/ld.so.conf (in my case with Ubuntu 17.1, the config files are in /etc/ld.so.conf.d), and add a line that points to the /usr/local/cuda/lib64 folder.
Then run
sudo ldconfig
to re-build the ld cache. You can verify that the cuda libs are in the search folders by
sudo ldconfig -v | grep cuda
The build should work now.

install mlpy 3.5.0 on mac 10.9 error.Please help me

The following is the error which I am getting. Please help me to fix it.
apple:mlpy-3.5.0 apple$ python setup.py install
running install
running build
running build_py
running build_ext
building 'mlpy.gsl' extension
cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c mlpy/gsl/gsl.c -o build/temp.macosx-10.9-intel-2.7/mlpy/gsl/gsl.o
mlpy/gsl/gsl.c:223:10: fatal error: 'gsl/gsl_sf.h' file not found
#include "gsl/gsl_sf.h"
^
1 error generated.
MLPy depends on GNU Scientific Library (GSL), which you need to install first.
You can install it either with brew install gsl or manually from source.
For manual installation, instructions can be found here. The relevant steps are as follows:
go to: http://www.gnu.org/prep/ftp.html
click on an ftp link close to your location
find the gsl/ directory and click on it
find the gsl-VERSION.tar.gz file, where version is 1.14 or greater. Click on that file to download it.
In a terminal window extract the tar.gz file using tar -xzf gsl-VERSION.tar.gz and then cd to the ./gsl-VERSION directory
Look at the INSTALL file. It will probably tell you to run ./configure, then make, and then make install (and you might have to
login as the superuser (sudo)
I am actually getting the same issue today while installing mlpy. Based on the mlpy documentation. Here is the method to solve this issue.
According to the installation section in the mlpy documentation:
If the GSL header files or shared library are in non-standard locations on your system, use the --include-dirs
and --rpath options to build_ext:
$ python setup.py build_ext --include-dirs=/path/to/header --rpath=/path/to/lib
$ python setup.py install
We have to assign the header and lib. Based on How to obtain and install GSL,
Under Search Paths/Header Search Paths type /opt/local/include
Under Search Paths/Library Search Paths type /opt/local/lib
The quick answer is running the below command:
sudo python setup.py build_ext --include-dirs=/opt/local/include --rpath=/opt/local/lib
sudo python setup.py install
Hope this will be helpful.

How to make GNUstep libobjc2 to work?

I downloaded and built GNUstep libobjc2 1.6.1,
svn co http://svn.gna.org/svn/gnustep/libs/libobjc2/1.6.1/ rep
cd rep
make
and got this error when I tried to compile a Objective-C code.
hoon#ubuntu:~/work/objc2$ clang -fobjc-nonfragile-abi -fobjc-arc -fblocks *.m *.a -l pthread; ./a.out
Objective-C ABI Error: Loading modules from incompatible ABIs while loading
a.out: loader.c:38: __objc_exec_class: Assertion `objc_check_abi_version(module)' failed.
Aborted (core dumped)
It seems I need to build libobjc.a with some different configurations. What is the problem and what should I do to fix this error?
Env: Ubuntu 12.04 LTS
This is a good question because LLVM and CLang and GNUstep don't claim to be hard or complicated to use. They do ask their users to read (and reread) their documentation though. I've just discovered this combination for Ubuntu myself and it is very intriguing. And there are a lot of moving parts at the moment.
If the OP got an answer on one of the gnustep mailing lists, then it would be nice to hear here how it was resolved.
Without suggesting the normal route of starting over and only installing the latest from LLVM and GNUstep directly, here's my take.
The OP is trying to use ARC and blocks with the runtime provided by the gunstep/libobjc2 project.
libobjc2 should probably be built with clang version 3.2 - or maybe the top of tree.
clang -v will tell you what version you have on your machine. I've found even Ubuntu 12.10 doesn't provide clang-3.2. So I download it from the LLVM website. They have prebuilt binaries for Ubuntu 12.04 LTS. To get make to use clang for this build step, I've seen instructions to set and export CC=clang and CXX=clang++.
Once libobjc2 is built, care must be taken where it gets installed. If the system already has an older libobjc.so.x.y library (this provides the runtime environment for Obj-C), clang or the linker may be picking up the wrong one when you start compiling your own source. I found libobjc.so.4.6.0 built from the libobjc2 source was installed to /usr/local/lib both on Ubuntu 12.04 and 12.10 when I ran the make install step. This path was not setup by the libobjc2 install step.
To get this library picked up, I had to add /usr/local/lib to the env variable LD_LIBRARY_PATH. It wouldn't hurt to try 'locate libojbc.so' to see if there are other versions on the system.
Finally, the libobjc2 readme, https://github.com/gnustep/gnustep-libobjc2#readme, says this new version of the gnustep library supports two ABIs, and each ABI supports ARC and blocks. The advice I've seen about compiling with libobjc2 is to also provide the runtime version expected to be compiling and linking with: -fobjc-runtime=gnustep. Clang on Ubuntu still defaults to the older ABI. -fobjc-nonfragile-abi may accomplish the same thing but I've seen it mentioned that flag was or will be deprecated.
The OP error may actually come from the step where a.out is being run, rather than where clang was compiled. Perhaps the dynamic loader is picking up the legacy libobj.so. Again, I would use locate to see if the system even has more than one.
This is just a guess, but I'm gonna go out on a limb and guess that GNUstep is going to build with GCC by default. A good first step might be to reconfigure the GNUstep build to use Clang. I can't say what variety of issues that will expose, but...
Alternately, you could try building your application with GCC instead of Clang.
This is a fairly late answer, but I have found a way to get everything working (on Elementary OS specifically so I imagine it should be fine on Ubuntu and similar distros).
As mentioned, it is better/easier to build everything from source because you get to pick the prefix, build options, etc. The general method:
Install cmake (if it's not already installed) --> sudo apt-get install cmake
Download, build and install llvm and clang as per the instructions here (or see attached build script). For speed, use the --enable-optimized flag. Tests are "optional" ;-)
The default build scripts for compiler-rt do not include the Blocks runtime. You could modify the build scripts, or rejoice that someone else has already done it (particularly if, like me, your cmake isn't great). Download, build and install libBlocksRuntime from this git repo (it is essentially a clone of the latest compiler-rt Blocks runtime code with custom build scripts). FOLLOW THEIR COMPILATION AND TESTING METHOD.
Download, build and install libobjc2 from GNUStep. The instructions for correct building are actually inside the now-deprecated makefile.
Run ldconfig (if required - though there's no harm in running it even if it isn't).
As #WeakPointer you may still need to edit the LD_LIBRARY_PATH environment variable to pick up your new libraries. Another option is to make some quick and dirty symlinks so clang can find your new libraries.
Final note: I haven't done any comparisons between GNUStep's libobjc2 and GCC's libobjc, the latter of which DOES contain some Objective-C 2.0 features... Be careful with your library selection if you keep both on your system at the same time!
The following script should do it all (untested!):
#!/bin/bash
# Temporary base directories
basedir="./clangllvm_temp"
basedir2="./libBlocksRuntime_temp"
basedir3="./libObjc2_temp"
# Clang, llvm, compiler-rt
mkdir $basedir
cd $basedir
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
cd ../..
cd llvm/tools/clang/tools
svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra
cd ../../../..
cd llvm/projects
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
cd ../..
mkdir build
cd build
../llvm/configure --prefix=$PREFIX --enable-optimized
make
sudo make install
cd ../..
# libBlocksRuntime
git clone https://github.com/mackyle/blocksruntime.git $basedir2
cd $basedir2
sudo ./buildlib
sudo ./checktests
sudo ./installlib
# Test!
clang -o sample -fblocks sample.c -lBlocksRuntime && ./sample
cd ..
# libobjc2
https://github.com/gnustep/gnustep-libobjc2.git $basedir3
cd $basedir3
mkdir Build
cd Build
cmake .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
sudo make && sudo -E make install
cd ../..
# Cleanup
rm -rf $basedir
rm -rf $basedir2
rm -rf $basedir3
# ldconfig
sudo ldconfig
# Additional symlink/LD_LIBRARY_PATH stuff here if required.
# EOF
Key difference was using Clang for build. Take care not to use GCC which is system default compiler. I removed gobjc and g++ packages from system to avoid this issue.
export CC=clang
export CXX=clang++
svn co http://svn.gna.org/svn/gnustep/libs/libobjc2/1.6.1/
cd 1.6.1
make
This answer was hinted from this mailing list thread:
http://lists.gnu.org/archive/html/discuss-gnustep/2012-12/msg00036.html
Described script is posted here:
http://wiki.gnustep.org/index.php/GNUstep_under_Ubuntu_Linux
Now it compiles simple ARC code.
It seems GCC and Clang generated codes are incompatible.
Update
I wrote scripts to setup libobjc2 on FreeBSD and CentOS.
The scripts are mostly copied from a blog.

Cross compile mono for arm

Has anyone successfully cross-compiled mono for ARM under Linux without scratchbox or qemu?
(maybe with distcc or some cross-compiler toolchain)
I managed to cross compile mono(2.0, 2.4, 2.6, 2.8, 2.10.1) with Scratchbox 2 installed on a Ubuntu machine using CodeSourcery Lite tool chain. I used the article from the Mono project page.
First compile it on the native machine
./configure
$ make
$ make install DESTDIR=path
Then in sb2:
[sbox-ARMEL: ~] > ./configure --disable-mcs-build
[sbox-ARMEL: ~] > make
[sbox-ARMEL: ~] > make install DESTDIR=path
I use this for configuration
./configure --enable-minimal=profiler,debug,logging,soft_debug --with-tls=--with-tls=__thread --with-monotouch=no --without-mcs-docs --disable-mono-debugger CFLAGS=-DARM_FPU_NONE --disable-mcs-build
I tried and tried and tried with scratchbox2 last night.. Ran into some problem.. Ended up just compiling on arm, went fine! took 30 minutes!
CFLAGS=-DARM_FPU_VFP_HARD HardFloat
CFLAGS=-DARM_FPU_VFP_NONE SoftFloat
Compile mono on PC
sudo make install `directory like /tmptree etc`
move all these files from /tmptree over to / etc on your arm device.
./autogen.sh --disable-mcs-build
make CFLAGS=-DARM_FPU_VFP_HARD
sudo make install
sudo ldconfig
Mono Hard Float Patch
Tried doing Hard Float with mono 3.0.3.. it said it didn't support it yet.