我正在使用gcc 4.7.2版的Ubuntu 12.10。g ++無法識別-wl
我試圖讓下面的Makefile:
CC = g++
CCFLAGS = -fPIC -O3 -Wall -ffast-math -msse -msse2 -fopenmp
LINKFLAGS = -shared -Wl -fopenmp -lgomp
INPUT = im2col.cpp fastpool.cpp local_response_normalization.cpp neuron.cpp
TARGET = libcpputil.so
# If we are going to use MKL, we include additional flags
MKL_FLAGS = -D DECAF_USE_MKL
MKL_LINK_FLAGS = -lmkl_rt
all: $(INPUT)
$(CC) -c $(CCFLAGS) $(INPUT)
$(CC) $(LINKFLAGS) -o $(TARGET) *.o
all_mkl: $(INPUT)
$(CC) -c $(CCFLAGS) $(MKL_FLAGS) $(INPUT)
$(CC) $(LINKFLAGS) $(MKL_LINK_FLAGS) -o $(TARGET) *.o
speedtest_lrn: speedtest_lrn.cpp local_response_normalization.cpp
$(CC) $(CCFLAGS) -lgomp -o speedtest_lrn speedtest_lrn.cpp local_response_normalization.cpp
clean:
rm *.so
rm *.o
但不知何故,G ++不識別選項-Wl。下面是我得到的錯誤:
make -C layers/cpp/
make[1]: Entering directory `/home/ubuntu/decaf-release-master/decaf/layers/cpp'
g++ -c -fPIC -O3 -Wall -ffast-math -msse -msse2 -fopenmp im2col.cpp fastpool.cpp local_response_normalization.cpp neuron.cpp
g++ -shared -Wl -fopenmp -lgomp -o libcpputil.so *.o
g++: error: unrecognized command line option ‘-Wl’
make[1]: *** [all] Error 1
make[1]: Leaving directory `/home/ubuntu/decaf-release-master/decaf/layers/cpp'
make: *** [all] Error 2
Failed to build the C libraries; exiting
編輯:當我嘗試刪除「-Wl」我得到:
[email protected]:~/decaf-release-master$ python setup.py
make -C layers/cpp/
make[1]: Entering directory `/home/ubuntu/decaf-release-master/decaf/layers/cpp'
g++ -c -fPIC -O3 -Wall -ffast-math -msse -msse2 -fopenmp im2col.cpp fastpool.cpp local_response_normalization.cpp neuron.cpp
g++ -shared -fopenmp -lgomp -o libcpputil.so *.o
make[1]: Leaving directory `/home/ubuntu/decaf-release-master/decaf/layers/cpp'
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: no commands supplied
這多少工作時,我嘗試了在Ubuntu 12.04和gcc 4.7.7。
有人可以請解釋有什麼問題,我該如何解決?
謝謝, Gil。
我不記得看到'-Wl'作爲一個選項。它的意圖是什麼,你爲什麼通過它? – legends2k