cmake cross compile windows binary from WSL2 using clang/llvm - linux

I'm tring to compile windows binary from WSL2 using clang and llvm using this cmake file:
CMakeLists.txt
cmake_minimum_required(VERSION 3.25)
project(MyProject
VERSION 0.1.0
DESCRIPTION ""
HOMEPAGE_URL ""
LANGUAGES CXX
)
set(TARGET_NAME testapp)
file(GLOB_RECURSE SRC_FILES src/*.cpp)
add_executable(${TARGET_NAME} ${SRC_FILES})
target_compile_features(${TARGET_NAME}
PRIVATE cxx_std_20)
set(RELEASE_OPTIONS
-Wall
-Wextra
-flto
)
set(DEBUG_OPTIONS
-Wall
-Wextra
-fno-omit-frame-pointer
-fno-sanitize-recover=all
-fsanitize=address,undefined
)
target_compile_options(${TARGET_NAME}
PRIVATE
$<$<CONFIG:Release>:${RELEASE_OPTIONS}>
$<$<CONFIG:Debug>:${DEBUG_OPTIONS}>)
target_link_options(${TARGET_NAME}
PRIVATE
$<$<CONFIG:Release>:${RELEASE_OPTIONS}>
$<$<CONFIG:Debug>:${DEBUG_OPTIONS}>)
cmake/toolchians_windows.cmake
# set target operating to windows
set(CMAKE_SYSTEM_NAME Windows)
# set compiler to clang
set(CMAKE_C_COMPILER /usr/bin/clang)
set(CMAKE_C_COMPILER_TARGET x86_64-pc-windows-msvc)
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
set(CMAKE_CXX_COMPILER_TARGET x86_64-pc-windows-msvc)
set(CMAKE_RC_COMPILER /usr/bin/llvm-rc)
# where is the target environment located
set(CMAKE_FIND_ROOT_PATH
# libraries
"/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/lib/x64"
"/mnt/c/Program Files (x86)/Windows Kits/10/Lib/10.0.22000.0/um/x64"
"/mnt/c/Program Files (x86)/Windows Kits/10/Lib/10.0.22000.0/ucrt/x64"
# includes
"/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/include"
"/mnt/c/Program Files (x86)/Windows Kits/10/Include/10.0.22000.0/ucrt"
)
# adjust the default behavior of the FIND_XXX() commands:
# search programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# search headers and libraries in the target environment
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
cmake -S . -B build_windows -G 'Ninja Multi-Config' -DCMAKE_TOOLCHAIN_FILE='cmake/toolchains_windows.cmake'
However this configuraion fails to find libraries
...
CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:63 (message):
...
lld-link: error: could not open 'kernel32.lib': No such file or directory
lld-link: error: could not open 'user32.lib': No such file or directory
lld-link: error: could not open 'gdi32.lib': No such file or directory
lld-link: error: could not open 'winspool.lib': No such file or directory
lld-link: error: could not open 'shell32.lib': No such file or directory
lld-link: error: could not open 'ole32.lib': No such file or directory
lld-link: error: could not open 'oleaut32.lib': No such file or directory
lld-link: error: could not open 'uuid.lib': No such file or directory
lld-link: error: could not open 'comdlg32.lib': No such file or directory
lld-link: error: could not open 'advapi32.lib': No such file or directory
lld-link: error: could not open 'oldnames.lib': No such file or directory
lld-link: error: could not open 'msvcrtd.lib': No such file or directory
...
I thought providing these paths to CMAKE_FIND_ROOT_PATH handles finding libs/headers but it didn't.
So I added this code to the cmake/toolchains_windows.cmake
include_directories(
"/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/include"
"/mnt/c/Program Files (x86)/Windows Kits/10/Include/10.0.22000.0/ucrt")
link_directories(
"/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/lib/x64"
"/mnt/c/Program Files (x86)/Windows Kits/10/Lib/10.0.22000.0/um/x64"
"/mnt/c/Program Files (x86)/Windows Kits/10/Lib/10.0.22000.0/ucrt/x64")
Now it can compile hello world program!
cmake -S . -B build_windows -G 'Ninja Multi-Config' -DCMAKE_TOOLCHAIN_FILE='cmake/toolchains_windows.cmake'
cmake --build build_windows -v --config Release
# it works!
However when I try to use -fsanitize=address,undefined it fails.
...
FAILED: Debug/testapp.exe
: && /usr/bin/clang++ --target=x86_64-pc-windows-msvc -fuse-ld=lld-link -nostartfiles -nostdlib -O0 -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd -g -Xclang -gcodeview -Xlinker /su
bsystem:console -Wall -Wextra -fno-omit-frame-pointer -fno-sanitize-recover=all -fsanitize=address,undefined CMakeFiles/testapp.dir/Debug/src/main.cpp.obj -o Debug/testapp.exe -Xlin
ker /MANIFEST:EMBED -Xlinker /implib:Debug/testapp.lib -Xlinker /pdb:Debug/testapp.pdb -Xlinker /version:0.0 -L"/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/
MSVC/14.34.31933/lib/x64" -L"/mnt/c/Program Files (x86)/Windows Kits/10/Lib/10.0.22000.0/um/x64" -L"/mnt/c/Program Files (x86)/Windows Kits/10/Lib/10.0.22000.0/ucrt/x64" -lkernel32 -lu
ser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames && :
lld-link: error: could not open '/usr/lib64/clang/15.0.7/lib/windows/clang_rt.asan-x86_64.lib': No such file or directory
lld-link: error: could not open '/usr/lib64/clang/15.0.7/lib/windows/clang_rt.asan-x86_64.lib': No such file or directory
lld-link: error: could not open '/usr/lib64/clang/15.0.7/lib/windows/clang_rt.asan_cxx-x86_64.lib': No such file or directory
lld-link: error: could not open '/usr/lib64/clang/15.0.7/lib/windows/clang_rt.asan_cxx-x86_64.lib': No such file or directory
clang-15.0: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
clang_rt.asan-x86_64.lib is present in /mnt/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/lib/x64 so I don't know why this is not working...

Related

yocto arm-poky-linux-gcc eclipse linker missing libraries

For some time I try to compile and debug a simple hello word application written in C.
Unfortunately, meta-toolchain or populate_sdk generate strangle failures.
My simple application works fine(compile and debug) with the buildroot toolchain. With the installed arm-poky-linux... I get some errors.
I try to do in the same console to create env.
. /opt/poky/3.1.17/environment-setup-armv5e-poky-linux-gnueabi
and run eclipse.
make all
Building target: MangoPi-R3-Gpio.elf
Invoking: GNU Arm Cross C Linker
arm-poky-linux-gnueabi-gcc -mcpu=arm926ej-s -marm -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -Xlinker --gc-sections -Wl,-Map,"MangoPi-R3-Gpio.map" -o "MangoPi-R3-Gpio.elf" ./gpio-example.o ./gpio_lib.o
/opt/poky/3.1.17/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/real-ld: cannot find Scrt1.o: No such file or directory
/opt/poky/3.1.17/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/real-ld: cannot find crti.o: No such file or directory
/opt/poky/3.1.17/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/real-ld: cannot find crtbeginS.o: No such file or directory
/opt/poky/3.1.17/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/real-ld: cannot find -lgcc
/opt/poky/3.1.17/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/real-ld: cannot find -lgcc_s
/opt/poky/3.1.17/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/real-ld: cannot find -lc
/opt/poky/3.1.17/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/real-ld: cannot find -lgcc
/opt/poky/3.1.17/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/real-ld: cannot find -lgcc_s
/opt/poky/3.1.17/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/real-ld: cannot find crtendS.o: No such file or directory
/opt/poky/3.1.17/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/real-ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [makefile:57: MangoPi-R3-Gpio.elf] Błąd 1
What did I do wrong? All of the mentioned files are in the installed folder of poky toolchain.
I created my toolchain using two options
bitbake console-image -c populate_sdk
and
bitbake meta-toolchain
the result is the same as above.
Adding
--sysroot=/opt/poky/3.1.17/sysroots/armv5e-poky-linux-gnueabi
also not changing anything.

How to compile a Linux shared library on macOS using a custom LLVM installation (from Homebrew)?

My CMakeLists.txt:
cmake_minimum_required(VERSION 3.9)
project(Arkan)
# Specify the C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Build the native Arkan library
add_library(arkan SHARED
lib/cpp/greeting.cpp
)
set_target_properties(arkan PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(arkan PROPERTIES SOVERSION 0)
set_target_properties(arkan PROPERTIES PUBLIC_HEADER lib/cpp/include/arkan.hpp)
Just a simple library. I need to compile it on macOS for linux, so I've created a toolchain file:
set(triple x86_64-linux-gnu)
set(llvm /opt/homebrew/Cellar/llvm/13.0.1_1)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(CMAKE_IGNORE_PATH /Applications/Xcode.app)
set(CMAKE_PREFIX_PATH ${llvm})
set(CMAKE_C_COMPILER ${llvm}/bin/clang)
set(CMAKE_C_COMPILER_TARGET ${triple})
set(CMAKE_C_STANDARD_LIBRARIES ${llvm}/lib)
set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES ${llvm}/include/c++/v1)
set(CMAKE_C_LINK_EXECUTABLE ${llvm}/bin/llvm-link)
set(CMAKE_CXX_COMPILER ${llvm}/bin/clang++)
set(CMAKE_CXX_COMPILER_TARGET ${triple})
set(CMAKE_CXX_STANDARD_LIBRARIES ${llvm}/lib)
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${llvm}/include/clang)
set(CMAKE_CXX_LINK_EXECUTABLE ${llvm}/bin/llvm-link)
SET(CMAKE_AR ${llvm}/bin/llvm-ar)
SET(CMAKE_LINKER ${llvm}/bin/llvm-link)
SET(CMAKE_NM ${llvm}/bin/llvm-nm)
SET(CMAKE_OBJDUMP ${llvm}/bin/llvm-objdump)
SET(CMAKE_RANLIB ${llvm}/bin/llvm-ranlib)
However, when I configure the project, I get the error:
[100%] Built target arkan
-- The C compiler identification is Clang 13.0.1
-- The CXX compiler identification is Clang 13.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /opt/homebrew/Cellar/llvm/13.0.1_1/bin/clang
-- Check for working C compiler: /opt/homebrew/Cellar/llvm/13.0.1_1/bin/clang - broken
CMake Error at /opt/homebrew/Cellar/cmake/3.23.2/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"/opt/homebrew/Cellar/llvm/13.0.1_1/bin/clang"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/user/Projects/arkan/build/linux/x86_64/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make -f Makefile cmTC_bf6b9/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_bf6b9.dir/build.make CMakeFiles/cmTC_bf6b9.dir/build
Building C object CMakeFiles/cmTC_bf6b9.dir/testCCompiler.c.o
/opt/homebrew/Cellar/llvm/13.0.1_1/bin/clang --target=x86_64-linux-gnu -isystem /opt/homebrew/Cellar/llvm/13.0.1_1/include/c++/v1 -MD -MT CMakeFiles/cmTC_bf6b9.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_bf6b9.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_bf6b9.dir/testCCompiler.c.o -c /Users/user/Projects/arkan/build/linux/x86_64/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_bf6b9
/opt/homebrew/Cellar/cmake/3.23.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_bf6b9.dir/link.txt --verbose=1
/opt/homebrew/Cellar/llvm/13.0.1_1/bin/llvm-link
llvm-link: Not enough positional command line arguments specified!
Must specify at least 1 positional argument: See: /opt/homebrew/Cellar/llvm/13.0.1_1/bin/llvm-link --help
make[1]: *** [cmTC_bf6b9] Error 1
make: *** [cmTC_bf6b9/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
What do I need to set in my toolchain file yet? What am I doing wrongly?
UPD:
build.sh:
#!/bin/bash
# Variables
A_BUILDDIR=./build
A_OUTDIR=$A_BUILDDIR/out
A_THREADS=4
# Check for .env configuration
if [ -f .env ]; then
source .env
fi
# Create build and output directories if they do not exist
mkdir -p $A_BUILDDIR
mkdir -p $A_OUTDIR
#################
# Linux platform
#################
for ABI in "x86_64"; do
LINUX_BUILDDIR=$A_BUILDDIR/linux/$ABI
LINUX_OUTDIR=$A_OUTDIR/linux/$ABI
mkdir -p $LINUX_BUILDDIR
mkdir -p $LINUX_OUTDIR
cmake -S . -B $LINUX_BUILDDIR \
-DCMAKE_TOOLCHAIN_FILE=toolchains/${ABI}_linux_gnu.toolchain.cmake
cmake --build $LINUX_BUILDDIR -j $A_THREADS
cp $LINUX_BUILDDIR/*.so $LINUX_OUTDIR
done
UPD2:
After changing a toolchain file according to KamilCuk's comment, I got the next:
set(triple x86_64-linux-gnu)
set(llvm /opt/homebrew/Cellar/llvm/13.0.1_1)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(CMAKE_IGNORE_PATH /Applications/Xcode.app)
set(CMAKE_PREFIX_PATH ${llvm})
set(CMAKE_C_COMPILER ${llvm}/bin/clang)
set(CMAKE_C_COMPILER_TARGET ${triple})
set(CMAKE_C_STANDARD_LIBRARIES ${llvm}/lib)
set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES ${llvm}/include/c++/v1)
set(CMAKE_C_LINK_EXECUTABLE "${llvm}/bin/llvm-link <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
set(CMAKE_CXX_COMPILER ${llvm}/bin/clang++)
set(CMAKE_CXX_COMPILER_TARGET ${triple})
set(CMAKE_CXX_STANDARD_LIBRARIES ${llvm}/lib)
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${llvm}/include/clang)
set(CMAKE_CXX_LINK_EXECUTABLE "${llvm}/bin/llvm-link <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
SET(CMAKE_AR ${llvm}/bin/llvm-ar)
SET(CMAKE_LINKER ${llvm}/bin/llvm-link)
SET(CMAKE_NM ${llvm}/bin/llvm-nm)
SET(CMAKE_OBJDUMP ${llvm}/bin/llvm-objdump)
SET(CMAKE_RANLIB ${llvm}/bin/llvm-ranlib)
Unfortunately, I also got a new problem:
Run Build Command(s):/usr/bin/make -f Makefile cmTC_1d33d/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_1d33d.dir/build.make CMakeFiles/cmTC_1d33d.dir/build
Building C object CMakeFiles/cmTC_1d33d.dir/testCCompiler.c.o
/opt/homebrew/Cellar/llvm/13.0.1_1/bin/clang --target=x86_64-linux-gnu -isystem /opt/homebrew/Cellar/llvm/13.0.1_1/include/c++/v1 -MD -MT CMakeFiles/cmTC_1d33d.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_1d33d.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_1d33d.dir/testCCompiler.c.o -c /Users/user/Projects/arkan/build/linux/x86_64/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_1d33d
/opt/homebrew/Cellar/cmake/3.23.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_1d33d.dir/link.txt --verbose=1
/opt/homebrew/Cellar/llvm/13.0.1_1/bin/llvm-link CMakeFiles/cmTC_1d33d.dir/testCCompiler.c.o -o cmTC_1d33d /opt/homebrew/Cellar/llvm/13.0.1_1/lib
/opt/homebrew/Cellar/llvm/13.0.1_1/bin/llvm-link: CMakeFiles/cmTC_1d33d.dir/testCCompiler.c.o:1:1: error: expected top-level entity
ELF > � # # UH���E� �}�H�u��E���]� Homebrew clang version 13.0.1 zR x
A�C
/opt/homebrew/Cellar/llvm/13.0.1_1/bin/llvm-link: error: loading file 'CMakeFiles/cmTC_1d33d.dir/testCCompiler.c.o'
make[1]: *** [cmTC_1d33d] Error 1
make: *** [cmTC_1d33d/fast] Error 2
UPD3:
I've simplified my toolchain file basing on Tsyvarev's comment:
set(triple x86_64-linux-gnu)
set(llvm /opt/homebrew/Cellar/llvm/13.0.1_1)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(CMAKE_IGNORE_PATH /Applications/Xcode.app)
set(CMAKE_PREFIX_PATH ${llvm})
set(CMAKE_C_COMPILER ${llvm}/bin/clang)
set(CMAKE_C_COMPILER_TARGET ${triple})
set(CMAKE_C_FLAGS "-fuse-ld=lld")
set(CMAKE_CXX_COMPILER ${llvm}/bin/clang++)
set(CMAKE_CXX_COMPILER_TARGET ${triple})
set(CMAKE_CXX_FLAGS "-fuse-ld=lld")
And there are new errors:
clang-13: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
Linking C executable cmTC_3631b
/opt/homebrew/Cellar/cmake/3.23.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3631b.dir/link.txt --verbose=1
/opt/homebrew/Cellar/llvm/13.0.1_1/bin/clang --target=x86_64-linux-gnu -fuse-ld=lld CMakeFiles/cmTC_3631b.dir/testCCompiler.c.o -o cmTC_3631b
ld.lld: error: /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/lib/crt1.o: unknown file type
ld.lld: error: cannot open crti.o: No such file or directory
ld.lld: error: cannot open crtbegin.o: No such file or directory
ld.lld: error: unable to find library -lgcc
ld.lld: error: unable to find library -lgcc_s
ld.lld: error: unable to find library -lc
ld.lld: error: unable to find library -lgcc
ld.lld: error: unable to find library -lgcc_s
ld.lld: error: cannot open crtend.o: No such file or directory
ld.lld: error: cannot open crtn.o: No such file or directory

Compile from .o Files to .dll File in Linux

Im trying to compile/link .o file(s) into a .dll file under Ubuntu...
i get it nearly to work but i have a problem with static linking these .o file(s) ...
Here is what ive done:
First i installed all dependencies ... then i build the following application:
https://github.com/Zeranoe/mingw-w64-build
On my Ubuntu.
After that i create the .o files from the application with normal "sudo make" command...
Now i had all .o file(s) ready ... then i modified the .o files with "dlltool" so now i have the opportunity to link them to a .dll file with "mingw" ... it works only in "shared mode" ... not in "static mode" ...
this is the working command:
sudo /home/robert/Downloads/mingw-32/x86_64/i686/bin/i686-w64-mingw32-g++ -shared -lmsvcrt -Wl,-subsystem,windows *.o -o phpcppdll.dll
and this is not working:
sudo /home/robert/Downloads/mingw-32/x86_64/i686/bin/i686-w64-mingw32-g++ -static -lmsvcrt -Wl,-subsystem,windows *.o -o phpcppdll.dll
and then i get the following error - with this command:
/home/robert/Downloads/mingw-32/x86_64/i686/bin/../lib/gcc/i686-w64-mingw32/11.2.1/../../../../i686-w64-mingw32/bin/ld: /home/robert/Downloads/mingw-32/x86_64/i686/bin/../lib/gcc/i686-w64-mingw32/11.2.1/../../../../i686-w64-mingw32/lib/../lib/libmingw32.a(lib32_libmingw32_a-crt0_c.o):crt0_c.c:(.text+0x3c): undefined reference to `WinMain#16'
collect2: error: ld returned 1 exit status
but i dont get further maybe you have an idea ...
Okay - i got it to work with the -nostartfiles flag ... but it dont make sense because all .dlls are not static ... but shared ...

libwebsocket Linux Eclipse file format not recognized

I installed the libwebsocket library onto my Linux Ubuntu computer. It builds ok and installs.
When I add the library to Eclipse, the build completes (so can find all the required header files). The link fails with:
arm-dey-linux-gnueabi-gcc -march=armv7ve -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/opt/dey/2.6-r1/ccimx6ulsbc/dey-image-qt-x11/sysroots/cortexa7t2hf-neon-dey-linux-gnueabi -L/usr/local/lib -lrt -o "Ele" ./src/error_functions.o ./src/get_num.o ./src/globals.o ./src/gpio.o ./src/main.o ./src/timers.o ./src/uart.o -ldigiapix -lwebsockets -ljson-c
/opt/dey/2.6-r1/ccimx6ulsbc/dey-image-qt-x11/sysroots/x86_64-deysdk-linux/usr/libexec/arm-dey-linux-gnueabi/gcc/arm-dey-linux-gnueabi/7.3.0/real-ld: warning: library search path "/usr/local/lib" is unsafe for cross-compilation
/usr/local/lib/libwebsockets.so: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
make: *** [Ele] Error 1
makefile:30: recipe for target 'Ele' failed
Any ideas ? ( I am quite new to Linux )

skipfish - error in make

I'm trying to use skipfish on ubuntu latest version that I just downloaded. I'm following the instruction from this link http://digitivity.org/943/how-to-install-google-skipfish-on-ubuntu-linux
When I run "nice make" based on the article, I got this error below... Could anyone please help me to give some pointers to fix this issue? Thanks in advance.
michaelsync#ubuntu:~/Downloads/skipfish-2.09b$ nice make
cc -L/usr/lib/ssl/engines -L/usr/lib/ -L/usr/lib/ssl/ -L/usr/local/lib/ -L/opt/local/lib src/skipfish.c -o skipfish \
-O3 -Wno-format -Wall -funsigned-char -g -ggdb -I/usr/local/include/ -I/opt/local/include/ -I/usr/include/ -DVERSION=\"2.09b\" src/http_client.c src/database.c src/crawler.c src/analysis.c src/report.c src/checks.c src/signatures.c src/auth.c -lcrypto -lssl -lidn -lz -lpcre
In file included from src/skipfish.c:47:0:
src/signatures.h:24:18: fatal error: pcre.h: No such file or directory
compilation terminated.
src/http_client.c:40:18: fatal error: idna.h: No such file or directory
compilation terminated.
In file included from src/analysis.c:32:0:
src/signatures.h:24:18: fatal error: pcre.h: No such file or directory
compilation terminated.
src/signatures.c:27:18: fatal error: pcre.h: No such file or directory
compilation terminated.
make: *** [skipfish] Error 1
You are missing dev libraries. Run this command :
sudo apt-get install libpcre3-dev libidn11-dev

Resources