I'm trying to build one application with cross compiler on linux. Application is based on OpenEmbedded project. Compiler and all cross compiled libraries are located in build folder. But for one package build script is trying to use a library from my linux environment.
Command which is called from make script at the end:
/bin/sh ./arm-ABC-linux-gnueabi-libtool --tag=CXX --mode=link
arm-ABC-linux-gnueabi-g++ -march=armv7-a -mtune=cortex-a8
-mfpu=neon -mfloat-abi=softfp -g --std=c++0x -pthread -L/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/opt/my/lib
-Wl,-rpath-link,/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/opt/my/lib
-Wl,-O1 -Wl,--hash-style=gnu -L/opt/my/lib -o modbus_server_test modbus_server_test.o Serial.o SerialUtil.o Crc.o RtuFramer.o Pdu.o
SerialMaster.o
/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/usr/local/apr/lib/libapr-2.la
-lcrypt -luuid -lrt -lcrypt -lpthread -ldl -lexpat -lstdc++
Most important from here that is use -lexpat flag for libexpat.so.1.5.2 library. This library is cross compiled and located in the build folder, and at the same time, we have one in my linux environment.
As result I recieve the next error:
| arm-ABC-linux-gnueabi-libtool: link:
arm-ABC-linux-gnueabi-g++ -march=armv7-a -mtune=cortex-a8
-mfpu=neon -mfloat-abi=softfp -g --std=c++0x -pthread -Wl,-rpath-link -Wl,/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/opt/my/lib
-Wl,-O1 -Wl,--hash-style=gnu -o .libs/modbus_server_test modbus_server_test.o Serial.o SerialUtil.o Crc.o RtuFramer.o Pdu.o
SerialMaster.o
-L/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/opt/my/lib
-L/opt/my/lib /usr/local/apr/lib/libapr-2.so -L/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib
/usr/lib/x86_64-linux-gnu/libexpat.so
/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib/libuuid.so
-lrt -lcrypt -lpthread -ldl /home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib/libexpat.so
/home/ABC/build/build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib/libstdc++.so
-lm -pthread -Wl,-rpath -Wl,/usr/local/apr/lib -Wl,-rpath -Wl,/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib
| /usr/lib/x86_64-linux-gnu/libexpat.so: file not recognized: File
format not recognized
| collect2: ld returned 1 exit status
| make[2]: *** [modbus_server_test] Error 1
From output I can see that it include two libraries: one from linux environment (/usr/lib/x86_64-linux-gnu/libexpat.so which is x86) and one from the build folder (build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib/libexpat.so which is for ARM).At the end it complains about x86 type.
How can I exclude this library from searching in global environment? Why it even trying to use both of them?
Related
I am attempting to convert a working Makefile into a CMake and need a little assistance. I am trying to cross compile a small program for a yocto device from a Ubuntu20 machine that is trying to link to the devices shared object file with cmake. I have a working Makefile that builds a working program. However, when I try and do this with a CMakeList file it fails at the make stage linking to the shared objects linker flag.
The file structure of the code is as follows;
Parent
- include/
- file1.h
- file2.h
- xxx.h
- lib/
- libOBD2.so
- src/
- test.c
- CMakeLists.txt # Not working
- Makefile. # working
The shared object is being linked from within the program parent directory but I have also tried with it in the /usr/lib and /usr/local/lib from here but with no change.
The working Makefile
.prevent_execution:
exit 0
#remove # for no make command prints
DEBUG = #
APP_DIR = .
BUILD_DIR := $(APP_DIR)/build
SRC_DIRS := $(APP_DIR)/src
HEADER_DIR := $(APP_DIR)/include
APP_LIBRARY_DIR = $(APP_DIR)/lib
APP_NAME = test
# Locate all the source c and cpp files to be built
APP_SRC_FILES := $(shell find $(SRC_DIRS) -name '*.cpp' -or -name '*.c')
INC_DIRS := $(shell find $(HEADER_DIR) -type d)
# Add a prefix to INC_DIRS. So moduleA would become -ImoduleA. GCC understands this -I flag
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
CFLAGS+=-fPIC
PATH1 = /opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/include/
PATH2 = /opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/include/libxml2/
PATH3 = /opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/lib/
MAKE_CMD = -g -O0 -s -o $(BUILD_DIR)/$(APP_NAME) $(INC_FLAGS) $(APP_SRC_FILES) - I$(PATH1) -I$(PATH2) -L$(APP_LIBRARY_DIR) -lz -lOBD2 -lssl -lcrypto -lcurl -lxml2 -L$(PATH3) -lm -ldl -lpthread -lrt
all:
$(DEBUG) $(CC) $(CFLAGS) $(MAKE_CMD)
clean:
rm -f $(BUILD_DIR)/$(APP_NAME)
The CmakeLists.txt
cmake_minimum_required( VERSION 3.5 )
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR ARM)
# -fPIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
project(iwtest)
set(PATH1 "/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/include/")
set(PATH2 "/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/include/libxml2/")
set(PATH3 "/opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/lib")
set(LIB_DIR "${CMAKE_SOURCE_DIR}/lib")
include_directories(${PROJECT_NAME} PRIVATE ${PATH1})
include_directories(${PROJECT_NAME} PRIVATE ${PATH2})
include_directories(${PROJECT_NAME} PRIVATE "${PROJECT_SOURCE_DIR}/include")
set(SOURCE_FILES src/test.c)
add_definitions("-g")
add_definitions("-O0")
add_definitions("-s")
# Connect the libOBD2 library to the project
add_library(libOBD2 SHARED IMPORTED)
set_target_properties(libOBD2 PROPERTIES IMPORTED_LOCATION ${LIB_DIR}/libOBD2.so)
include_directories(libOBD2 INTERFACE ${CMAKE_SOURCE_DIR}/lib)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
# target_link_libraries(${PROJECT_NAME} PRIVATE ${PATH3})
target_link_libraries(${PROJECT_NAME} PUBLIC libOBD2)
target_link_options(${PROJECT_NAME} PRIVATE -lz -lOBD2 -lssl -lcrypto -lcurl -lxml2 -L$(PATH3) -lm -ldl -lpthread -lrt)
# target_link_options(${PROJECT_NAME} PRIVATE -I$(PATH1) -I$(PATH2) -L$(LIB_DIR) -lz -lOBD2 -lssl -lcrypto -lcurl -lxml2 -L$(PATH3) -lm -ldl -lpthread -lrt)
The output of cmake
-- Toolchain file defaulted to '/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/share/cmake/OEToolchainConfig.cmake'
-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dev/Workspace/build/cmakebuild
The output of make VERBOSE=1
/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -S/home/dev/Development/iwave-test-code -B/home/dev/Workspace/build/cmakebuild --check-build-system CMakeFiles/Makefile.cmake 0
/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E cmake_progress_start /home/dev/Workspace/build/cmakebuild/CMakeFiles /home/dev/Workspace/build/cmakebuild//CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/dev/Workspace/build/cmakebuild'
make -f CMakeFiles/iwtest.dir/build.make CMakeFiles/iwtest.dir/depend
make[2]: Entering directory '/home/dev/Workspace/build/cmakebuild'
cd /home/dev/Workspace/build/cmakebuild && /opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/dev/Development/iwave-test-code /home/dev/Development/iwave-test-code /home/dev/Workspace/build/cmakebuild /home/dev/Workspace/build/cmakebuild /home/dev/Workspace/build/cmakebuild/CMakeFiles/iwtest.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/dev/Workspace/build/cmakebuild'
make -f CMakeFiles/iwtest.dir/build.make CMakeFiles/iwtest.dir/build
make[2]: Entering directory '/home/dev/Workspace/build/cmakebuild'
[ 50%] Building C object CMakeFiles/iwtest.dir/src/test.c.o
/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi --sysroot=/opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi -I/home/dev/Development/iwave-test-code/iwtest -I/home/dev/Development/iwave-test-code/PRIVATE -I/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/include -I/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/include/libxml2 -I/home/dev/Development/iwave-test-code/include -I/home/dev/Development/iwave-test-code/libOBD2 -I/home/dev/Development/iwave-test-code/INTERFACE -I/home/dev/Development/iwave-test-code/lib -O2 -pipe -g -feliminate-unused-debug-types -fPIE -g -O0 -s -o CMakeFiles/iwtest.dir/src/test.c.o -c /home/dev/Development/iwave-test-code/src/test.c
In file included from /opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/include/bits/libc-header-start.h:33,
from /opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/include/stdio.h:27,
from /home/dev/Development/iwave-test-code/src/test.c:1:
/opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/include/features.h:382:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
382 | # warning _FORTIFY_SOURCE requires compiling with optimization (-O)
| ^~~~~~~
[100%] Linking C executable iwtest
/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E cmake_link_script CMakeFiles/iwtest.dir/link.txt --verbose=1
/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi --sysroot=/opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi -O2 -pipe -g -feliminate-unused-debug-types -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -lz -lOBD2 -lssl -lcrypto -lcurl -lxml2 "-L\$$(PATH3)" -lm -ldl -lpthread -lrt CMakeFiles/iwtest.dir/src/test.c.o -o iwtest -Wl,-rpath,/home/dev/Development/iwave-test-code/lib /home/dev/Development/iwave-test-code/lib/libOBD2.so
/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.2.0/real-ld: cannot find -lOBD2
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/iwtest.dir/build.make:104: iwtest] Error 1
make[2]: Leaving directory '/home/dev/Workspace/build/cmakebuild'
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/iwtest.dir/all] Error 2
make[1]: Leaving directory '/home/dev/Workspace/build/cmakebuild'
make: *** [Makefile:103: all] Error 2
Any help is much appreciated. Thanks in advance.
Thanks to Tsyvarev comment the solution was to remove the -lOBD2 from the target_link_options. As per Tsyvarev suggestion now all the linker options are linked through target_link_libraries.
The solution to the CMakeLists.txt
# remove the target_link_options line
# target_link_options(${PROJECT_NAME} PRIVATE -lz -lOBD2 -lssl -lcrypto -lcurl -lxml2 -L$(PATH3) -lm -ldl -lpthread -lrt)
# replace with
target_link_libraries(${PROJECT_NAME} PUBLIC libOBD2 pthread ssl crypto curl xml2 m dl rt)
On a side note, as i was cross-compiling for a yocto device the libOBD2.so was located in a different directory to the cross-compile pc of ${CMAKE_SOURCE_DIR}/lib. To fix this I copied libOBD2.so to the same directory seen on the device, in this case it was /usr/lib and change LIB_DIR to set(LIB_DIR "/usr/lib").
There's an easier way to do all this. I happen to be using the same toolchain, and likely the exact same iWave telematic device that you are. My CMakeLists.txt file is generic, nothing toolchain-specific in it at all (except the platform-specific library)...
cmake_minimum_required(VERSION 3.0.0)
project(testapp VERSION 0.1.0)
add_executable(testapp src/testapp.cpp)
target_include_directories(testapp PUBLIC include)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_directories(testapp PUBLIC lib)
target_link_libraries(testapp PRIVATE Threads::Threads libOBD2.so)
Once I have this file in my project folder, I run the following commands from the terminal:
source /opt/fsl-imx-x11/5.4-zeus/environment-setup-cortexa7t2hf-neon-poky-linux-gnueabi
mkdir build
cd build
cmake ..
make
CMake will now automatically detect the toolchain, and generate the appropriate makefiles to actually build your project. The nice thing is, if you're not linking in platform-specific libraries (such as the libOBD2.so file provided by iWave), you can easily retarget the build to another environment - I've successfully switched to a Raspberry Pi, or native Ubuntu. It all depends on what toolchain CMake detects when you run it. The "source" command sets that up, and CMake takes it all from there...
Regards,
David
I have a working Nitrogen6x board that runs on Yocto Krogoth-next build with core-image-sato. I have installed Qt Creator 3.5.1 (based on Qt 5.5.1) and I have added my kit for nitrogen6x board as per [Build & Install Qt5 toolchain] document. I have added a sample Qt Quick Application with component set chosen as Qt Quick 2.1 and tried to compile the source, I am noticing this below error.
19:04:25: Running steps for project untitled6...
19:04:25: Starting: "/opt/poky/2.1.1/sysroots/i686-pokysdk-linux/usr/bin/qt5/qmake" /home/test/untitled6/untitled6.pro -r -spec linux-g++
19:04:25: The process "/opt/poky/2.1.1/sysroots/i686-pokysdk-linux/usr/bin/qt5/qmake" exited normally.
19:04:25: Starting: "/usr/bin/make"
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../untitled6 -I. -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5 -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQuick -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtGui -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQml -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtNetwork -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtCore -I. -I/opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-g++ -o main.o ../untitled6/main.cpp
/opt/poky/2.1.1/sysroots/i686-pokysdk-linux/usr/bin/qt5/rcc -name qml ../untitled6/qml.qrc -o qrc_qml.cpp
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../untitled6 -I. -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5 -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQuick -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtGui -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQml -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtNetwork -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtCore -I. -I/opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-g++ -o qrc_qml.o qrc_qml.cpp
g++ -Wl,-O1 -o untitled6 main.o qrc_qml.o -lQt5Quick -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGLESv2 -lpthread
/usr/bin/ld: cannot find -lQt5Quick
/usr/bin/ld: cannot find -lQt5Gui
/usr/bin/ld: cannot find -lQt5Qml
/usr/bin/ld: cannot find -lQt5Network
/usr/bin/ld: cannot find -lQt5Core
/usr/bin/ld: cannot find -lGLESv2
collect2: ld returned 1 exit status
make: *** [untitled6] Error 1
19:04:26: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project untitled6 (kit: Nitrogen)
When executing step 'Make'
19:04:26: Elapsed time: 00:01.
All the Qt libraries are present under /sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/ and I have set the sysroot path correctly under my kit, but I am unable to figure out why is that my application is failing to reference those libraries. Any help on this is deeply appreciated. Thanks in advance.
The mkspec pointed to by your kit seem to be the wrong one (linux-g++), quoting from your build log
-I/opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-g++
When building for a nitrogen6x, it should likely be linux-oe-g++ instead. This is either set by default in the Qt version you selected, or can be set by modifying the Kit itself, in QtCreator's options, under "mkspec".
The error your's seeing is probably due to the fact the that the ABI & architecture of the libraries pointed are not compatible with the x86/64 code you compiled.
Also make sure to source Yocto's environment file before starting QtCreator if you encounter problems (namely compile error about "C" not found). This will setup the path to the cross-compiler. Example:
source /opt/poky/1.6.2/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
~/Qt/Tools/QtCreator/bin/qtcreator
I am trying to build the RTI perftest in an i86 QNX architecture. When I try to build the makefile that I generated, I get the following:
Checking directory obj/i86QNX6.6qcc_cpp4.7.3/Release
Checking directory ../bin/i86QNX6.6qcc_cpp4.7.3/Release
qcc -V4.7.3,gcc_ntox86 -Y_cpp -lang-c++ -m64 -Wall -o ../bin/i86QNX6.6qcc_cpp4.7.3/Release/perftest_cpp obj/i86QNX6.6qcc_cpp4.7.3/Release/test.o obj/i86QNX6.6qcc_cpp4.7.3/Release/testPlugin.o obj/i86QNX6.6qcc_cpp4.7.3/Release/testSupport.o obj/i86QNX6.6qcc_cpp4.7.3/Release/Property.o obj/i86QNX6.6qcc_cpp4.7.3/Release/RTIDDSImpl.o obj/i86QNX6.6qcc_cpp4.7.3/Release/perftest_cpp.o -L/opt/RTI/ndds.5.1.0/lib/i86QNX6.6qcc_cpp4.7.3 -lnddscppz -lnddscz -lnddscorez -lm -lsocket -lpthread -lnsl -lrt -L/usr/lib/nptl
/opt/qnx/6.6.0/host/linux/x86/usr/bin/i486-pc-nto-qnx6.6.0-ld: cannot find -lpthread
/opt/qnx/6.6.0/host/linux/x86/usr/bin/i486-pc-nto-qnx6.6.0-ld: cannot find -lnsl
/opt/qnx/6.6.0/host/linux/x86/usr/bin/i486-pc-nto-qnx6.6.0-ld: cannot find -lrt
cc: /opt/qnx/6.6.0/host/linux/x86/usr/bin/i486-pc-nto-qnx6.6.0-ld error 1
make: *** [../bin/i86QNX6.6qcc_cpp4.7.3/Release/perftest_cpp] Error 1
I am not to familiar with QNX and its libraries, but when I remove those flags I get a ton of errors. Any tips on how to build the perftest for QNX or dealing with this error would be great, thanks!
My makefile has the following build line which resolves all symbols and results in a running executable:
qcc -o ../bin/i86QNX6.6qcc_cpp4.7.3/Release/perftest_cpp
obj/i86QNX6.6qcc_cpp4.7.3/Release/test.o
obj/i86QNX6.6qcc_cpp4.7.3/Release/testPlugin.o
obj/i86QNX6.6qcc_cpp4.7.3/Release/testSupport.o
obj/i86QNX6.6qcc_cpp4.7.3/Release/RTIDDSImpl.o
obj/i86QNX6.6qcc_cpp4.7.3/Release/perftest_cpp.o
-L/opt/RTI/rti_connext_dds-5.2.3/lib/i86QNX6.6qcc_cpp4.7.3
-lnddscppz -lnddscz -lnddscorez -lm -lsocket
-V4.7.3,gcc_ntox86 -Y_cpp -lang-c++ -Wall
Note that it has none of the libraries that you mention.
I am trying to cross-compile openssh for ARM.
I have suceesfully installed zlib and openssl.
I configured openssh package as following:
./configure --prefix=/usr/openssharm --host=arm -- oldincludedir=/usr/opensslarm/include --includedir=/usr/opensslarm/include --with-libs --with-zlib=/usr/zlibArm --with-ssl-dir=/usr/opensslarm --disable-etc-default-login CC=arm-linux-gnueabi-gcc AR=arm-linux-gnueabi-ar
Now when I am trying to make it, I get the following error:
arm-linux-gnueabi-ld -o ssh ssh.o readconf.o clientloop.o sshtty.o sshconnect.o sshconnect1.o sshconnect2.o mux.o roaming_common.o roaming_client.o -L. -Lopenbsd-compat/ -L/usr/opensslarm/lib -L/usr/zlibArm/lib -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -shared-fstack-protector-all -lssh -lopenbsd-compat -lcrypto -ldl -lutil -lz -lnsl -lresolv
arm-linux-gnueabi-ld: unrecognized option '-Wl,-z,relro'
I tried searching for the same, but could not get what the error is. I thought of modifying the LDFLAGS in the makefile but it was not useful either.
My LDFLAGS line look like:
LDFLAGS=-L. -Lopenbsd-compat/ -L/usr/opensslarm/lib -L/usr/zlibArm/lib -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -fstack-protector-all
What could be the possible solution of the same?
I really want to know where does this libgdbm comes from and it seems it has been in
/usr/lib/libgdbm.so.2.0.0
/usr/local/lib/libgdbm.a
/usr/local/lib/libgdbm.la
/usr/local/lib/libgdbm.so
/usr/local/lib/libgdbm.so.3
/usr/local/lib/libgdbm.so.3.0.0
, but perl says
I used the command:
cc -o try -O2 -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -fstack-protector -L/usr/local/lib try.c -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
./try
and I got the following output:
./try: error while loading shared libraries: libgdbm.so.4: cannot open shared object file: No such file or directory
The program compiled OK, but exited with status 127.
(The supplied flags or libraries might be incorrect.)
You have a problem. Shall I abort Configure [y]
Ok. Stopping Configure.
so many files, I don't know why perl can't find any of them.
Try adding "-R/usr/local/lib" to LDFLAGS and/or CFLAGS environment variables.
If Linux perhaps change the order of searched directories in /etc/ld.so.conf