libcurl.so.4 linking issue: `
Description:
I have created a new component in openwrt. I could build the component along with openwrt Make.
When linking with libcurl.so.4, the build fails.
"#include <curl/curl.h> #include <iostream.h>
are included.
CURL *c1;
c1=curl_easy_init();
When i build this code, the build fails with Undefined Reference : curl_easy_init()".
i have included LIBS+=-L~/target..../curl/lib path for linking
Can someone please suggest the solution on accessing the base libraries and linking them with the user defined components in openwrt.
It would be very greatful.
When i build my component, the code is getting compiled with libcurl from ubuntu rather than using libcurl from openwrt.
You only added the library path with -L, not the library itself. You'll need to pass -lcurl as well.
Also, a ~ might no be resolved to a complete path when processed outside of the shell, so pass a complete, absolute path there (LIBS+=-L/home/yourself/...)
Yes, this is an OpenWrt buildroot integrity check to ensure that your program package depends on all libraries it requires. To solve that, specify DEPENDS:=+libcurl in your Package/xxx section.
i have added DEPENDS:=+libcurl it is not able to generate .ipk file. Any sample example would help. Any additional settings are env variables to be set ? It is automatically refererring to the libcurl library in /usr/lib/x86.../libcurl-gnutls-dev.so.4. When already the libcurl and its ipk are available in openwrt, why to link externally.
Actual error messages as well as your current Makefile are needed to help you here. Statements like "is not able to generate .ipk file" do not help.
My assumption is that your inner application makefile (the non-OpenWrt one) is not cross compile safe and hardcodes things like "gcc" instead of referring to $(CC)
Please let me know if there is any mistake. It is referring to /usr/lib libraries. Now, while typing here, i have just removed the below part from outer Makefile and compiled again and now it generated the .ipk file for my component.
First of all remove the Build/Compile override, remove any CURL_LIB:= assignments, then proceed with make package/samplepgm/{clean,compile} V=sc and post the resulting errors here, if any.
Since you redefined Build/Compile to a manual $(MAKE) invocation, you dropped the passing of $(MAKE_FLAGS) which includes things like CC="$(TARGET_CC)" - this causes your inner Makefile to use the host compiler instead of the OpenWrt toolchain.
Package samplepgm is missing dependencies for the following libraries
~openwrt_rpi/openwrt/scripts ~/staging_dir/target-aarch64_cortex-a53_musl/pkginfo
libcurl-gnutls.so.4
Makefile:81: recipe for target '~/openwrt/bin/packages/aarch64_cortex-a53/base/samplepgm_1.0.1_aarch64_cortex-a53.ipk' failed
make[2]: *** [~/openwrt/bin/packages/aarch64_cortex-a53/base/samplepgm_1.0.1_aarch64_cortex-a53.ipk] Error 1
make[2]: Leaving directory '~/openwrt/package/samplepgm'
Command exited with non-zero status 2
time: package/samplepgm/compile#0.18#0.05#0.21
package/Makefile:107: recipe for target 'package/samplepgm/compile' failed
make[1]: *** [package/samplepgm/compile] Error 2
make[1]: Leaving directory '~/openwrt'
~/openwrt/include/toplevel.mk:216: recipe for target 'package/samplepgm/compile' failed
make: *** [package/samplepgm/compile] Error 2
The default Build/Compile recipe is usually sufficient, you can find its definition in include/package-defaults.mk.
Please ensure that package/samplepgm/src/ is clean and contains only *.c and *.h files (plus scripts, Makefiles etc. that might be required) and no*.o files or even precompiled exectuables.
To Eclipce add libcur Right butto project Settings -> Libraries top window add simle curl
bottom add path to dir lib my path - /home/source/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl-1.1.16/lib