我的目标是在主机上使用 Yocto SDK 交叉编译一个代码文件,以使其在目标板上可执行。我正在使用 SUMO Yocto版本和 GCC 7.3交叉编译器。
首先,要进行YOCTO交叉编译,我创建了一个文件Hello.c:
#include <stdio.h>
int main(void)
{
printf ("Hello World!\n");
return 0;
}
我编译了正在执行的文件:
make hello
现在我有一个编译好的文件,可以在目标板上执行。
但是现在我有多个.h文件,多个.cpp文件和一个主文件。
当我像这样执行主文件时:
make main
发生错误:
main.cpp:10:10:致命错误:boost / asio.hpp:没有这样的文件或目录 包括^ ~~~~~~~~~~~~~~~~编译终止。 :目标“主要”的配方制作失败:*** [主要]错误1
我认为 Boost 和 asio.hpp 有问题。 Yocto Linux映像中是否包含boost库? asio.hpp有什么问题? 请问我该如何解决? 谢谢
答案 0 :(得分:1)
我刚刚注意到,实际上,您不是在使用SDK,而是仅包含glibc以及一些基本工具和gdb的工具链。通常用于构建测试应用和调试。因此,您需要构建一个真正的SDK,除了工具链外,它还包含安装在映像的rootfs中的软件包的dev版本(libs / headers / other文件)。这可以通过以下方式完成:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-367-e5e6e92c059d> in <module>
14 }
15
---> 16 clf = cross_validate(pipeline_cv, parameters)
17 clf.fit(text_train, value_train)
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\model_selection\_validation.py in cross_validate(estimator, X, y, groups, scoring, cv, n_jobs, verbose, fit_params, pre_dispatch, return_train_score, return_estimator, error_score)
229 return_times=True, return_estimator=return_estimator,
230 error_score=error_score)
--> 231 for train, test in cv.split(X, y, groups))
232
233 zipped_scores = list(zip(*scores))
~\AppData\Local\Continuum\anaconda3\lib\site-packages\joblib\parallel.py in __call__(self, iterable)
919 # remaining jobs.
920 self._iterating = False
--> 921 if self.dispatch_one_batch(iterator):
922 self._iterating = self._original_iterator is not None
923
~\AppData\Local\Continuum\anaconda3\lib\site-packages\joblib\parallel.py in dispatch_one_batch(self, iterator)
757 return False
758 else:
--> 759 self._dispatch(tasks)
760 return True
761
~\AppData\Local\Continuum\anaconda3\lib\site-packages\joblib\parallel.py in _dispatch(self, batch)
714 with self._lock:
715 job_idx = len(self._jobs)
--> 716 job = self._backend.apply_async(batch, callback=cb)
717 # A job can complete so quickly than its callback is
718 # called before we get here, causing self._jobs to
~\AppData\Local\Continuum\anaconda3\lib\site-packages\joblib\_parallel_backends.py in apply_async(self, func, callback)
180 def apply_async(self, func, callback=None):
181 """Schedule a func to be run"""
--> 182 result = ImmediateResult(func)
183 if callback:
184 callback(result)
~\AppData\Local\Continuum\anaconda3\lib\site-packages\joblib\_parallel_backends.py in __init__(self, batch)
547 # Don't delay the application, to avoid keeping the input
548 # arguments in memory
--> 549 self.results = batch()
550
551 def get(self):
~\AppData\Local\Continuum\anaconda3\lib\site-packages\joblib\parallel.py in __call__(self)
223 with parallel_backend(self._backend, n_jobs=self._n_jobs):
224 return [func(*args, **kwargs)
--> 225 for func, args, kwargs in self.items]
226
227 def __len__(self):
~\AppData\Local\Continuum\anaconda3\lib\site-packages\joblib\parallel.py in <listcomp>(.0)
223 with parallel_backend(self._backend, n_jobs=self._n_jobs):
224 return [func(*args, **kwargs)
--> 225 for func, args, kwargs in self.items]
226
227 def __len__(self):
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\model_selection\_validation.py in _fit_and_score(estimator, X, y, scorer, train, test, verbose, parameters, fit_params, return_train_score, return_parameters, return_n_test_samples, return_times, return_estimator, error_score)
503 start_time = time.time()
504
--> 505 X_train, y_train = _safe_split(estimator, X, y, train)
506 X_test, y_test = _safe_split(estimator, X, y, test, train)
507
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\utils\metaestimators.py in _safe_split(estimator, X, y, indices, train_indices)
199 X_subset = X[np.ix_(indices, train_indices)]
200 else:
--> 201 X_subset = safe_indexing(X, indices)
202
203 if y is not None:
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\utils\__init__.py in safe_indexing(X, indices)
221 return X[indices]
222 else:
--> 223 return [X[idx] for idx in indices]
224
225
~\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\utils\__init__.py in <listcomp>(.0)
221 return X[indices]
222 else:
--> 223 return [X[idx] for idx in indices]
224
225
KeyError: 2
构建SDK之后,您需要通过生成的安装程序脚本进行安装。另外,不要忘记在开始工作之前先获取环境设置脚本!
有关更多信息,请参见https://www.yoctoproject.org/docs/latest/sdk-manual/sdk-manual.html#sdk-building-an-sdk-installer