I've installed
sudo apt-get install libbluetooth-dev
to have bluetooth package in my environment.
Hence, using the following command can successfully compile the bluetooth code using gcc.
gcc -o bt bt.c -lbluetooth
However, when I tried to use the cross-compiler to compile the source code
$CC -o bt2 bt.c -lbluetooth
I got the fatal error:
fatal error: bluetooth/bluetooth.h: No such file or directory
compilation terminated
Is there anything I've done wrong or I need to link this library to this cross-compiler ?
Thanks
I guess your cross compiler comes with a complete toolchain and SDK.
You must check that e.g. libBluetooth.so installed into your SDK under /usr/lib or /usr/local/lib folders and the correct header, as the one installed for i386/x64 platform, is present into SDK.
In case of the header and lib exist you must change your #include into your code to match the path into your SDK.
Related
I am on a Debian linux build environment and cannot change this. We build our apps using mingw and would like to use the openssl suite of tools in one of our applications. The linux version contains the includes openssl/md5.h and compiles gcc with the -lcrypto flag and works great.
What do I need to do to build the Windows dll using mingw and include openssl?
My build command looks like this
x86_64-w64-mingw32-gcc -shared -s FILE.c FILE.def -lcrypto -lws2_32 -o OUT.dll
This produces the error fatal error openssl/md5.h no such file or directory.
I have tried to add the -I /path/to/openssl/includes
Then get the ld error cannot find -lcrypto. I have the libssl-dev libraries.
I have the source for openssl and have tried to compile it using mingw as some other articles have suggested. "cannot find -lcrypto -lssl" with OpenSSL on Windows with MinGW
But the build always fails with multiple files missing the include bits/libc-header-start.h. My thinking was if I can get the windows dlls on the linux system maybe that was what mingw needed.
I have tried to install gcc-multilib as suggested in this post "fatal error: bits/libc-header-start.h: No such file or directory" while compiling HTK but that leads to a basket of missing dependencies.
Is it even possible to build a Windows dll including openssl dependencies from a Debian dev environment?
Thanks for any assistance.
I am building a web server using the libwebsockets library on a TS-7800 board using the arm-linux-gcc cross compiler. Using Ubuntu. Installed CMake, OpenSSL, and libwebsockets and built the library per the instructions on Github.
I made a "hello world" C file which #includes libwebsockets.h
When I compile the executable with gcc, it compiles fine and the .exe runs.
When I compile with arm-linux-gcc, I get the following:
root#gordon-MS-7A39:/# arm-linux-gcc -o hellosockets /home/gordon/workspace/HelloCrossWorld/hello_cross.c
/home/gordon/workspace/HelloCrossWorld/hello_cross.c:3:27: libwebsockets.h: No such file or directory
It appears that arm-linux-gcc compiler cannot "see" the header file for libwebsockets. I'm guessing that the installation of the websockets library was successful because gcc can see it.
How do I enable the arm cross compiler to see the libwebsockets.h file?
Thank you for your input!
You'll need to add armhf architecture to your package management system. Perform the following actions as super user:
dpkg --add-architecture armhf
apt update
apt install libwebsockets-dev:armhf
Make sure you're also using the armhf toolchain:
apt install binutils-arm-linux-gnueabihf g++-arm-linux-gnueabihf
Alternatively, take a look at Buildroot
I was unaware of the -I and -L preprocessor options for gcc and arm-linux-gcc.
I was able to add libraries to the project and will look into creating makefiles for the project.
I'm trying to make an "C" application for my NXP(Freescale) imx6 that Debian OS installed on it. My host machine is Ubuntu 16.04. I'm using eclipse as an IDE and I can manage to cross compile until today. I use arm-linux-gnueabihf-gcc as an compiler and arm-linux-gnueabihf-ld as an linker. I added -lasound option to my linker parameter, but still can not build the application. I get an error
arm-linux-gnueabihf-ld: cannot find -lasound
I think I don't have the libasound.so file on my Ubuntu (Host) machine and my linker couldn't link to library to my application.
I copied the libasound.so file from my ARM machine to my host machine to the /home/user/Downloads folder, but still couldn't compile.
Is there a step to use ALSA library in Cross Compilation project before build?
Here is the output of build operation
Building target: tihc_linux_application
Invoking: GCC C Linker
/usr/bin/arm-linux-gnueabihf-ld -static -L/home/user/Downloads -pthread -lasound -o "main" ./src/main.o
/usr/bin/arm-linux-gnueabihf-ld: mode armelf_linux_eabi
/usr/bin/arm-linux-gnueabihf-ld: cannot find -lasound
You ask for static link (via -static) but provide shared library so ld probably ignores it (to be sure you can run with -Wl,--verbose). One option is to cross-compile libalsa from scratch and then use resulting static lib to link your app. Another option is to search for pre-compiled gnueabihf libalsa somewhere...
I have a problem while compiling Vim 7.4 under AIX 6.1.
My options for the configure script are: "--prefix /opt/freeware/bin" and "--enable-pythoninterp".
There where no Errors while running the configure Script but when I try to run "make" I get the error message:
cd src && make first
cc -qlanglvl=extc89 -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_ATHENA -DFUNCPROTO=15 -g -o objects/regexp.o regexp.c "regexp_nfa.c"
line 4410.1: 1506-046 (S) Syntax error.
make: 1254-004 > The error code from the last command is
1.
Stop. make: 1254-004 The error code from the last command is 2.
Stop.
Does anyone know what to do?
I had compiled Vim 7.4 in my home directory so I know that there is a workaround but I can't find it anymore.
AIX's built in make (based on standard AT&T make) is not compatible with the Makefiles built by autoconf tools. Use GNU make (gmake) instead. You may already have it installed (check /opt/freeware/bin), install from the Linux Toolbox for AIX set (from IBM), or from one of the websites providing prebuilt GNU tools for AIX systems (perzl, bullfreeware, etc). Just provide an alias from make to gmake, or override the use of make in the Makefile itself.
C:\slite\1.1>gcc -c ".\src\SDR.c" -o ".\obj\SDR.o" -I".\inc"
C:\slite\1.1>gcc ".\obj\SDR.o" -o ".\exe\SDR.exe" -L".\lib" -lsres -lshis
.\lib/sres.dll: file not recognized: File format not recognized
collect2: ld returned 1 exit status
Could not compile C program using gcc after installing cygwin in Windows 2003.
Before installing cygwin, I was able to compile successfully.
I am compiling the code from Command prompt, not from cygwin terminal.
The gcc being used is from Dev-Cpp distribution.
Is the problem because of the directory separator ('/') between the libraries directory specified by -L and individual libs specified by -l, being used by gcc after cygwin was installed?
If i try to compile in cygwin terminal I am getting unknown function calls error, though the functions are defined in the headers included.
EDIT:
C:\srmlite\x7.5.0.146-1600>where gcc
C:\Dev-Cpp\bin\gcc.exe
The gcc was not from cygwin.
I have uninstalled cygwin and removed its directory too. I still see this problem.
Try to add the correct bin directory into the path in your Environment variables.
Something like this: C:\soft\cygwin\bin
Seems that Cygwin modified the default environment, adding itself to %PATH%, so you're actually calling cygwin's gcc, check that out.