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

unicon/iconc can't find ft2build.h when compiling #347

Open
DestyNova opened this issue Oct 5, 2023 · 3 comments
Open

unicon/iconc can't find ft2build.h when compiling #347

DestyNova opened this issue Oct 5, 2023 · 3 comments

Comments

@DestyNova
Copy link

With the following program hello.icn:

procedure main()
  write("Hello, amigo!")
end

Trying to compile with unicon/iconc produces the following error:

❯ unicon -C hello.icn 
Parsing hello.icn: .
Parsing /home/omf/code/icon/unicon/ipl/procs/posix.icn: .........
iconc  -U1  -fs -o hello  -A /tmp/uni79385330 /tmp/uni86049813-iconc /tmp/uni20299443-iconc 
Translating to C:
No errors; no warnings
Compiling and linking C code:
In file included from hello.h:8,
                 from hello.c:13:
/home/omf/code/icon/unicon/rt/include/rt.h:3091:13: fatal error: ft2build.h: No such file or directory
 3091 |    #include <ft2build.h>
      |             ^~~~~~~~~~~~
compilation terminated.
*** C compile and link failed ***

The issue appears to be that ft2build.h is installed in /usr/include/freetype2 but gcc needs to be explicitly told about it. If I explicitly pass the include path it works:

❯ iconc -p '-I/usr/include/freetype2' hello.icn
Translating to C:
hello.icn:
No errors; no warnings
Compiling and linking C code:
Succeeded

I did a quick search and didn't see any other issues mentioning this, so perhaps it's a misconfiguration on my Pop!_OS (Ubuntu-based) system. Any advice would be appreciated.

@Jafaral
Copy link
Member

Jafaral commented Oct 5, 2023

Unless you intentionally want -C, you can just drop that and it should work.

I.e, just do unicon hello.icn

@DestyNova
Copy link
Author

DestyNova commented Oct 5, 2023

Unless you intentionally want -C, you can just drop that and it should work.

I.e, just do unicon hello.icn

Yes that works and is fine for local development, but if I wanted to build a binary that doesn't depend on iconx -- e.g. for distribution to people who don't have Unicon installed -- then -C is needed (although ldd tells me that those binaries have a lot of dynamic library dependencies).

@Jafaral
Copy link
Member

Jafaral commented Oct 5, 2023

Unicon is an interpreted language, the compiler is still in alpha state. So iconx is expect to be on the target platform typically. You can bundle iconx with an executable by passing -B:

unicon -B hello.icn

Give that a try. OF course that also assumes the the libraries you built iconx against should be available on the target platform. In all cases, portability of binaries is limited for various architectural reasons.

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

2 participants