libwebsocket Linux Eclipse file format not recognized - linux

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 )

Related

Building Debian with Buildroot: libDeviceIo.so: file format not recognized

Im trying to compile for a project debian for this device: https://www.engicam.com/vis-prod/PX30-Core/PX30-Core-EDIMM-SOM-based-on-RockChip--PX30 which has an aarch64 architecture. I'm using a VM provided by them which should already have all the tools and configurations ready, but I'm running into some issues. If I've understood correctly I have to build buildroot to build Debian, after adding a couple packages with make menuconfig and running make I get this error:
PATH="/home/user/px30/buildroot/output/host/bin:/home/user/px30/buildroot/output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" /usr/bin/make -j9 CXXFLAGS+="-DRKDEVICEIO -I/home/user/px30/buildroot/../external/deviceio_release/DeviceIO/include" LFLAGS+=" -lDeviceIo -lasound" -C /home/user/px30/buildroot/output/build/qsetting-1.0
make[1]: Entering directory '/home/user/px30/buildroot/output/build/qsetting-1.0'
/home/user/px30/buildroot/output/host/bin/aarch64-buildroot-linux-gnu-g++ -lDeviceIo -lasound -o qsetting main.o mainwindow.o qtaudio.o qtbt.o qtfactory.o qtinputdialog.o qtkeyboard.o qtupdate.o qtwifi.o qrc_res.o moc_mainwindow.o moc_qtaudio.o moc_qtbt.o moc_qtfactory.o moc_qtinputdialog.o moc_qtkeyboard.o moc_qtupdate.o moc_qtwifi.o -lQt5Widgets -lQt5Multimedia -lQt5Gui -lQt5Network -lQt5Core -latomic -lrt -ldl /home/user/px30/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libGLESv2.so -lpthread -lrt -lpthread -ldl
/home/user/px30/buildroot/output/host/lib/gcc/aarch64-buildroot-linux-gnu/6.5.0/../../../../aarch64-buildroot-linux-gnu/bin/ld:/home/user/px30/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib64/libDeviceIo.so: file format not recognized; treating as linker script
/home/user/px30/buildroot/output/host/lib/gcc/aarch64-buildroot-linux-gnu/6.5.0/../../../../aarch64-buildroot-linux-gnu/bin/ld:/home/user/px30/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib64/libDeviceIo.so:0: syntax error
collect2: error: ld returned 1 exit status
Makefile:214: recipe for target 'qsetting' failed
make[1]: *** [qsetting] Error 1
make[1]: Leaving directory '/home/user/px30/buildroot/output/build/qsetting-1.0'
package/pkg-generic.mk:254: recipe for target '/home/user/px30/buildroot/output/build/qsetting-1.0/.stamp_built' failed
make: *** [/home/user/px30/buildroot/output/build/qsetting-1.0/.stamp_built] Error 2
I tried to open /px30/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libDeviceIo.so and it's an ASCII file
user#ubuntu:~/px30/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib$ cat libDeviceIo.so
fake
user#ubuntu:~/px30/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib$ file libDeviceIo.so
libDeviceIo.so: ASCII text
EDIT: I did not find a solution, I solved it by removing the package qsetting from the target packages

ld: error: unable to find library -lmysqlclient

I am trying to compile my game program and it s giving me this
root#vps:/usr/src/Sursa/Server/source/game/src # gmake -j20
linking ../game
ld: error: unable to find library -lmysqlclient
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [Makefile:228: ../game] Error 1
root#vps:/usr/src/Sursa/Server/source/game/src #
This is my Makefile path for library
# mysql
INCDIR += -I../../../extern/mysql
LIBDIR += -L/usr/local/lib/mysq
LIBS += -lmysqlclient -lz -pthread -lm -lssl -lcrypto
### END
You need to update your GCC compiler since some features of c++14 is not supported by gcc4.9.
You can search the available packages in FreeBSD using
pkg search <package_name>
and install whatever you want via
pkg install <package_name>
Note : you might need sudo before those commands if your current user is not root
Finally if you have problems such as
Fatal error : "some_file"."some_extension" file not found
you can search the package name via the aforementioned command and install them in order to compile successfully.
For example to mitigate the following error
fatal error: 'boost/intrusive_ptr.hpp' file not found
you can install the boost-libs package.

Linker error in Codelite with MinGW-w64

I'm trying to use MinGW-W64 instead of MinGW in Codelite. When I compile simple "hello, world" project it's all right. But when I try to link some libraries, I get a strange linker error. Project with exactly same settings compiles by MinGW with any problems. There are build output for both variants:
MinGW GCC 4.8.1
`C:\Windows\system32\cmd.exe /C D:/apps/mingw/bin/mingw32-make.exe -j8 SHELL=cmd.exe -e -f Makefile
"----------Building project:[ code - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'D:/Projects/codelite/code'
codelite-cc D:/apps/mingw/bin/g++.exe -c "D:/Projects/codelite/code/src/main.cpp" -Wfatal-errors -g -O0 -pedantic -W -std=c++11 -Wall -o ./Debug/src_main.cpp.o -I./inc/
D:/apps/mingw/bin/g++.exe -o bin/code #"code.txt" -L./lib/ -lopengl32
mingw32-make.exe[1]: Leaving directory 'D:/Projects/codelite/code'
====0 errors, 0 warnings====`
MinGW-W64 GCC 5.2.0
`C:\Windows\system32\cmd.exe /C D:/apps/mingw-w64/mingw32/bin/mingw32-make.exe -j8 SHELL=cmd.exe -e -f Makefile
"----------Building project:[ code - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'D:/Projects/codelite/code'
codelite-cc D:/apps/mingw-w64/mingw32/bin/g++.exe -c "D:/Projects/codelite/code/src/main.cpp" -Wfatal-errors -g -O0 -pedantic -W -std=c++11 -Wall -o ./Debug/src_main.cpp.o -I./inc/
D:/apps/mingw-w64/mingw32/bin/g++.exe -o bin/code #"code.txt" -L./lib/ -lopengl32
g++.exe: error: #code.txt -L./lib/: No such file or directory
mingw32-make.exe[1]: *** [bin/code] Error 1
code.mk:78: recipe for target 'bin/code' failed
mingw32-make.exe[1]: Leaving directory 'D:/Projects/codelite/code'
mingw32-make.exe: *** [All] Error 2
Makefile:4: recipe for target 'All' failed
====1 errors, 0 warnings====`
This looks like a bug in your toolchain and not in CodeLite.
There is a space between the "#code.text" and -L./lib and for some reason g++ does not see it...
I put my money on the mingw32-make tool. You can tell CodeLite to use the mingw32-make.exe from the 4.8.1 version (which worked): settings->build settings->compilers->[YOUR COMPILER NAME]->Make
Another option is to disable the option that tells CodeLite to generate Makefile that passes the object list via file to the compiler:
Settings->Build Settings->compilers->[YOUR COMPILER NAME]->Advanced tab and uncheck the option: pass object list to the linker via file
Lately i too have found the similar problem. Later i was able to figure out the issue. We just to need to go to the project settings under change makefile generator default to codelite makefile generator i think that will work.

ssocr #my_libs#: No such file or directory

I recently downloaded ssocr, and also install all dependencies. But when I want to run make I get the following error:
cc: error: #my_libs#: No such file or directory
make: * [ssocr] Error 1
I have no idea what is the problem and also can't find any solution for it.
The os i have tryed to intall the ssocr is Ubuntu 14.04 LTS (Trusty Tahr)
UPDATE (whole output)
cc ssocr.o imgproc.o help.o -L/usr/local/lib -lImlib2 #my_libs# -o ssoc
cc: error: #my_libs#: No such file or directory
make: * [ssocr] Error 1
the link-command comes from
imlib2-config --libs
Try to repair the imlib2-config output. Second, I had also to add -lm. The commandline looks for me like
cc ssocr.o imgproc.o help.o -L/usr/lib64 -lImlib2 -L/lib64 -lX11 -lm -o ssocr

cmake fortran undefined reference to MAIN__ on linux

I trying to get a cmake build system working on linux. The project contains a bunch of executables and two libraries. One of the executables is first built as a library, then that library is linked with the object file containing the man subroutine. This was done because the rest of the executables depend on that library. The tricky part is that the main subroutine is defined inside a module that the rest of sources depend on so this needs to be compiled before the rest of the sources. The effect is that the main subroutine gets added to the resulting library. This seems to work fine on Mac OS X but, the linking state fails on Linux.
The cmake file for the failing part looks like
cmake_minimum_required (VERSION 2.8)
# Create an empty variable to hold all the source files.
set (vmec_sources "")
# Add subdirectory for all the sources.
add_subdirectory (Sources)
add_library (vmec STATIC ${vmec_sources})
add_dependencies (vmec stell)
# Define an executable and link all libraries.
add_executable (xvmec ${CMAKE_CURRENT_SOURCE_DIR}/Sources/General/vmec_main.f)
add_dependencies (xvmec vmec)
target_link_libraries (xvmec vmec stell)
if ((NOT ${NETCDF_C} STREQUAL "") AND (NOT ${NETCDF_F} STREQUAL ""))
target_link_libraries (xvmec ${NETCDF_C} ${NETCDF_F})
endif ()
When running cmake, everything configures fine and generates a make file when I run make Mac OS X everything works fine. When I run make on Linux it fails.
The output from the make VERBOSE=1 On Linux produces
Linking Fortran executable ../build/bin/xvmec
cd /home/user/reconstruction/VMEC2000 && /usr/bin/cmake -E cmake_link_script CMakeFiles/xvmec.dir/link.txt --verbose=1
/usr/bin/gfortran -cpp -D NETCDF -I /usr/include CMakeFiles/xvmec.dir/Sources/General/vmec_main.f.o -o ../build/bin/xvmec -rdynamic ../build/lib/libvmec.a ../build/lib/libstell.a /usr/lib/libnetcdf.so /usr/lib/libnetcdff.so
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/libgfortranbegin.a(fmain.o): In function `main':
(.text+0x26): undefined reference to `MAIN__'
collect2: ld returned 1 exit status
make[2]: *** [build/bin/xvmec] Error 1
make[2]: Leaving directory `/home/user/reconstruction'
make[1]: *** [VMEC2000/CMakeFiles/xvmec.dir/all] Error 2
make[1]: Leaving directory `/home/user/reconstruction'
make: *** [all] Error 2
On Mac OS X, I get
Linking Fortran executable ../build/bin/xvmec
cd /Users/user/repo/trunk/VMEC2000 && "/Applications/CMake 2.8-8.app/Contents/bin/cmake" -E cmake_link_script CMakeFiles/xvmec.dir/link.txt --verbose=1
/usr/local/bin/gfortran -framework Accelerate -cpp -D DARWIN -D NETCDF -I /Users/user/NetCDF/include -O3 -ftree-vectorize -m64 -march=native -fomit-frame-pointer -falign-functions -mfpmath=sse CMakeFiles/xvmec.dir/Sources/General/vmec_main.f.o -o ../build/bin/xvmec ../build/lib/libvmec.a ../build/lib/libstell.a /Users/user/NetCDF/lib/libnetcdf.dylib /Users/user/NetCDF/lib/libnetcdff.dylib
"/Applications/CMake 2.8-8.app/Contents/bin/cmake" -E cmake_progress_report /Users/user/repo/trunk/CMakeFiles 100
[100%] Built target xvmec
The link line looks like it is linking all the same stuff in the correct order so I don't understand why this is failing on Linux.
Turns out I had the wrong file listed as containing the main method. It seems that later versions of gfortran can link 'MAIN__' from a inside a library while gfortran-4.4 cannot.

Resources