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

Can't compile Silice on Arch Linux #255

Open
Popolon opened this issue Aug 23, 2023 · 14 comments
Open

Can't compile Silice on Arch Linux #255

Popolon opened this issue Aug 23, 2023 · 14 comments

Comments

@Popolon
Copy link

Popolon commented Aug 23, 2023

I started to make an Arch Linux package of Silice, but with default compiler settings, compilation fail.

  • Version of GCC : gcc (GCC) 13.2.1 20230801

The error is the following one :

/data/pacaur/silice/src/Silice/src/LuaPreProcessor.cpp: In member function 'void Silice::LuaPreProcessor::decomposeSource(const std::string&, std::map, t_unit_loc> >&)':
/data/pacaur/silice/src/Silice/src/LuaPreProcessor.cpp:1058:51: error: format not a string literal and no format arguments [-Werror=format-security]
 1058 |           throw Fatal((w + " has no name").c_str()); // TODO: improve error report (line)
      |                                                   ^
/data/pacaur/silice/src/Silice/src/LuaPreProcessor.cpp: In function 'std::string fileAbsolutePath(std::string)':
/data/pacaur/silice/src/Silice/src/LuaPreProcessor.cpp:1263:11: warning: ignoring return value of 'char* realpath(const char*, char*)' declared with attribute 'warn_unused_result' [-Wunused-result]
 1263 |   realpath(f.c_str(), buf);
      |   ~~~~~~~~^~~~~~~~~~~~~~~~
cc1plus: some warnings being treated as errors
make[2]: *** [CMakeFiles/libsilice.dir/build.make:116: CMakeFiles/libsilice.dir/src/LuaPreProcessor.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:170: CMakeFiles/libsilice.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

I didn't found the mean to resolve this problem in the code.

@rob-ng15
Copy link
Contributor

rob-ng15 commented Aug 23, 2023 via email

@Popolon
Copy link
Author

Popolon commented Aug 23, 2023

I used the master branch.

@rob-ng15
Copy link
Contributor

rob-ng15 commented Aug 24, 2023 via email

@rob-ng15
Copy link
Contributor

rob-ng15 commented Aug 24, 2023 via email

@sylefeb
Copy link
Owner

sylefeb commented Aug 24, 2023

An ArchLinux package would be great! Thanks @rob-ng15 for testing ; on a fresh Archlinux (gcc 13.2.1 20230801) "master" also compiled on my side. @Popolon looking at the messages it seems like tighter security (warnings considered errors), maybe a different default g++ setting? I definitely will fix those, but would help to be able to reproduce on my side. I'll investigate!

@sylefeb
Copy link
Owner

sylefeb commented Aug 24, 2023

I pushed a fix (both in master and draft). I enabled the warning as error in the CMakeLists.txt (using -Werror=...) such that I can trigger the same compiler behavior. There might be others, please let me know how it goes.

(I'll likely enable -Werror to resolve all warnings, unfortunately a few are in third party libs).

@Popolon
Copy link
Author

Popolon commented Aug 28, 2023

@rob-ng15 I have both Lua version, but it's not related at all (and looks like Silice use statically linked liblua.a), that's an error related to type/cast, and strong default warning policy.

@sylefeb Thank you very much, this resolved the problem. Everything is compiled. I will update this ticket with the informations about the Arch package, as soon I finished it.

@Popolon
Copy link
Author

Popolon commented Aug 28, 2023

The package is now available at : https://aur.archlinux.org/packages/silice-git

It looks like, from the sources, only silice binary is needed to be installed in bin/ can you confirm?

@Popolon
Copy link
Author

Popolon commented Sep 2, 2023

I had more time to test the package, libSL-small had to be installed in /usr/src/libs/ and 2 .py scripts in /usr/bin, I can now synthesize and run examples with verilator.

@Popolon Popolon closed this as completed Sep 2, 2023
@sylefeb
Copy link
Owner

sylefeb commented Sep 3, 2023

Hi, sorry for the slow answer, indeed the Python scripts are needed to build, good catch for LibSL-small (this is because the verilator framework requires a compilation every time). The frameworks folder is also used by the build system, it contains board definitions, code templates and the verilator framework sources. If I understand correctly the PKGBUILD these might be missing currently?

However if you can successfully run verilator examples these are found somehow? To help see which folders are used, when a build occurs (eg. make verilator in projects/vga_test) the detected folders are displayed, see below:
image

@sylefeb sylefeb reopened this Sep 3, 2023
@Popolon
Copy link
Author

Popolon commented Sep 4, 2023

I just tested to synthesize blink example in learn-silice folder and it worked with Verilator.

for framworks, I noticed in sources (confirmed by a strings silice| grep frameworks in binaries), that the path is ../frameworks, relative to the binary.

./src/SiliceCompiler.cpp:    frameworks_dir = std::string(LibSL::System::Application::executablePath()) + "../frameworks/";
./src/SiliceCompiler.cpp:  CONFIG.keyValues()["frameworks_dir"] = frameworks_dir;
./src/SiliceCompiler.cpp:  CONFIG.keyValues()["templates_path"] = frameworks_dir + "/templates";
./src/SiliceCompiler.cpp:  CONFIG.keyValues()["libraries_path"] = frameworks_dir + "/libraries";

In should be in /usr/share/silice/frameworks instead in a Linux Standard Base way. The pass can be given to the binary using --frameworks_dir= parameter, but it should probably be better to have this at compile time or a LSB way by default, on Linux platforms.

@Popolon
Copy link
Author

Popolon commented Sep 4, 2023

I just updated package to put frameworks in /usr/share/silice/frameworks and a patch to change both silice binary and silice-make.py with this as default path.

@sylefeb
Copy link
Owner

sylefeb commented Sep 4, 2023

Sounds like a good approach for now, thanks! I'll look into using CMAKE_INSTALL_PREFIX correctly (also relates to #240), which hopefully could help packaging without creating trouble for local builds.

@sylefeb
Copy link
Owner

sylefeb commented Jan 22, 2024

Hi Everyone, this issue should be fixed by the changes in the draft branch. Everything is now installed in the usual /usr/local/bin and /usr/local/share/silice directories.

I also revised the 'getting started' scripts and created a ./get_started_linux.sh script that I tested under Ubuntu (18, 20), Debian, Fedora, ArchLinux.

I will merge to main very soon, please let me know if you see anything wrong.

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