Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using make to build llama.cpp:common/common.cpp:1108:55: error: expected primary-expression before ')' token 1108 | fprintf(stream, "build_number: %d\n", BUILD_NUMBER); #3673

Closed
OuXiao514 opened this issue Oct 19, 2023 · 10 comments

Comments

@OuXiao514
Copy link

D:/LLM/llama.cpp-master $ make
I llama.cpp build info:
I UNAME_S: Windows_NT
I UNAME_P: unknown
I UNAME_M: x86_64
I CFLAGS: -I. -Icommon -D_XOPEN_SOURCE=600 -DNDEBUG -DGGML_USE_K_QUANTS -std=c11 -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes -Werror=implicit-int -Werror=implicit-function-declaration -Wdouble-promotion -march=native -mtune=native -Xassembler -muse-unaligned-vector-move
I CXXFLAGS: -I. -Icommon -D_XOPEN_SOURCE=600 -DNDEBUG -DGGML_USE_K_QUANTS -std=c++11 -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wmissing-declarations -Wmissing-noreturn -Xassembler -muse-unaligned-vector-move -Wno-array-bounds -Wno-format-truncation -Wextra-semi -march=native -mtune=native
I NVCCFLAGS: -I. -Icommon -D_XOPEN_SOURCE=600 -DNDEBUG -DGGML_USE_K_QUANTS -std=c++11 -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wmissing-declarations -Wmissing-noreturn -Xassembler -muse-unaligned-vector-move -Wno-pedantic -Xcompiler "-Wno-array-bounds -Wno-format-truncation -Wextra-semi -march=native -mtune=native "
I LDFLAGS:
I CC: cc (GCC) 13.2.0
I CXX: g++ (GCC) 13.2.0

g++ -I. -Icommon -D_XOPEN_SOURCE=600 -DNDEBUG -DGGML_USE_K_QUANTS -std=c++11 -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wmissing-declarations -Wmissing-noreturn -Xassembler -muse-unaligned-vector-move -Wno-array-bounds -Wno-format-truncation -Wextra-semi -march=native -mtune=native -c common/common.cpp -o common.o
common/common.cpp: In function 'void dump_non_result_info_yaml(FILE*, const gpt_params&, const llama_context*, const std::string&, const std::vector&, const char*)':
common/common.cpp:1108:55: error: expected primary-expression before ')' token
1108 | fprintf(stream, "build_number: %d\n", BUILD_NUMBER);
| ^
make: *** [Makefile:551: common.o] Error 1

@OuXiao514
Copy link
Author

When I use cmake:
D:\LLM\llama.cpp-master\build>cmake --build . --config Release
适用于 .NET Framework MSBuild 版本 17.7.2+d6990bcfa

Checking Build System
Building Custom Rule D:/LLM/llama.cpp-master/CMakeLists.txt
ggml.c
ggml-alloc.c
ggml-backend.c
k_quants.c
正在生成代码...
ggml.vcxproj -> D:\LLM\llama.cpp-master\build\ggml.dir\Release\ggml.lib
Building Custom Rule D:/LLM/llama.cpp-master/CMakeLists.txt
llama.cpp
D:\LLM\llama.cpp-master\llama.cpp(1055,31): warning C4305: “初始化”: 从“double”到“float”截断 [D:\LLM\llama.cpp-master\build\llama.vcxproj]
D:\LLM\llama.cpp-master\llama.cpp(1205,40): warning C4566: 由通用字符名称“\u0120”表示的字符不能在当前代码页(936)中表示出来 [D:\LLM\llama.cpp-master\build\llama.vcxproj]
D:\LLM\llama.cpp-master\llama.cpp(1206,40): warning C4566: 由通用字符名称“\u010A”表示的字符不能在当前代码页(936)中表示出来 [D:\LLM\llama.cpp-master\build\llama.vcxproj]
D:\LLM\llama.cpp-master\llama.cpp(1207,40): warning C4566: 由通用字符名称“\u0120”表示的字符不能在当前代码页(936)中表示出来 [D:\LLM\llama.cpp-master\build\llama.vcxproj]
D:\LLM\llama.cpp-master\llama.cpp(1208,40): warning C4566: 由通用字符名称“\u010A”表示的字符不能在当前代码页(936)中表示出来 [D:\LLM\llama.cpp-master\build\llama.vcxproj]
D:\LLM\llama.cpp-master\llama.cpp(2238,60): warning C4566: 由通用字符名称“\u010A”表示的字符不能在当前代码页(936)中表示出来 [D:\LLM\llama.cpp-master\build\llama.vcxproj]
D:\LLM\llama.cpp-master\llama.cpp(9724,28): warning C4146: 一元负运算符应用于无符号类型,结果仍为无符号类型 [D:\LLM\llama.cpp-master\build\llama.vcxproj]
D:\LLM\llama.cpp-master\llama.cpp(9754,28): warning C4146: 一元负运算符应用于无符号类型,结果仍为无符号类型 [D:\LLM\llama.cpp-master\build\llama.vcxproj]
llama.vcxproj -> D:\LLM\llama.cpp-master\build\Release\llama.lib
Building Custom Rule D:/LLM/llama.cpp-master/common/CMakeLists.txt
common.cpp
D:\LLM\llama.cpp-master\common\common.cpp(1108,55): error C2059: 语法错误:“)” [D:\LLM\llama.cpp-master\build\common\common.vcxproj]
sampling.cpp
console.cpp
D:\LLM\llama.cpp-master\common\console.cpp(253,30): warning C4267: “初始化”: 从“size_t”转换到“DWORD”,可能丢失数据 [D:\LLM\llama.cpp-master\build\common\common.vcxproj]
D:\LLM\llama.cpp-master\common\console.cpp(407,28): warning C4267: “初始化”: 从“size_t”转换到“int”,可能丢失数据 [D:\LLM\llama.cpp-master\build\common\common.vcxproj]
grammar-parser.cpp
train.cpp
正在生成代码...

@shibe2
Copy link
Collaborator

shibe2 commented Oct 19, 2023

There is probably a bug in generation of build-info.h when not building from Git tree. I have to manually edit it after running CMake.

@OuXiao514
Copy link
Author

How to edit build-info.h?

@shibe2
Copy link
Collaborator

shibe2 commented Oct 19, 2023

It's generated in the root of source tree. Open it with a text editor (like WordPad on Windows). Put some number after BUILD_NUMBER. It can be 0 or the number of commits in the branch you are building from. Current master has 1399 commits.

@OuXiao514
Copy link
Author

I find!
#ifndef BUILD_INFO_H
#define BUILD_INFO_H

#define BUILD_NUMBER 1399
#define BUILD_COMMIT "004797f"
#define BUILD_COMPILER "MSVC 19.37.32822.0"
#define BUILD_TARGET "x64"

#endif // BUILD_INFO_H

@shibe2
Copy link
Collaborator

shibe2 commented Oct 19, 2023

It looks correct. If you still have an error, it must be something else.

@staviq
Copy link
Collaborator

staviq commented Oct 19, 2023

Possible duplicate of #3670

@shibe2
Copy link
Collaborator

shibe2 commented Oct 20, 2023

@OuXiao514 Have you managed to build it? What was the problem?

@OuXiao514
Copy link
Author

When I editor build-info.h, It is successful to build the project. But it has some warning. such as:
D:\LLM\llama.cpp-master.\llama.cpp(1055,31): warning C4305: “初始化”: 从“double”到“float”截断 [D:\LLM\llama.cpp-master\build\tests\test-llama-grammar.vcxproj]
D:\LLM\llama.cpp-master.\llama.cpp(1205,40): warning C4566: 由通用字符名称“\u0120”表示的字符不能在当前代码页(936)中表示出来 [D:\LLM\llama.cpp-master\build\tests\test-llama-grammar.vcxproj]
D:\LLM\llama.cpp-master.\llama.cpp(1206,40): warning C4566: 由通用字符名称“\u010A”表示的字符不能在当前代码页(936)中表示出来 [D:\LLM\llama.cpp-master\build\tests\test-llama-grammar.vcxproj]
D:\LLM\llama.cpp-master.\llama.cpp(1207,40): warning C4566: 由通用字符名称“\u0120”表示的字符不能在当前代码页(936)中表示出来 [D:\LLM\llama.cpp-master\build\tests\test-llama-grammar.vcxproj]

@shibe2
Copy link
Collaborator

shibe2 commented Oct 20, 2023

Then we can indeed consider it a duplicate of #3670.

@shibe2 shibe2 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants