KhronosGroup / KhronosGroup/OpenCL-Guide

C++ for OpenCL compile problem

Open
#14 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
CMake
Stars
711
Forks
70
PR merge metrics
No merged PRs in 30d

Description

My envirment:
Ubuntu clang version 12.0.0-3ubuntu1~20.04.3
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

My problem:
when I do this:
$ echo "kernel void k(){}" > test.cl
$ clang -cl-std=CLC++ ./test.cl

error raises that:
/usr/bin/ld: /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'

I wonder how I can solve this problem? I can't even compile the simplest .cl file which supports C++ features. Thanks guys!

Contributor guide

Open the contributing guide

Research direction

Reproduce the report using the shown test.cl contents and the clang -cl-std=CLC++ command on Ubuntu with clang 12. Check whether the failure is caused by compilation or linking, then document the supported invocation or limitation. Done means the minimal OpenCL C++ source can be processed without the reported missing-main linker error, or the expected behavior is clearly explained.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, ubuntu
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.