Collect2: error: ld returned 1 exit status *** [.pio/build/nodemcuv2/firmware.elf] Error 1 - visual-studio-code

I want to use ESP32 for my app. When I compile this code with PlatformIO I get the following error:
[env:nodemcuv2]
platform = https://github.com/Jason2866/platform-espressif32.git#feature/arduino-idf-v4.4
board = nodemcu-32s
framework = arduino
monitor_speed = 115200
I get this Error:
|-- <ESP32 BLE Arduino> 2.0.0
Building in release mode
Linking .pio/build/nodemcuv2/firmware.elf
/Users/juliusschmid/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
*** [.pio/build/nodemcuv2/firmware.elf] Error 1
I don't understand why I get this error message. Can someone help me and explain easily how I can fix the error?

Related

Protobuf for MATLAB fails to build in Cygwin

I am trying to build the protobuf compiler for MATLAB using github.com/BraunPhilipp/protobuf-matlab (forked from farsounders code). I followed the instructions at the site and I keep getting this error:
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles/protoc.dir/home/kiran/protobuf/src/google/protobuf/compiler/main.cc.o:main.cc:(.text+0x2f3): undefined reference to farsounder::protobuf::compiler::matlab::MatlabGenerator::MatlabGenerator()' /usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles/protoc.dir/home/kiran/protobuf/src/google/protobuf/compiler/main.cc.o:main.cc:(.text+0x3dc): undefined reference to farsounder::protobuf::compiler::matlab::MatlabGenerator::~MatlabGenerator()' /usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles/protoc.dir/home/kiran/protobuf/src/google/protobuf/compiler/main.cc.o:main.cc:(.text+0x57e): undefined reference to `farsounder::protobuf::compiler::matlab::MatlabGenerator::~MatlabGenerator()' collect2: error: ld returned 1 exit status
Any help would be great

/usr/bin/ld: cannot find -ll collect2: error: ld returned 1 exit status

I am trying to compile this lex program but the i am getting this message
/usr/bin/ld: cannot find -ll
collect2: error: ld returned 1 exit status
I tried to compile by typing this
cc first.yy.c -oexe -ly

using legacy librealsense in qtcreator and cmake

I want to setup qt-creator for developing legacy librealsense in ubuntu16.04. I want to use CMake. I have librealsense installed on my system and the header files are in the "/usr/local/include" and the "librealsense.so" file is in the "/usr/local/lib". so I've created a simple CPP project with CMakeLists.txt and main.cpp files. my files are as follow:
main.cpp file:
#include <iostream>
#include <librealsense/rs.hpp>
int main()
{
rs::context ctx;
std::cout << "Hello World!" << std::endl;
return 0;
}
CMakeLists.txt file:
cmake_minimum_required(VERSION 2.8)
project(realsense_r200)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
find_library(librealsense REQUIRED)
add_executable(${PROJECT_NAME} "main.cpp")
target_link_libraries(${PROJECT_NAME} ${librealsense_LIBRARY})
target_include_directories(${PROJECT_NAME} PRIVATE ${librealsense_INCLUDE_DIR})
there are two problems:
find_library(), can't find the librealsense and in the CMake cache list, in front of librealsense, I get NOT_FOUND.
to solve the first problem I added the "librealsense.so" path manually in the cache list. so I have no errors in the generation of make files. but how can I set it up to find the path automatically?
when I try to build my project I have undefined reference errors to some methods as below:
CMakeFiles/realsense_r200.dir/main.cpp.o: In function `rs_apply_depth_control_preset(rs_device*, int)':
main.cpp:(.text+0x61d): undefined reference to `rs_set_device_options'
CMakeFiles/realsense_r200.dir/main.cpp.o: In function `rs_apply_ivcam_preset(rs_device*, rs_ivcam_preset)':
main.cpp:(.text+0x734): undefined reference to `rs_reset_device_options_to_default'
main.cpp:(.text+0x7d1): undefined reference to `rs_set_device_options'
main.cpp:(.text+0x869): undefined reference to `rs_set_device_options'
main.cpp:(.text+0x8ba): undefined reference to `rs_set_device_options'
CMakeFiles/realsense_r200.dir/main.cpp.o: In function `rs::error::error(rs_error*)':
main.cpp:(.text._ZN2rs5errorC2EP8rs_error[_ZN2rs5errorC5EP8rs_error]+0x2a): undefined reference to `rs_get_error_message'
main.cpp:(.text._ZN2rs5errorC2EP8rs_error[_ZN2rs5errorC5EP8rs_error]+0x74): undefined reference to `rs_get_failed_function'
main.cpp:(.text._ZN2rs5errorC2EP8rs_error[_ZN2rs5errorC5EP8rs_error]+0x9b): undefined reference to `rs_get_failed_function'
main.cpp:(.text._ZN2rs5errorC2EP8rs_error[_ZN2rs5errorC5EP8rs_error]+0x102): undefined reference to `rs_get_failed_args'
main.cpp:(.text._ZN2rs5errorC2EP8rs_error[_ZN2rs5errorC5EP8rs_error]+0x129): undefined reference to `rs_get_failed_args'
main.cpp:(.text._ZN2rs5errorC2EP8rs_error[_ZN2rs5errorC5EP8rs_error]+0x190): undefined reference to `rs_free_error'
CMakeFiles/realsense_r200.dir/main.cpp.o: In function `rs::context::context()':
main.cpp:(.text._ZN2rs7contextC2Ev[_ZN2rs7contextC5Ev]+0x30): undefined reference to `rs_create_context'
CMakeFiles/realsense_r200.dir/main.cpp.o: In function `rs::context::~context()':
main.cpp:(.text._ZN2rs7contextD2Ev[_ZN2rs7contextD5Ev]+0x1c): undefined reference to `rs_delete_context'
CMakeFiles/realsense_r200.dir/build.make:94: recipe for target 'realsense_r200' failed
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/realsense_r200.dir/all' failed
Makefile:83: recipe for target 'all' failed
collect2: error: ld returned 1 exit status
make[2]: *** [realsense_r200] Error 1
make[1]: *** [CMakeFiles/realsense_r200.dir/all] Error 2
make: *** [all] Error 2
18:32:02: The process "/usr/bin/cmake" exited with code 2.
Error while building/deploying project realsense_r200 (kit: Desktop)
When executing step "CMake Build"
as you see in the CMakeLists.txt file I've linked the "librealsense.so" file to the executable, why I get these errors and how can I solve it?
thanks for your help!!!
#
Edited Part
I changed my cmake file as below:
new CMake file:
cmake_minimum_required(VERSION 2.8)
project(realsense_r200)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
find_library(REALSENSE librealsense)
find_package(Threads)
add_executable(${PROJECT_NAME} "main.cpp")
target_link_libraries(${PROJECT_NAME} ${REALSENSE} ${CMAKE_THREAD_LIBS_INIT})
the undefined errors have gone, but I have new errors as below:
/usr/local/lib/librealsense.so: undefined reference to `std::thread::_State::~_State()#GLIBCXX_3.4.22'
/usr/local/lib/librealsense.so: undefined reference to `typeinfo for std::thread::_State#GLIBCXX_3.4.22'CMakeFiles/realsense_r200.dir/build.make:95: recipe for target 'realsense_r200' failed
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/realsense_r200.dir/all' failed
Makefile:83: recipe for target 'all' failed
/usr/local/lib/librealsense.so: undefined reference to `std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)())#GLIBCXX_3.4.22'
collect2: error: ld returned 1 exit status
make[2]: *** [realsense_r200] Error 1
make[1]: *** [CMakeFiles/realsense_r200.dir/all] Error 2
make: *** [all] Error 2
23:35:55: The process "/usr/bin/cmake" exited with code 2.
Error while building/deploying project realsense_r200 (kit: Desktop)
When executing step "CMake Build"

Redis build fails on new RaspberryPi 4 using Raspbian Buster

I am getting a linker error when trying to build redis-stable (should be 5.0.5) on raspbian buster running on the latest Raspberry Pi 4
make goes through the motions and then fails with the following
LINK redis-server
/usr/bin/ld: networking.o: in function `createClient':
/home/pi/redis-stable/src/networking.c:109: undefined reference to `__atomic_fetch_add_8'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:219: redis-server] Error 1
make[1]: Leaving directory '/home/pi/redis-stable/src'
make: *** [Makefile:6: all] Error 2
Am I missing a setting somewhere?
I was able to get all the tests to run successfully by adding the compiler flag -latomic only to the redis-server
# redis-server
$(REDIS_SERVER_NAME): $(REDIS_SERVER_OBJ)
$(REDIS_LD) -o $# $^ ../deps/hiredis/libhiredis.a ../deps/lua/src/liblua.a $(FINAL_LIBS) -latomic
EDIT: This is with Redis 5.0.5
I was able to run by adding the compiler flag -latomic only to the haproxy
[error]
/home/pi/CQ/LB/haproxy-1.8.21/src/proto_http.c:12152: undefined reference to `__atomic_fetch_add_8'
..........................................
..........................................
/usr/bin/ld: src/proto_http.o:/home/pi/CQ/LB/haproxy-1.8.21/src/proto_http.c:4200: more undefined references to `__atomic_fetch_add_8' follow
/usr/bin/ld: src/time.o: in function `tv_update_date':
/home/pi/CQ/LB/haproxy-1.8.21/src/time.c:229: undefined reference to `__atomic_compare_exchange_8'
collect2: error: ld returned 1 exit status
make: *** [Makefile:914: haproxy] error 1
[adding]
913 haproxy: $(OPTIONS_OBJS) $(EBTREE_OBJS) $(OBJS)
914 $(LD) $(LDFLAGS) -o $# $^ $(LDOPTS) -latomic

Jailbreak dev - error creating tweak

I'm trying to create an iphone tweak, but I can not compile the tweak. It always comes up with this error.
What could be the problem?
TWEAK.M
%hook SBCallAlertDisplay
- (void)updateLCDWithName:(id)name label:(id)label breakPoint:(unsigned)point
{
name = #"dasdasdasdasdasds";
%orig;
}
%end
MAKE FILE
include theos/makefiles/common.mk
export GO_EASY_ON_ME=1
TWEAK_NAME = tete
tete_FILES = Tweak.xm
tete_FRAMEWORKS = UIKit
include $(THEOS_MAKE_PATH)/tweak.mk
MAKE
sudo make
Making all for tweak tete...
Linking tweak tete...
Undefined symbols for architecture armv6:
"_MSHookMessageEx", referenced from:
global constructors keyed to Tweak.xm.mmin Tweak.xm.o
ld: symbol(s) not found for architecture armv6
collect2: ld returned 1 exit status
make[2]: *** [.theos/obj/tete.dylib] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [tete.all.tweak.variables] Error 2
"substrate.h" defines it. Lib is libsubstrate.dylib. But you don't have to #include the .h or link explicitly with the library. Theos should take care of it when you create a Tweak.