Reputation: 31
Please help me. I try to compile hello world package written c++. My environment is OS : Ubuntu 14.4,and synology toolchain is bromolow 64bit compiler, But I cannot get helloworld.cgi. I don't know the reason. Source code are
#include "webman.h"
#include <string>
#include <stdio.h>
#include <synosdk/proc.h>
using namespace std;
int main(int argc, char* argv[]) {
WebMan _cgi;
Json::Value out;
out["uname"] = "helloworld";
out["ret"] = true;
out["success"] = true;
_cgi.WriteHeader();
_cgi.WriteBody(out);
return 0;
}
and make file is
.PHONY: all clean
.SUFFIXES: .cgi
CXXFLAGS=$(shell pkg-config libdsm --cflags)
LDFLAGS+=$(shell pkg-config libdsm --libs)
CXXFLAGS+=-I/usr/syno/nclude/gpl \
-I/usr/syno/include/synocgi \
# source files
SRC=${cgi_name}.cpp
CGI=$(SRC:%.cpp=../%.cgi)
all: $(CGI)
../%.cgi: %.cpp
echo $(CXX) -o $@ $^ $(CFLAGS) $(LDFLAGS)
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
clean:
rm -f core *~ *.o $(CGI)
I got such error
======= Run build script =======
make: *** No rule to make target `distclean'. Stop.
==> cgi
==> js
<== js
/usr/local/i686-linux-gnu/bin/i686-linux-gnu-ccache-g++ -o ../helloworld.cgi helloworld.cpp -I/usr/local/i686-linux-gnu/include -DSYNO_X64 -O2 -I/usr/syno/include -g -DSYNO_PLATFORM=X64 -g -DSDK_VER_MIN_REQUIRED=400 -L/usr/local/i686-linux-gnu/lib -L/usr/syno/lib -Wl,-rpath-link -Wl,/usr/syno/lib -L/usr/local/i686-linux-gnu/lib -L/usr/syno/lib -L/source/libsynocgi/lib -L/usr/syno/sqlite3/lib/ -L/source/libsynoacl/lib/ -L/source/libsynosdk/gpl/ -L/source/google-authenticator-1.x -lsynocgi -ljson -lsynowireless-core -lsynoacl -lsynogpl -lsynocoregpl -lsynobandwidth -lsynowimax -lsynosdk -lsynocore -lcrypt -lnet -licui18n -licuuc -licudata -lxml2 -lattr -lm -ldl -lz -lsqlite3 -lgoogleauth -ldsm
/usr/local/i686-linux-gnu/lib/gcc/i686-linux-gnu/4.2.1/../../../../i686-linux-gnu/bin/ld: cannot find -lnet
collect2: ld returned 1 exit status
make[2]: *** [../helloworld.cgi] Error 1
make[1]: *** [cgi] Error 2
make: *** [ui] Error 2
There is no install-dev scripts for helloworld.
Time cost: 00:00:03 [Build-->helloworld]
I got the following error:
make[2]: *** [../helloworld.cgi] Error 1
make[1]: *** [cgi] Error 2
make: *** [ui] Error 2
Upvotes: 3
Views: 1121
Reputation: 116
Maybe I'm too late:) Via the error message I guess you need add extra rule on your Makefile for distclean, even empty. At the same time, you also need to add install-dev script, like your build script and install script.
Without the above error message, your source code link -lnet but the tool chain does not find it. I think you need to give a path for this library (I'm not sure the build env has libnet or not).
Upvotes: 1