Tag Archives: makefile

[Solved] Golang Error: The system cannot find the path specified. [mkdir C:/xx/yy/]:

The system cannot find the path specified

If you report an error when creating a directory, it is recommended that you check the following:

err := os.Mkdir(path, perm)

If you use the above method, you can only create a single level directory
if you want to create a directory such as XX/YY, XX/YY/ZZ,…
please enter the following method

err := os.MkdirAll(path, perm)

OK! Problem solved!

Using cbmakegen to export makefile of code:: blocks

First, Download cbmakegen from the official website

Official website address: http://developer.berlios.de/projects/cbmakegen/

Can also be downloaded through my baidu disk

[Windows version] address: http://pan.baidu.com/share/link?shareid=123030&uk=1227046485

[Linux version] address: http://pan.baidu.com/share/link?shareid=123067&uk=1227046485

【Windows】

Decompress cbmakefilegen-bin-0.3.12.5-win32

obtain cbMakefileGen.cbplugin

Open plugins – & gt; manage plugins in the code:: blocks interface

add to cbMakefileGen.cbplugin

Then the generate makefile option will appear in the Project menu to export the makefile

It appears in the project directory Makefile.gen

Installation of Ubuntu + VTK

Sudo apt-get install libvtk5.2 libvtk5-qt4-dev sudo apt-get install libvtk5.2 libvtk5-qt4-dev
Different Ubuntu versions support different versions of VTK, here is Ubuntu 10.04, followed by QT4 support.
 
two
1. Download source code
Address: http://www.vtk.org/VTK/resources/software.html
The version is the latest
2. Unzip
The tar ZXVF… .
A VTK folder is created in the current directory
3. Install OpenGL
apt-get install mesa-common-dev libgl1-mesa-dev
4. Install ccmake
sudo apt-get install cmake-curses-gui
5.cd VTK
6.mkdir VTK-build
7.cd VTK-build
8.ccmake .. /
9. Press C to start the configuration and set VTK_USE_QT to ON. BUILD_SHARED_LIBS is set to ON
10. Press T to enter detailed setup, then locate QT_QMake_Executable, press ENTER to modify, and change QMAKE
The path of the input, for example:/home/zhang/QtSDK/Desktop/Qt/4.8.0/GCC/bin/qmake. Confirm and press Enter to exit the modification.
11. Press C to check the Settings.
12. Confirm by C.
13. Press G to generate makefile and exit CCMAKE automatically
14.make
15.sudo make install.
 
Add (.pro file) to the project
INCLUDEPATH =/usr/local/include/VTK to 5.10
LIBS + = L/usr/local/lib/VTK – 5.10 \
 
5.2
INCLUDEPATH =/usr/include/VTK to 5.2
LIBS += -L/usr/lib \
Select as needed at the end
-lvtkCommon -lvtksys -lQVTK -lvtkViews -lvtkWidgets -lvtkInfovis -lvtkRendering -lvtkGraphics -lvtkImaging -lvtkIO -lvtkFiltering -lvtklibxml2 -lvtkDICOMParser -lvtkpng -lvtkpng -lvtktiff -lvtkzlib -lvtkjpeg -lvtkalglib -lvtkexpat -lvtkverdict -lvtkmetaio -lvtkNetCDF -lvtksqlite -lvtkexoIIc -lvtkftgl -lvtkfreetype -lvtkHybrid
 
Command line compilation
G + + – o Cylinder – O3 – I/usr/include/VTK – 5.2 – L/usr/local/lib – Wno – deprecated – lvtkCommon lvtkDICOMParser – lvtkexoIIc – lvtkFiltering – LVTKFTGL – lvtkGenericFiltering lvtkGraphics — lvtkHybrid -lvtkImaging -lvtkIO -lvtkNetCDF -lvtkRendering -lvtksys -lvtkVolumeRendering -lvtkWidgets Cylinder.cxx
 
 

Compile QT source code error causes and Solutions

Qt source code compilation error:
1. Source code path contains Chinese font
2. No such file or directory can be found at compile time.
Solution:
1. Change to English path
2. When compiling the source code, add QT += widgets at the bottom of the project file. Pro.

Baidu Answer Question 2:
Write in the pro qt + = widgets QtWidget this module, introduced said, qmake will help you to generate a makefile, set up the include path and lib path, when the link set libs.
include

QApplication> Only the declaration is introduced, but there is no lib, so the link will fail.

How to execute Makefile

Compiling your source code files can be tedious, specially when you want to include several source files and have to type the compiling command everytime you want to do it.  
Well, I have news for you… Your days of command line compiling are (mostly) over, because YOU will learn how to write Makefiles.
Makefiles are special format files that together with the make utility will help you to automagically build and manage your projects.
For this session you will need these files:
main.cpphello.cppfactorial.cppfunctions.h I recommend creating a new directory and placing all the files in there.
note: I use g++ for compiling. You are free to change it to a compiler of your choice
The make utility If you run

make

this program will look for a file named 
makefile in your directory, and then execute it.

If you have several makefiles, then you can execute them with the command:

make -f MyMakefile

There are several other switches to the 
make utility. For more info, 
man make.
Build Process

    Compiler takes the source files and outputs object filesLinker takes the object files and creates an executable

Compiling by hand The trivial way to compile the files and obtain an executable, is by running the command:

g++ main.cpp hello.cpp factorial.cpp -o hello

The basic Makefile The basic makefile is composed of:

target: dependencies
[tab] system command

This syntax applied to our example would look like:

all:
	g++ main.cpp hello.cpp factorial.cpp -o hello

[Download 
here]
To run this makefile on your files, type:

make -f Makefile-1

On this first example we see that our target is called 
all. This is the default target for makefiles. The 
make utility will execute this target if no other one is specified.

We also see that there are no dependencies for target 
all, so 
make safely executes the system commands specified.

Finally, make compiles the program according to the command line we gave it.

Using dependencies Sometimes is useful to use different targets. This is because if you modify a single file in your project, you don’t have to recompile everything, only what you modified. 

Here is an example:

all: hello

hello: main.o factorial.o hello.o
	g++ main.o factorial.o hello.o -o hello

main.o: main.cpp
	g++ -c main.cpp

factorial.o: factorial.cpp
	g++ -c factorial.cpp

hello.o: hello.cpp
	g++ -c hello.cpp

clean:
	rm -rf *o hello

[Download 
here]
Now we see that the target all has only dependencies, but no system commands. In order for make to execute correctly, it has to meet all the dependencies of the called target (in this case all).
Each of the dependencies are searched through all the targets available and executed if found.
In this example we see a target called clean. It is useful to have such target if you want to have a fast way to get rid of all the object files and executables.
Using variables and comments You can also use variables when writing Makefiles. It comes in handy in situations where you want to change the compiler, or the compiler options.

# I am a comment, and I want to say that the variable CC will be
# the compiler to use.
CC=g++
# Hey!, I am comment number 2. I want to say that CFLAGS will be the
# options I'll pass to the compiler.
CFLAGS=-c -Wall

all: hello

hello: main.o factorial.o hello.o
	$(CC) main.o factorial.o hello.o -o hello

main.o: main.cpp
	$(CC) $(CFLAGS) main.cpp

factorial.o: factorial.cpp
	$(CC) $(CFLAGS) factorial.cpp

hello.o: hello.cpp
	$(CC) $(CFLAGS) hello.cpp

clean:
	rm -rf *o hello

[Download 
here]
As you can see, variables can be very useful sometimes. To use them, just assign a value to a variable before you start to write your targets. After that, you can just use them with the dereference operator $(VAR). 
Where to go from here With this brief introduction to Makefiles, you can create some very sophisticated mechanism for compiling your projects. However, this is just a tip of the iceberg. I don’t expect anyone to fully understand the example presented below without having consulted some 
Make documentation (which I had to do myself) or read pages 347 to 354 of your Unix book.

CC=g++
CFLAGS=-c -Wall
LDFLAGS=
SOURCES=main.cpp hello.cpp factorial.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=hello

all: $(SOURCES) $(EXECUTABLE)
	
$(EXECUTABLE): $(OBJECTS) 
	$(CC) $(LDFLAGS) $(OBJECTS) -o $@

.cpp.o:
	$(CC) $(CFLAGS) $< -o $@


[Download 
here]
If you understand this last example, you could adapt it to your own personal projects changing only 2 lines, no matter how many additional files you have !!!.


Hector Urtubia

Linux running Makefile, G + + / GCC error: suffix or operations invalid for ‘vbroadcasts’

Compiler Error on Linux systems: suffix or operands invalid for ‘vbroadcastss’ solution Error scenario solution reference

Error: suffix or operands invalid for ‘vbroadcastss’ solution
When running Kaggle-2014-Criteo-Master open source program, I encountered errors when compiling and running GBDT, libffm program and Makefile. The intuition was related to the system running the program. A search led to a solution. The
problem is primarily that GCC or g++ compile-time sets the -march parameter, which is a platform-dependent parameter. You need to modify this parameter value to correspond to the machine.
(program download address: https://github.com/ycjuan/kaggle-2014-criteo)
for this open source programs need to modify: Makefile
[file path]/kaggle-2014-criteo/solvers/ GBDT
[file path]/kaggle-2014-criteo/solvers/libffm-1.13 Makefile
-march =native march=broadwel
then Makefile error disappears.
An error scenario
Specifically report the following mistakes:

[dhy@Master kaggle-2014-criteo-master]$ make
make -C solvers/gbdt
make[1]: Entering directory `/home/dhy/code/kaggle-2014-criteo-master/solvers/gbdt'
g++ -Wall -Wconversion -O2 -fPIC -std=c++0x -march=native -fopenmp -o gbdt src/train.cpp src/common.cpp src/timer.cpp src/gbdt.cpp
make[1]: Leaving directory `/home/dhy/code/kaggle-2014-criteo-master/solvers/gbdt'
ln -sf solvers/gbdt/gbdt
make -C solvers/libffm-1.13
make[1]: Entering directory `/home/dhy/code/kaggle-2014-criteo-master/solvers/libffm-1.13'
g++ -Wall -O3 -std=c++0x -march=native -fopenmp -DUSEOMP -c -o ffm.o ffm.cpp
/tmp/ccuUtD2f.s: Assembler messages:
/tmp/ccuUtD2f.s:3671: Error: suffix or operands invalid for `vbroadcastss'
/tmp/ccuUtD2f.s:3787: Error: suffix or operands invalid for `vbroadcastss'
/tmp/ccuUtD2f.s:3917: Error: suffix or operands invalid for `vbroadcastss'
/tmp/ccuUtD2f.s:4071: Error: suffix or operands invalid for `vbroadcastss'
make[1]: *** [ffm.o] Error 1
make[1]: Leaving directory `/home/dhy/code/kaggle-2014-criteo-master/solvers/libffm-1.13'
make: *** [ffm-train] Error 2

The solution
Modify the Makefile, – march = native for – march = broadwell
this is because the GCC/g + + parameters march on different architecture platform corresponding to different – march Options, refer to: https://gcc.gnu.org/onlinedocs/gcc in the “3.18 Machine – Dependent Options” section. To view the machine’s corresponding -march, run the following command 1 :

$gcc -c -Q -march=native --help=target | grep march

My machine to execute the above command appears:

-march=                     		broadwell

Therefore, in the compile file Makefile, the g++ or GCC parameter is set to -march= broadwell.
different cpus corresponding to march selection can refer to the following table: 2
The

CPU type

march option

AMD Barcelona

– march = Barcelona

AMD Bobcat

– march = btver1

AMD Jaguar – march=btver2
AMD Bulldozer – march=bdver1
AMD Piledriver – march=bdver2
AMD Steamroller – march=bdver3
Intel Westmere – march=westmere
Intel Core Nehalem – march=corei7
Intel Core Sandy Bridge – march=corei7-avx
Intel Core Ivy Bridge – march=core-avx-i
Intel Core Haswell – march=core-avx2
Intel Core Broadwell – march=broadwell
Intel Atom Bonnell – march=bonnell
Intel Atom Silvermont – march=silvermont

reference


The

    https://blog.csdn.net/listener51/article/details/80468021 ↩ ︎ http://blog.sciencenet.cn/blog-365047-1014406.html ↩ ︎

Make: * * [emigen] error 255 error analysis

The error message is as follows:
> Make new
Clean EMI Settings
Generate EMI Settings
No type library matching “Microsoft Excel” found at./tools/ emigenv2.pl line 79
Win32::OLE(0.1707): GetOleTypeLibObject () is Not a Win32: : OLE: : TypeLib object at C:
/Perl/lib/Win32/OLE/Const PM line 49.
Win32: : OLE (0.1707) error 0 x800401f3: “” palawan/tools/emiGenV2. Pl line 225
the eval {… } called at./tools/ emigenv2.pl line 225
make: *** [emigen] Error 255

reason: according to the Makefile gsm2.mak description, emigen is dependent on sysgen, sysgen is dependent on cmmgen, and new dependent
cmmgen. So this error happens when you make new, Be emigen Missing several dependent files
custom/system/NEOTEL25_06B_BB/ custom_emine.c
custom/system/NEOTEL25_06B_BB/ custom_emine.h
custom/system/NEOTEL25_06B_BB/flash_opt.h
custom/system/NEOTEL25_06B_BB/ custom_switch_clock C

the make/Gsm2 mak
— — — — — — — — — — — — — — — —
new: cleanall cmmgen asngen codegen asnregen The update
cmmgen: sysgen
sysgen: emigen
emigen: $$(FLASH_OPTIONS_HDR) (strip) $$(CUSTOM_EMI_H) (strip) $$(CUSTOM_EMI_C) (strip) $$(SWITCH_CLK_C) (strip)
@ echo the Generate EMI Settings
@ if exist $$(EMI_GENERATOR) (strip)/
(perl $$(EMI_GENERATOR) (strip) $(strip $(PLATFORM)) $$(MCU_CLOCK) (strip) $$(MEMORY_DEVICE_HDR) (strip) $$(MEMORY_DEVICE_LST) (strip)) 2 & gt; & 1
— — — — — — — — — — — — — — — — — — — — — — —

the variable $(PLATFORM), $(MCU_CLOCK) have NEOTEL25_06B_GPRS. Mak is defined.
variables $(EMI_GENERATOR), $(MEMORY_DEVICE_LST), $(MEMORY_DEVICE_HDR) are defined in option. mak.

so if the above source file is missing, Then make will call./tools/ emigenv2.pl to execute
./tools/ emigenv2.pl MT6225 MCU_104M Custom/system/NEOTEL25_06B_BB/custom_MemoryDevice. H.
/tools/MemoryDeviceList/MemoryDeviceList_Since06BW0652. XLS

emiGenV2. Pl is a Perl script, which invokes the Win32: : OLE libraries for Microsoft Office Excel file parsing.
if Excel is not installed, the above error message will be generated. Reference

http://bytes.com/topic/perl/answers/681606-win32-ole-error-no-type-library-matching-microsoft-excel-found

summary: keep the source code file is missing source file, or install MS Office Excel.

Bus error: 10

Recently, I wrote a small program with many analogisms. For the convenience of compilation, I wrote a Makefile specially for source code and test code.
In the process of debugging, a “Bus error: 10” suddenly appeared, which was quite unexpected. Why did such a spectacular problem occur?
The starting address of type int data must be a multiple of 4, otherwise it will cause the bus error mentioned above. With this in mind, I searched for a long time but couldn’t find any address misaligned.
When I compiled again, I found something fishy about the compilation process. The Makefile compiles the source file “.c/.cpp “into”.o “files (binaries), and then links these”.o “files to target files (executables, libraries, etc.). If some of these files are modified, the Makefile reduces compilation time by detecting the timestamp and compiling only the files that are modified later. So the question is, what happens if you change the header file?Examples are as follows:
Suppose you are going to modify two files, classA.h classa.cpp, add a member variable to the header file, and do the processing in the source file.
The two files classb.cpp classC.cpp will include the classA.h file. Because of the include type, the actual code in the file has been written to the source file and compiled into a “.o “file.
When the modification is completed, there is no change in classb. CPP classc. CPP, so when comparing the timestamp, determine that classb. CPP classc. CPP does not need to be compiled again. However, the header file classA.h of the classb. CPP classC.cpp file has really changed, so when the data is accessed, the address offset of its members will be greatly changed, no error can be found at compile time, but the execution will explode…
 
Solution: To sum up, it is not difficult to find the problem. The header files held before and after the code are scattered, resulting in running errors. It is only necessary to compile the classes of the modified header files that depend on, and the simple solution is to compile the current project after clean.
This blog is just for the sake of documenting a childish problem you’ve committed: if the header file changes, recompile it all or die…
The above!
 
So the question is, can the Makefile add dependencies on the source file’s head file?Detects the timestamp of the dependency header file and the “.o “file and compiles them. Make a note of it and study it later.