跳轉到內容

ROSE 編譯器框架/常見問題解答

來自華夏公益教科書

我們收集了一個關於 ROSE 的常見問題解答列表,這些問題主要來自 rose-public 郵件列表 連結

如何搜尋 rose-public 郵件列表以查詢之前提出的問題?

[編輯 | 編輯原始碼]

在 Google 搜尋中使用以下命令
site:https://mailman.nersc.gov/pipermail/rose-public $(ADD_YOUR_SEARCH_TERM_HERE)

如何檢查 ROSE 的版本?

[編輯 | 編輯原始碼]

ROSE_Install_path/include/rose/rosePublicConfig.h

/* Define to the version of this package. */
#define ROSE_PACKAGE_VERSION "0.9.8.54"


在你的程式碼中檢查這一點

bool checkRoseVersionNumber(const std::string &need) {
    std::vector<std::string> needParts = rose::StringUtility::split('.',
need);
    std::vector<std::string> haveParts = rose::StringUtility::split('.',
ROSE_PACKAGE_VERSION);

    for (size_t i=0; i < needParts.size() && i < haveParts.size(); ++i) {
        if (needParts[i] != haveParts[i])
            return needParts[i] < haveParts[i];
    }
    // E.g., need = "1.2" and have = "1.2.x", or vice versa
    return true;
} 

為什麼 ROSE 工作人員無法回答我所有問題?

[編輯 | 編輯原始碼]

當你提交給 rose-public@nersc.gov 郵件列表的問題沒有得到回覆時,你可能會感到非常沮喪。你可能會想知道為什麼 ROSE 工作人員有時無法提供幫助。

以下是一些可能的解釋

  • 他們與研究和開發領域中的其他人一樣忙碌。他們可能日夜不停地工作以滿足提案、論文、專案評審、交付成果等的截止日期。
  • 鑑於 ROSE 由合作者、前工作人員、博士後和實習生做出的貢獻的廣度和深度,他們並不瞭解自己編譯器的每個角落。此外,大多數貢獻缺乏良好的文件,這是未來應該改進的地方。
  • 有些問題很困難,是開放的研究和開發問題。他們可能也一無所知。
  • 他們有時只是感到懶惰,或者正在休假。

及時獲得問題答案和解決問題的可能替代方案

  • 請先完成自己的功課(例如,Google 搜尋)。
  • ROSE 團隊正在透過內部程式碼審查流程積極解決文件問題,以強制執行未來貢獻的良好文件記錄。
  • 幫助他人,就是幫助自己。在 rose-public@nersc.gov 郵件列表上回答問題,併為這個社群可編輯的華夏公益教科書做出貢獻。
  • 找到與 ROSE 團隊正式合作或為其提供資金的方式。當資金流動時,事情會進展更快 :-) 這很悲哀,但卻是這個忙碌世界中的真實情況。

ROSE 有多少行原始碼?

[編輯 | 編輯原始碼]

截至 2012 年 7 月 11 日,不包括 EDG 子模組和所有原始碼註釋,ROSE 的核心(rose/src)大約有 **674,000 行** C/C++ 原始碼。

包括測試、專案和教程目錄,ROSE 的程式碼量約為 **200 萬行**。

下面顯示了一些詳細資訊

[rose/src]./cloc-1.56.pl .
    3076 text files.
    2871 unique files.                                          
     716 files ignored.

http://cloc.sourceforge.net v 1.56  T=26.0 s (91.7 files/s, 39573.3 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C++                            908          75280          93960         354636
C                              123          12010           3717         199087
C/C++ Header                   915          28302          38412         121373
Bourne Shell                    17           3346           4347          25326
Perl                             4            743           1078           7888
Java                            18           1999           4517           7096
m4                               1            747             20           6489
Python                          34           1984           1174           5363
make                           148           1682           1071           3666
C#                              11            899            274           2546
SQL                              1              0              0           1817
Pascal                           5            650             31           1779
CMake                          168           1748           4880           1702
yacc                             3            352            186           1544
Visual Basic                     6            228            421           1180
Ruby                            11            281            181            809
Teamcenter def                   3              3              0            606
lex                              2            103             47            331
CSS                              1             95             32            314
Fortran 90                       1             34              6            244
Tcl/Tk                           2             29              6            212
HTML                             1              8              0             15
-------------------------------------------------------------------------------
SUM:                          2383         130523         154360         744023
-------------------------------------------------------------------------------

ROSE 的大小是多少?

[編輯 | 編輯原始碼]

僅顯示頂層資訊(以 MB 為單位):du -msl * | sort -nr

170	tests
109	projects
90	src
19	docs
16	winspecific
16	ROSE_ResearchPapers
15	binaries
7	scripts
5	LicenseInformation
4	tutorial
4	autom4te.cache
2	libltdl
2	exampleTranslators
2	configure
2	config
2	ChangeLog

按大小(兆位元組)對目錄進行排序

 du -m | sort -nr >~/size.txt
709	.
250	./.git
245	./.git/objects
243	./.git/objects/pack
170	./tests
109	./projects
90	./src
76	./tests/CompileTests
50	./tests/RunTests
40	./tests/RunTests/FortranTests
34	./tests/RunTests/FortranTests/LANL_POP
29	./tests/RunTests/FortranTests/LANL_POP/netcdf-4.1.1
27	./src/3rdPartyLibraries
23	./tests/roseTests
23	./src/frontend
22	./tests/CompileTests/Fortran_tests
21	./tests/CompilerOptionsTests
19	./docs
18	./tests/CompileTests/RoseExample_tests
18	./src/midend
18	./docs/Rose
16	./winspecific
16	./ROSE_ResearchPapers
15	./tests/CompileTests/Fortran_tests/gfortranTestSuite
15	./binaries/samples
15	./binaries
14	./tests/CompileTests/Fortran_tests/gfortranTestSuite/gfortran.dg
14	./src/roseExtensions
11	./projects/traceAnalysis
10	./tests/CompileTests/A++Code
10	./tests/CompilerOptionsTests/testCpreprocessorOption
10	./tests/CompilerOptionsTests/A++Code
10	./src/roseExtensions/qtWidgets
10	./src/frontend/Disassemblers
10	./projects/symbolicAnalysisFramework
10	./projects/SATIrE
10	./projects/compass
9	./winspecific/MSVS_ROSE
9	./tests/RunTests/A++Tests
9	./tests/roseTests/binaryTests
9	./src/frontend/SageIII
9	./projects/symbolicAnalysisFramework/src
9	./docs/Rose/powerpoints
8	./winspecific/MSVS_project_ROSETTA_empty
8	./projects/simulator
7	./tests/RunTests/FortranTests/LANL_POP_OLD
7	./tests/CompileTests/Cxx_tests
7	./src/midend/programTransformation
7	./src/midend/programAnalysis
7	./src/3rdPartyLibraries/libharu-2.1.0
7	./scripts
7	./projects/symbolicAnalysisFramework/src/mpiAnal
7	./projects/RTC
6	./winspecific/MSVS_ROSE/Debug
6	./tests/RunTests/FortranTests/LANL_POP/netcdf-4.1.1/ncdap_test
6	./tests/roseTests/programAnalysisTests
6	./src/3rdPartyLibraries/ckpt
6	./src/3rdPartyLibraries/antlr-jars
6	./projects/SATIrE/src
5	./tests/RunTests/FortranTests/LANL_POP/pop-distro
5	./tests/RunTests/FortranTests/LANL_POP/netcdf-4.1.1/libcf
5	./tests/CompileTests/ElsaTestCases
5	./src/ROSETTA
5	./src/3rdPartyLibraries/qrose
5	./projects/DatalogAnalysis
5	./projects/backstroke
5	./LicenseInformation
5	./docs/Rose/AstProcessing

按大小列出檔案

 find . -type f -print0 | xargs -0 ls -s | sort -k1,1rn
241568 ./.git/objects/pack/pack-f366503d291fc33cb201781e641d688390e7f309.pack
13484 ./tests/CompileTests/RoseExample_tests/Cxx_Grammar.h
10240 ./projects/traceAnalysis/vmp-hw-part.trace
6324 ./tests/RunTests/FortranTests/LANL_POP_OLD/poptest.tgz
5828 ./winspecific/MSVS_ROSE/Debug/MSVS_ROSETTA.pdb
4732 ./.git/objects/pack/pack-f366503d291fc33cb201781e641d688390e7f309.idx
4488 ./binaries/samples/bgl-helloworld-mpicc
4488 ./binaries/samples/bgl-helloworld-mpixlc
4080 ./LicenseInformation/edison_group.pdf
3968 ./projects/RTC/tags
3952 ./src/frontend/Disassemblers/x86-InstructionSetReference-NZ.pdf
3908 ./tests/CompileTests/RoseExample_tests/trial_Cxx_Grammar.C
3572 ./winspecific/MSVS_project_ROSETTA_empty/MSVS_project_ROSETTA_empty.ncb
3424 ./src/frontend/Disassemblers/x86-InstructionSetReference-AM.pdf
2868 ./.git/index
2864 ./projects/compassDistribution/COMPASS_SUBMIT.tar.gz
2864 ./projects/COMPASS_SUBMIT.tar.gz
2740 ./ROSE_ResearchPapers/2007-CommunicatingSoftwareArchitectureUsingAUnifiedSingle-ViewVisualization-ICECC
S.pdf
2592 ./docs/Rose/powerpoints/rose_compiler_users.pptx
2428 ./src/3rdPartyLibraries/ckpt/wrapckpt.c
2408 ./projects/DatalogAnalysis/jars/weka.jar
2220 ./scripts/graph.tar
1900 ./src/3rdPartyLibraries/antlr-jars/antlr-3.3-complete.jar
1884 ./src/3rdPartyLibraries/antlr-jars/antlr-3.2.jar
1848 ./src/midend/programTransformation/ompLowering/run_me_defs.inc
1772 ./src/3rdPartyLibraries/qrose/docs/QROSE.pdf
1732 ./tests/CompileTests/Cxx_tests/longFile.C
1724 ./src/midend/programTransformation/ompLowering/run_me_task_defs.inc
1656 ./ChangeLog
1548 ./tests/roseTests/binaryTests/yicesSemanticsExe.ans
1548 ./tests/roseTests/binaryTests/yicesSemanticsLib.ans
1480 ./ROSE_ResearchPapers/1997-ExpressionTemplatePerformanceIssues-IPPS.pdf
1408 ./docs/Rose/powerpoints/ExaCT_AllHands_March2012_ROSE.pptx

...

無法下載 EDG 二進位制 tar 包

[編輯 | 編輯原始碼]

三個可能的原因

  • 託管 EDG 二進位制檔案的網站已關閉(有一種手動方式獲取二進位制檔案)。
  • 我們不支援你使用的平臺,因此沒有適合你的 EDG 二進位制檔案。
  • 你從非官方的倉庫克隆了 ROSE,因此構建過程無法確定適合你的 EDG 二進位制檔案的正確版本。(下面提到了一個解決方案)。

rosecompiler.org 網站可能正在維護中。

因此你可能會遇到以下錯誤訊息

make[3]: Entering directory `/home/leo/workspace/github-rose/buildtree/src/frontend/CxxFrontend' test -d /nfs/casc/overture/ROSE/git/ROSE_EDG_Binaries && cp /nfs/casc/overture/ROSE/git/ROSE_EDG_Binaries/roseBinaryEDG-3-3-i686-pc-linux-gnu-GNU-4.4-32fe4e698c2e4a90dba3ee5533951d4c.tar.gz . || wget http://www.rosecompiler.org/edg_binaries/roseBinaryEDG-3-3-i686-pc-linux-gnu-GNU-4.4-32fe4e698c2e4a90dba3ee5533951d4c.tar.gz --2012-08-05 12:58:29-- http://www.rosecompiler.org/edg_binaries/roseBinaryEDG-3-3-i686-pc-linux-gnu-GNU-4.4-32fe4e698c2e4a90dba3ee5533951d4c.tar.gz Resolving www.rosecompiler.org... 128.55.6.204 Connecting to www.rosecompiler.org|128.55.6.204|:80... failed: No route to host. make[3]: *** [roseBinaryEDG-3-3-i686-pc-linux-gnu-GNU-4.4-32fe4e698c2e4a90dba3ee5533951d4c.tar.gz] Error 4

在這種情況下,你應該索取丟失的 tar 包,或在我們的備份位置找到它

你無需克隆整個 edge 二進位制倉庫,因為它很大。你只需下載你需要的那個(在 github.com 上單擊原始檔案連結)。

獲得 tar 包後,將其複製到你的構建樹的 CxxFrontend 子目錄

  • buildtree/src/frontend/CxxFrontend

然後你應該能夠正常地透過鍵入 make 來構建 rose。

待辦事項:使用替代路徑自動搜尋以獲取 edg 二進位制檔案

另一個可能的原因是您從非官方儲存庫克隆了本地 rose 儲存庫。

  • 為了保持 rose 原始碼和 EDG 二進位制檔案之間的正確匹配,我們需要一個規範的儲存庫可用。
make[3]: Leaving directory `/global/project/projectdirs/rosecompiler/rose-project-workspace/xomp-instr/buildtree/src/frontend/CxxFrontend/Clang'
Unable to find a remote tracking a canonical repository.  Please add a
canonical repository as a remote and ensure it is up to date.  Currently
configured remotes are:

   origin => git@xxx.com/myrose.git

Potential canonical repositories include:

   anything ending with "rose.git" (case insensitive)
Unable to find a remote tracking a canonical repository.  Please add a
canonical repository as a remote and ensure it is up to date.  Currently
configured remotes are:

   origin => git@xxx.com/myrose.git

Potential canonical repositories include:

   anything ending with "rose.git" (case insensitive)
make[3]: Entering directory `/global/project/projectdirs/rosecompiler/rose-project-workspace/xomp-instr/buildtree/src/frontend/CxxFrontend'
test -d /nfs/casc/overture/ROSE/git/ROSE_EDG_Binaries && cp /nfs/casc/overture/ROSE/git/ROSE_EDG_Binaries/roseBinaryEDG-3-3-x86_64-pc-linux-gnu-GNU-4.3-.tar.gz  . || wget http://www.rosecompiler.org/edg_binaries/roseBinaryEDG-3-3-x86_64-pc-linux-gnu-GNU-4.3-.tar.gz
--2013-02-15 17:26:42--  http://www.rosecompiler.org/edg_binaries/roseBinaryEDG-3-3-x86_64-pc-linux-gnu-GNU-4.3-.tar.gz
Resolving www.rosecompiler.org... 128.55.6.204
Connecting to www.rosecompiler.org|128.55.6.204|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2013-02-15 17:26:42 ERROR 404: Not Found.

make[3]: *** [roseBinaryEDG-3-3-x86_64-pc-linux-gnu-GNU-4.3-.tar.gz] Error 1
make[3]: Leaving directory `/global/project/projectdirs/rosecompiler/rose-project-workspace/xomp-instr/buildtree/src/frontend/CxxFrontend'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/global/project/projectdirs/rosecompiler/rose-project-workspace/xomp-instr/buildtree/src/frontend/CxxFrontend'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/global/project/projectdirs/rosecompiler/rose-project-workspace/xomp-instr/buildtree/src/frontend'
make: *** [all-recursive] Error 1
make: Leaving directory `/global/project/projectdirs/rosecompiler/rose-project-workspace/xomp-instr/buildtree/src'

解決方案:將官方 rose 儲存庫新增為本地儲存庫的另一個遠端儲存庫

  • 新增一個規範的儲存庫,比如 github 上的這個:git add remote official-rose https://github.com/rose-compiler/rose.git
  • git fetch official-rose // 從規範的儲存庫中檢索雜湊值等
  • 現在你可以再次構建 rose。它應該找到你剛剛新增的規範儲存庫,並使用它來查詢匹配的 EDG 二進位制檔案

如何訪問 EDG 或 EDG-SAGE 連線程式碼?

[編輯 | 編輯原始碼]

來自 http://rosecompiler.org/ROSE_UserManual/ROSE-UserManual.pdf 第 5 頁

用於將 EDG 的 AST 轉換為 SAGE III 的連線程式碼是鬆散地從 EDG C++ 原始碼生成器派生的,並且構成了 SAGE III 從 EDG 到 SAGE III 的 IR 的翻譯器基礎。

根據我們擁有的許可,EDG 原始碼和發行版中從 EDG AST 的翻譯被排除在原始碼釋出之外,並透過二進位制格式提供。EDG 工作的任何部分對 ROSE 使用者都是不可見的。EDG 原始碼僅供擁有 EDG 研究或商業許可證的人使用。

手冊的第 2.6 章“獲取用於研究用途的免費 EDG 許可證”包含有關如何獲取 EDG 許可證的說明。

獲得許可證後,請聯絡 ROSE 工作人員以驗證您的許可證。之後,他們將為您提供有關如何繼續操作的更多說明。

如何加快編譯 ROSE 的速度?

[編輯 | 編輯原始碼]

問題 編譯 ROSE 需要幾個小時,如何加快此過程?

答案

  • 如果您有多核處理器,請嘗試使用 make -j4(使用四個程序或更多您喜歡的程序進行構建)。
  • 還可以嘗試僅透過鍵入make -C src/ -j4在 src/ 下構建 librose.so
  • 或者僅嘗試在配置期間構建您感興趣的語言支援,例如
    • ../sourcetree/configure --enable-only-c # 如果你只對 C/C++ 支援感興趣
    • ../sourcetree/configure --enable-only-fortran # 如果你只對 Fortran 支援感興趣
    • ../sourcetree/configure --help # 顯示所有其他選項以僅啟用幾種語言。

ROSE 能接受不完整的程式碼嗎?

[編輯 | 編輯原始碼]

https://mailman.nersc.gov/pipermail/rose-public/2011-July/001015.html

ROSE 不處理不完整的程式碼。雖然這在未來可能是可能的。它將取決於語言,並且可能在很大程度上依賴於我們在內部使用的一些特定語言工具。然而,這並不是我們工作的重點。如果您想展示我們正在使用的一些內部工具或我們可以使用的替代工具如何處理不完整的程式碼,這可能很有趣,我們可以討論它。

例如,我們目前沒有使用 Clang,但如果它處理不完整的程式碼,這對於未來可能很有趣。我記得一些最新的 EDG 工作可能處理一些不完整的程式碼,如果這是真的,那可能也很有趣。我還沒有嘗試使用 OFP 處理不完整的程式碼,所以我不確定它的效果如何。同樣,我不知道 ECJ Java 支援的不完整程式碼處理能力。如果您知道這些問題中的任何一個,我們可以進一步討論。

我對此有一些疑問,即從不完整的程式碼分析中可以獲得多少有意義的資訊,因此這讓我有點擔心。我預計它非常依賴於語言,並且可能會對不完整的程式碼有一些限制。因此,更好地理解這個主題將是我的另一個要求。

ROSE 能分析 Linux 核心原始碼嗎?

[編輯 | 編輯原始碼]

https://mailman.nersc.gov/pipermail/rose-public/2011-April/000856.html

問題:我正在嘗試分析 Linux 核心。我不確定 ROSE 可以處理的程式碼庫的大小,也找不到有關它是否已在 Linux 核心原始碼上進行過嘗試的參考資料。截至目前,我正在嘗試在原始碼上執行標識轉換器,我想知道是否可以使用 ROSE 完成,以及之前是否成功測試過。

簡短回答:目前不行

長答案:我們預設使用 EDG 3.3,此版本的 EDG 不處理 Linux 核心程式碼的 asm() 語句中使用的 GNU 特定暫存器修飾符。可能還有其他問題,但這至少是我們之前在這方面工作時發現的問題。但我們正在努力將 EDG 前端升級到更新的版本 4.4。

ROSE 能編譯 C++ Boost 庫嗎?

[編輯 | 編輯原始碼]

https://mailman.nersc.gov/pipermail/rose-public/2010-November/000544.html

還沒有。

我知道 ROSE 無法處理 Boost 的某些部分的情況。在每種情況下,這都是 EDG 問題,因為我們使用的是舊版本的 EDG。我們正在嘗試升級到更新版本的 EDG (4.x),但該版本的 EDG 在 ROSE 中的使用沒有包含足夠的 C++ 支援,因此還沒有準備好。C 支援已在內部測試,但我們需要更多時間來完成這項工作。

如何在 AST 中查詢 XYZ?

[編輯 | 編輯原始碼]

從 AST 中檢索資訊的常用步驟是

  • 準備一個最簡單的(最好只有 5-10 行),可編譯的示例程式碼,其中包含您要查詢的程式碼功能(例如 array[i][j],如果您好奇如何在 AST 中查詢多維陣列的使用),避免包含任何標頭檔案(#include file.h)以使程式碼保持簡潔。
    • 請注意:示例程式碼中不要包含任何標頭檔案。標頭檔案(例如 #include <stdio.h>)可能會將數千個節點引入 AST。
  • 使用 dotGeneratorWholeASTGraph 生成輸入程式碼的詳細 AST 點圖
  • 使用 zgrviewer-0.8.2 的 run.sh 視覺化點圖
  • 在點圖中以視覺/手動方式定位您想要的資訊,瞭解要查詢的內容以及查詢位置

一些示例 AST 圖可以在 https://github.com/chunhualiao/rose-ast 獲取

如何獲取 AST 節點的子節點?

[編輯 | 編輯原始碼]

一旦您知道如何手動在 AST 中查詢子節點。您可以使用程式碼使用 AST 成員函式、遍歷或 SageInteface 函式等來遍歷 AST,以檢索您想要的資訊

  • ROSE 預設情況下為名為 X 的子節點提供 get_X() 之類的成員訪問函式。例如,對於 SgBinaryOp,在 AST 圖中有一個名為 lhs_operand 的子節點,使用 get_lhs_operand()。
  • 這些名稱在 AST 圖中顯示為從父節點到子節點的邊的標籤。

要透過索引獲取子節點,請使用該函式(儘管不推薦這樣做)

virtual SgNode * 	get_traversalSuccessorByIndex (size_t idx)

或者相關且類似命名的函式。

如何從 AST 遍歷中過濾掉標頭檔案?

[編輯 | 編輯原始碼]

https://mailman.nersc.gov/pipermail/rose-public/2010-April/000144.html

問題:我想在處理過程中從分析/轉換中排除 #include 檔案中的函式。

預設情況下,AST 遍歷可能會訪問所有 AST 節點,包括來自標頭檔案的節點。

因此,AST 處理類提供了三個函式

  • T traverse (SgNode * node, ..):遍歷完整的 AST,表示來自包含檔案的程式碼的節點
  • T traverseInputFiles(SgProject* projectNode,..) 遍歷表示命令列上指定的檔案的 AST 的子樹
  • T traverseWithinFile(SgNode* node,..):僅表示與起始節點相同檔案的程式碼的節點

SgIfStmt::get_true_body() 應該返回 SgBasicBlock 嗎?

[編輯 | 編輯原始碼]

https://mailman.nersc.gov/pipermail/rose-public/2011-April/000930.html

true/false 兩個部分以前都是 SgBasicBlock。

後來,我們決定對塊(用 {...})和單語句(不用 { ..})體進行更忠實的表示。因此它們現在是 SgStatement(SgBasicBlock 是 SgStatement 的子類)。

但似乎文件尚未更新以與更改保持一致。

您必須在程式碼中檢查主體是塊還是單個語句。或者您可以使用以下函式來確保所有主體必須是 SgBasicBlock。

// 以上所有 ensureBasicBlockAs*() 的包裝器,用於確保 s 的父節點是一個包含語句列表作為子節點的範圍語句,否則在兩者之間生成一個 SgBasicBlock。

SgLocatedNode * SageInterface::ensureBasicBlockAsParent (SgStatement *s)

如何處理 #include "header.h"、#if、#define 等?

[編輯 | 編輯原始碼]

這被稱為 ROSE AST 中的預處理資訊。它們附加在附近的 AST 節點之前、之後或內部(只有具有源位置資訊的節點)。

提供了一個示例翻譯器來遍歷輸入程式碼的 AST 並轉儲有關找到的預處理資訊的資訊。此翻譯器的原始碼為 https://github.com/rose-compiler/rose/blob/master/exampleTranslators/defaultTranslator/preprocessingInfoDumper.C

要使用翻譯器

buildtree/exampleTranslators/defaultTranslator/preprocessingInfoDumper -c main.cxx
-----------------------------------------------
Found an IR node with preprocessing Info attached:
(memory address: 0x2b7e1852c7d0 Sage type: SgFunctionDeclaration) in file
/export/tmp.liao6/workspace/userSupport/main.cxx (line 3 column 1)
-------------PreprocessingInfo #0 ----------- :
classification = CpreprocessorIncludeDeclaration:
  String format = #include "all_headers.h"

relative position is = before

SgClassDeclaration::get_definition() 返回 NULL?

[編輯 | 編輯原始碼]

如果您仔細檢視整個 AST 圖,您會發現同一個類的定義宣告和非定義宣告。

符號通常與非定義宣告相關聯。類定義與定義宣告相關聯。

您可能希望在嘗試獲取定義之前從非定義宣告獲取定義宣告,就像此函式一樣

SgFunctionDefinition* getFunctionDefinitionFromDeclaration(const SgFunctionDeclaration* funcDecl) {
  //Get the defining declaration (we don't know if funcDecl is the defining or nonDefining declaration
  SgFunctionDeclaration* funcDefDecl = isSgFunctionDeclaration(funcDecl->get_definingDeclaration()); 
  ROSE_ASSERT(funcDefDecl != NULL);

  //Get the definition from the defining declaration
  SgFunctionDefinition* funcDef = isSgFunctionDefinition(funcDefDecl->get_definition());  
  ROSE_ASSERT(funcDef != NULL);
  return funcDef;
}

如何處理陣列?

[編輯 | 編輯原始碼]

第一步是熟悉表示陣列型別 (SgArrayType) 和陣列引用 (SgPntrArrRefExp) 的 AST。然後您可以從 AST 中檢索必要的資訊。

為了理解陣列型別和陣列引用,這裡有一個示例,

// cat ~/temp/array.c 
int a[5][10][15];  // array declaration, a type is declared
int foo()
{
  return a[0][1][2]; // a reference to array element
}

陣列型別由 SgArrayType 表示。

int a[5][10][15],對應三個相互關聯的 SgArrayType

List a->get_type() 將返回第一個

  • SgArrayType_1: (index=5, base_type = SgArrayType_2)
  • SgArrayType_2: (index=10, base_type = SgArrayType_3)
  • SgArrayType_3: (index=15, base_type = SgTypeInt )

因此,從第一個到元素型別的遍歷將獲得所有維度大小 5-10-15

子樹看起來像

     SgArrayType_1
      /       \
     5      SgArrayType_2
            /       \
           10      SgArrayType_3  
                     /    \
                    15     SgTypeInt

陣列引用由 SgPntrArrRefExp 表示

像這樣的引用:a[0][1][2]

  • SgPntrArrRefExp_1
  • SgPntrArrRefExp_2
  • SgPntrArrRefExp_3

子樹應該看起來像以下內容

    a[0][1][2] //SgPntrArrRefExp
      /    \
  a[0][1]  2 // SgIntVal
    / \
 a[0]  1
  / \
a    0

SgVarRefExp 

http://rosecompiler.org/ROSE_HTML_Reference/namespaceSageInterface.html 中有許多與陣列處理相關的函式

您可以直接搜尋“array”來找到它們

//Check if an expression is an array access (SgPntrArrRefExp). If so, return its name expression and subscripts if requested. Users can use convertRefToInitializedName() to get the possible name. It does not check if the expression is a top level SgPntrArrRefExp. 

SageInterface::isArrayReference (SgExpression *ref, SgExpression **arrayNameExp=NULL, std::vector< SgExpression * > **subscripts=NULL)


// 	returns the array dimensions in an array as defined for arrtype
std::vector< SgExpression * > 	SageInterface::get_C_array_dimensions (const SgArrayType &arrtype)

// 	Get the number of dimensions of an array type. 
 int 	SageInterface::getDimensionCount (SgType *t)

// 	Get the element type of an array. 
 SgType * 	SageInterface::getArrayElementType (SgType *t)

可以在 https://github.com/rose-compiler/rose-develop/blob/master/src/midend/programTransformation/ompLowering/omp_lowering.cpp 中找到使用這些函式的示例程式碼

例如,void linearizeArrayAccess(SgPntrArrRefExp* top_array_ref) 使用多維下標重寫陣列引用,以使用一維下標的引用

  • a[i][j] 更改為 a[i*col_size +j]
  • a [i][j][k] 更改為 a [(i*col_size + j)*K_size +k]

處理一維陣列引用的示例程式碼

For 1-D array element access a[0], the AST with 3 nodes looks like:

   a[0]          // node 1: SgPntrArrRefExp
  /    \
a       0    //node 3:  SgIntVal
|
// node 2: SgVarRefExp

So the code searching for SgVarRefExp will find a. The next step is to check its type.

SgVarRefExp *vref = ... 
ROSE_ASSERT (vref != NULL);

 SgType* t = vref->get_type();

  if (SgArrayType* atype= isSgArrayType(t)) // now you have array type
  {
    // obtain the dimension vector
    vector<SgExpression*> dimensions  =  SageInterface::get_C_array_dimensions (* atype);
    // dimensions.size() should be 1 if you only handle 1-D array types
    if (dimensions.size() ==1)
    {
      SgPntrArrRefExp * arr_ref_exp = vref->get_parent(); // now you get a[0] from a.
      //do your things you want , with a (vref) and a[o] (arr_ref_exp)

    }
  }
   else if (SageInterface::isScalarType(t))// if scalar types, handle them differently
   {
     ...
   } 

如何新增新的 AST 節點?

[編輯 | 編輯原始碼]

ROSE 開發者指南 (http://www.rosecompiler.org/ROSE_DeveloperInstructions.pdf) 中有一節名為“1.7 新增新的 SAGE III IR 節點(僅限開發者)”。

但在決定新增新節點之前,您可能要考慮 AstAttribute(附加到 AST 的使用者定義物件)是否足以解決您的問題。

例如,ROSE 中 OpenMP 實現的第一個版本(rose/projects/OpenMP_Translator)最初使用 AstAttribute 來表示從編譯指示解析的資訊。只有在第二個版本中,我們才引入了專門的 AST 節點。

在 ROSE 中新增新的 IR 節點時,有兩個獨立的步驟。

  • 第一步(宣告):在 ROSE 中為新的 IR 節點新增類宣告/實現。此步驟主要與 ROSETTA 相關。
  • 第二步(建立):在某個時間點建立這些新的 IR 節點:例如,在前端、中端甚至後端(如果需要)中的某個地方。因此,此步驟將逐案決定。

如果新的 IR 型別來自它們在 EDG 中的對應型別,則需要修改 EDG/SAGE 連線程式碼。如果不是,則 EDG/SAGE 連線程式碼可能不相關。

如果您試圖新增新節點來表示編譯指示資訊,則可以建立新的節點,而無需涉及 EDG 或它與 ROSE 的連線。您只需解析原始 AST 中的編譯指示字串並建立您自己的節點以獲取 AST 的新版本。然後應該完成。

AST 合併是如何工作的?

[編輯 | 編輯原始碼]

演示 AST 合併的測試位於目錄中

    tests/nonsmoke/functional/CompileTests/mergeAST_tests

(執行“make check”以檢視數百個測試)。

父節點與範圍

[編輯 | 編輯原始碼]

AST 節點可以有一個父節點,它與它的範圍不同。

例如:結構宣告的父節點是 typedef 宣告。但結構的範圍是 typedef 宣告的範圍。

typedef struct frame {int x;} s_frame;

將文字解析為 AST

[編輯 | 編輯原始碼]

有一些實驗性的支援將簡單的程式碼文字解析為 AST 片段。它不是為了解析整個原始碼。但這種支援應該能夠擴充套件以處理更多型別的輸入。

關於這項工作的一些文件

使用解析器構建塊的示例專案

  • projects/pragmaParsing 應該可以工作。

如何在翻譯中跳過系統標頭檔案?

[編輯 | 編輯原始碼]

通常我們只對使用者程式碼感興趣。AST 表示來自使用者和系統標頭檔案的所有程式碼。我們需要跳過來自系統標頭檔案的內容。

// Final most complete version, skip all header files, we cannot unparse changed AST from header files , at least by default

    if (Inliner::skipHeaders)
    { 
      string filename= funcall->get_file_info()->get_filename();
      string suffix = StringUtility ::fileNameSuffix(filename);
      //vector.tcc: This is an internal header file, included by other library headers
      if (suffix=="h" ||suffix=="hpp"|| suffix=="hh"||suffix=="H" ||suffix=="hxx"||suffix=="h++" ||suffix=="tcc")
        return false;

      // also check if it is compiler generated, mostly template instantiations. They are not from user code.
      if (funcall->get_file_info()->isCompilerGenerated() )
        return false;

      // check if the file is within include-staging/ header directories
      if (insideSystemHeader(funcall))
       return false;

    }

//------------partial solutions

bool processStatements(SgNode* n)
{
  ROSE_ASSERT (n!=NULL);
  // Skip compiler generated code, system headers, etc.
  if (isSgLocatedNode(n))
  {
    if (isSgLocatedNode(n)->get_file_info()->isCompilerGenerated())
      return false;
  }
 ...
}

這是基於 Sg_File_Info 的

Inside of Sg_File_Info::display(debug.......) 
     isTransformation                      = false 
     isCompilerGenerated                   = true (no position information) 
     isOutputInCodeGeneration              = false 
     isShared                              = false 
     isFrontendSpecific                    = true (part of ROSE support for gnu compatability) 
     isSourcePositionUnavailableInFrontend = false 
     isCommentOrDirective                  = false 
     isToken                               = false 
     file_id  = 2 
     filename = /home/liao6/daily-test-rose/upcwork/install/include/gcc_HEADERS/rose_edg_required_macros_and_functions.h 
     line     = 167  column   = 1 

....
shared[1] int gsj;
Inside of Sg_File_Info::display(debug.......) 
     isTransformation                      = false 
     isCompilerGenerated                   = false 
     isOutputInCodeGeneration              = false 
     isShared                              = false 
     isFrontendSpecific                    = false 
     isSourcePositionUnavailableInFrontend = false 
     isCommentOrDirective                  = false 
     isToken                               = false 
     filename = /home/liao6/svnrepos/mycode/rose/upc/unshared.upc 
     line     = 6  column = 1 
     file_id  = 1 
     filename = /home/liao6/svnrepos/mycode/rose/upc/unshared.upc 
     line     = 6  column   = 1 


另一種方法是 rose 為所有系統標頭檔案建立副本並將它們儲存在專用路徑中

  bool insideSystemHeader (SgLocatedNode* node)
  {
    bool rtval = false;
    ROSE_ASSERT (node != NULL);
    Sg_File_Info* finfo = node->get_file_info();
    if (finfo!=NULL)
    {
      string fname = finfo->get_filenameString();
      string buildtree_str1 = string("include-staging/gcc_HEADERS");
      string buildtree_str2 = string("include-staging/g++_HEADERS");
      string installtree_str1 = string("include/edg/gcc_HEADERS");
      string installtree_str2 = string("include/edg/g++_HEADERS");
      // if the file name has a sys header path of either source or build tree
      if ((fname.find (buildtree_str1, 0) != string::npos) ||
          (fname.find (buildtree_str2, 0) != string::npos) ||
          (fname.find (installtree_str1, 0) != string::npos) ||
          (fname.find (installtree_str2, 0) != string::npos)
          )
        rtval = true;
    }
    return rtval;                                                                                                              
  } 



ROSE identityTranslator 可以生成 100% 相同的輸出檔案嗎?

[編輯 | 編輯原始碼]

https://mailman.nersc.gov/pipermail/rose-public/2011-January/000604.html

問題:Rose identityTranslator 會“自動”執行一些修改。

這些修改是

  • 擴充套件 assert 宏。
  • 在 typedef 型別的常量周圍新增額外的括號(例如,c=Typedef_Example(12); 在輸出中轉換為 c = Typedef_Example((12));)。
  • 將 NULL 轉換為 0。

我可以避免這些修改嗎?

答案:不能。

目前沒有簡單的方法可以避免這些更改。其中一些是由 cpp 預處理器引入的。另一些是由 ROSE 使用的 EDG 前端引入的。100% 忠實的原始碼到原始碼翻譯可能需要對預處理指令處理和 EDG 內部進行重大更改。

我們內部討論過將原始標記字串儲存到 AST 中,並使用它們獲取忠實的未解析程式碼。但據我所知,這項工作仍處於起步階段。

如何構建一個插入函式呼叫的工具?

[編輯 | 編輯原始碼]

https://mailman.nersc.gov/pipermail/rose-public/2010-July/000319.html

問題:我正在嘗試構建一個工具,當原始碼中存在屬於特定組的函式(例如,所有以 foo_ 開頭的函式)時,它會插入一個或多個函式呼叫。在 AST 遍歷過程中,如何找到正確的位置,即,ROSE 中是否存在搜尋字串模式或類似功能的函式?

答案

  • 在 ROSE 教程的第 28 章 AST 構建中,有一些示例使用遍歷或 queryTree 將函式呼叫插入 AST。我將透過檢查節點的特定 SgFunctionDefinition(或您需要的任何內容)來處理此問題,然後檢查節點的名稱以找到其位置。
  • 您可以
    • 使用 AST 查詢機制查詢所有函式並將它們儲存在容器中。例如 Rose_STL_Container<SgNode*> nodeList = NodeQuery::querySubTree(root_node,V_Sg????);
    • 然後迭代容器以檢查每個函式,檢視函式名稱是否與您想要的匹配。
    • 使用 SageBuilder 名稱空間的 buildFunctionCallStmt() 建立函式呼叫語句。
    • 使用 SageInterface 名稱空間的 insertStatement () 進行插入。

如何將標題插入輸入檔案?

[編輯 | 編輯原始碼]

有一個 SageInterface 函式可以做到這一點

// Insert include "filename" or include <filename> (system header) into the global scope containing the current scope, right after other include XXX.
PreprocessingInfo *     SageInterface::insertHeader (const std::string &filename, PreprocessingInfo::RelativePositionType position=PreprocessingInfo::after, bool isSystemHeader=false, SgScopeStatement *scope=NULL) 

如何複製/克隆一個函式?

[編輯 | 編輯原始碼]

https://mailman.nersc.gov/pipermail/rose-public/2011-April/000919.html

我們需要更具體地說明您要複製的函式。它僅僅是一個原型函式宣告(ROSE 中的非定義宣告)還是帶有定義的函式(ROSE 中的定義宣告)?

  • 使用以下函式可以複製非定義函式宣告
// Build a prototype for an existing function declaration (defining or nondefining is fine).
SgFunctionDeclaration* SageBuilder::buildNondefiningFunctionDeclaration (const SgFunctionDeclaration *funcdecl, SgScopeStatement *scope=NULL)
  • 語義上,複製定義函式宣告是一個問題,因為它引入了相同函式的重新定義。

至少這是一個技巧,先引入錯誤的東西,然後再糾正它。以下是一個用於執行此技巧的示例翻譯器(複製一個定義函式,重新命名它,修復其符號)

#include <rose.h>
#include <stdio.h>
using namespace SageInterface;

int main(int argc, char** argv)
{
  SgProject* project = frontend(argc, argv);
  AstTests::runAllTests(project);

// Find a defining function named "bar" under project

  SgFunctionDeclaration* func=
findDeclarationStatement<SgFunctionDeclaration> (project, "bar", NULL,
true);
  ROSE_ASSERT (func != NULL);

// Make a copy and set it to a new name
  SgFunctionDeclaration* func_copy =
isSgFunctionDeclaration(copyStatement (func));
  func_copy->set_name("bar_copy");

// Insert it to a scope
  SgGlobal * glb = getFirstGlobalScope(project);
  appendStatement (func_copy,glb);

#if 0  // fix up the missing symbol, this should be optional now since SageInterface::appendStatement() should handle it transparently. 
  SgFunctionSymbol *func_symbol =  glb->lookup_function_symbol
("bar_copy", func_copy->get_type());
  if (func_symbol == NULL);
  {
    func_symbol = new SgFunctionSymbol (func_copy);
    glb ->insert_symbol("bar_copy", func_symbol);
  }
#endif
  AstTests::runAllTests(project);
  backend(project);
  return 0;
}

ROSE 的反解析器在決定打印出 AST 部分的文字格式之前,會檢查 AST 部分的 Sg_File_Info 物件。預設情況下,只有來自輸入檔案相同檔案的 AST 或由轉換生成的 AST 才會被反解析。例如,一些 AST 子樹來自包含的標頭檔案。但通常不希望反解析包含的標頭檔案的內容。

如果檔案資訊仍然是原始檔案資訊,則解決方案是將複製的 AST 設定為由轉換生成

// Recursively set source position info(Sg_File_Info) as transformation generated.
SageInterface::setSourcePositionForTransformation (SgNode *root) 

我可以在標頭檔案中轉換程式碼嗎?

[編輯 | 編輯原始碼]

https://mailman.nersc.gov/pipermail/rose-public/2011-May/000971.html

不能。ROSE 目前不會反解析來自標頭檔案的 AST。一個暑期專案嘗試過這樣做。但它沒有完成並且沒有經過良好的測試。

該選項為 -rose:unparseHeaderFiles -rose:unparseHeaderFilesRootFolder UNPARSED_HEADERS_DIR,位於 tests/CompilerTests/UnparseHeadersTests 中

https://mailman.nersc.gov/pipermail/rose-public/2010-August/000344.html

我認為 ROSE 不支援出於安全/實用原因寫入修改後的標頭檔案。修改後的標頭檔案必須儲存到另一個檔案中,因為寫入原始標頭檔案非常危險(想象除錯一個破壞輸入標頭檔案的標頭檔案翻譯器)。然後,所有使用修改後的標頭檔案的其他檔案/標頭檔案都必須更新以使用新的標頭檔案。

此外,所有參與的檔案都必須可由使用者的翻譯器寫入。

因此,當前的反解析器透過檢查儲存在 Sg_File_Info 物件中的檔案標誌(compiler_generated 和/或 output_in_code_generation 等)來跳過來自標頭檔案的 AST 子樹。

如何處理函式的形式引數和實際引數?

[編輯 | 編輯原始碼]

https://mailman.nersc.gov/pipermail/rose-public/2011-June/001008.html

     //Get the actual arguments
     SgExprListExp* actualArguments = NULL;
     if (isSgFunctionCallExp(callSite))
         actualArguments = isSgFunctionCallExp(callSite)->get_args();
     else if (isSgConstructorInitializer(callSite))
         actualArguments = isSgConstructorInitializer(callSite)->get_args();
     ROSE_ASSERT(actualArguments != NULL);

     const SgExpressionPtrList& actualArgList = 
actualArguments->get_expressions();

     //Get the formal arguments.
     SgInitializedNamePtrList formalArgList;
     if (calleeDef != NULL)
         formalArgList = calleeDef->get_declaration()->get_args();

     //The number of actual arguments can be less than the number of 
formal arguments (with implicit arguments) or greater
     //than the number of formal arguments (with varargs)

如何翻譯散落在專案不同目錄中的多個檔案?

[編輯 | 編輯原始碼]

ROSE 翻譯器的預期行為

使用 ROSE 構建的翻譯器旨在像編譯器(gcc、g++、gfortran 等,具體取決於輸入檔案型別)一樣工作。因此,翻譯器的使用者只需要更改輸入檔案的構建系統,以使用翻譯器而不是原始編譯器。

如果原始編譯器隱式地包含或連結任何東西,您可能需要在更改後顯式地設定包含或連結路徑。例如,如果 mpiCC 透明地連結到 /path/to/mpilib.a,則您需要將此連結標誌新增到修改後的 Makefile 中。

On 07/25/2012 11:20 AM, Fernando Rannou wrote:
> > Hello
> >
> > We are trying to use ROSE to refactor  a big project consisting of
> > several  *.cc and *.hh files, located at various directories. Each
> > class is defined in a *.hh file and implemented in a *.cc file.
> > Classes include (#include) other class definitions. But we have only
> > found single file examples.
> >
> > Is this possible? If so, how?
> >
> >
> > Thanks

反解析

[編輯 | 編輯原始碼]

將程式碼生成到不同的檔案中

[編輯 | 編輯原始碼]

https://mailman.nersc.gov/pipermail/rose-public/2012-August/001742.html 問題:我想知道 ROSE 是否可以將兩個檔案(.c 和 .cl)生成到它將 C 翻譯成 OpenCL 時?

回答:ROSE 的輪廓器有一個選項可以將生成的函式輸出到一個新檔案。

https://github.com/rose-compiler/rose/blob/master/src/midend/programTransformation/astOutlining/Outliner.hh

...
// Generate the outlined function into a separated new source file
// -rose:outline:new_file
extern bool useNewFile;
...

您可能想檢查此選項在輪廓器原始檔中是如何使用的,以獲得您想要的內容。

二進位制分析

[編輯 | 編輯原始碼]

ROSE 的二進位制分析功能如何?

[編輯 | 編輯原始碼]

問題:ROSE 的二進位制分析功能如何?它僅僅是反彙編嗎?如果與 ROSE 原始碼分析結合使用,是否可以將二進位制程式碼與原始碼關聯?

答案

ROSE 有各種二進位制反彙編器(x86、ARM、MIPS、PowerPC),它們與原始碼分析一樣,以 AST 的形式建立二進位制的內部表示。儘管原始碼和二進位制程式碼的 AST 節點型別在很大程度上是不同的,但可以使用類似於原始碼分析的概念來分析二進位制 AST。ROSE 有幾個二進位制分析。以下是我想到的一些

  • 控制流圖,虛擬的和使用 Boost 圖形庫的。
  • 函式呼叫圖。
  • 對控制流圖的操作:支配者、後支配者
  • 指標檢測分析,它試圖弄清楚哪些記憶體位置用作高階語言中的指標。
  • 指令分割槽:弄清楚如何將指令分組到基本塊中,以及如何在只有指令列表的情況下將基本塊分組到函式中。它在自動分割槽剝離的、混淆的程式碼方面的準確性已證明優於使用除錯資訊和符號表的最佳反彙編器。
  • x86 指令語義。這是一個正在積極開發的領域,但目前僅支援 32 位整數指令。我們計劃新增浮點數、SIMD、64 位、其他架構和更簡單的 API。但即使按目前的狀況,它也足夠完整,可以模擬完整的 ELF 可執行檔案(甚至 "vi")。請參見下一項
  • 用於 ELF 可執行檔案的 x86 模擬器。這個專案能夠模擬 Linux 核心如何載入可執行檔案以及可執行檔案發出的各種系統呼叫。它足夠完整,可以模擬許多 Linux 程式,但也提供回撥點供使用者插入各種型別的分析。例如,您可以使用它在動態連結後反彙編整個程序。在 projects/simulator 目錄中有很多示例。與 Qemu、Bochs、valgrind、VirtualBox、VMware 等以速度為主要設計驅動的模擬器相比,ROSE 模擬器旨在為使用者提供對儘可能多的執行方面的訪問許可權。
  • 指令語義的外掛。指令語義的編寫方式允許插入不同的“語義域”。ROSE 具有符號域、區間域和部分符號域。符號域可與 SMT 求解器(目前支援 Yices)結合使用。區間域實際上是區間集,並且是二元算術感知的(即,在固定字長上正確處理溢位等)。部分符號域使用單節點表示式來最佳化速度和大小,但以準確性為代價。使用者可以編寫其他域,並且新的 API(正在開發中)將使此操作更加容易。
  • 資料流分析的示例(例如,前面提到的指標分析),但尚未形成一個明確的框架(有人正在開發)。目前,資料流型別分析是使用指令語義支援來實現的:當每個指令“執行”時,它所執行的域會導致資料在機器狀態中流動。每種分析都提供自己的流方程來處理來自兩個或多個方向的控制流匯合點;並提供自己的“下一條指令”函式來迭代控制流圖。
  • 各種格式的克隆檢測:各種形式的句法克隆檢測,包括一種使用區域性敏感雜湊的克隆檢測;以及透過模擬器中的模糊測試進行的語義克隆檢測。

由 Robb 撰寫


您詢問關於將原始碼分析和二進位制分析相結合的問題……這當然是可以實現的,因為 ROSE 可以同時在記憶體中儲存二進位制和原始碼 AST。但我不知道有哪種分析將它們“縫合”在一起。我們確實支援從 ELF 可執行檔案中解析 DWARF 資訊,因此您可能可以使用它將兩個 AST 縫合在一起。

--Robb

日常工作

[編輯 | 編輯原始碼]

git clone 返回錯誤:SSL 證書問題?

[編輯 | 編輯原始碼]

症狀

git clone https://github.com/rose-compiler/rose.git
Cloning into rose...
error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://github.com/rose-compiler/rose.git/info/refs

fatal: HTTP request failed

原因可能是您位於一個修改了原始 SSL 證書的防火牆之後。

解決方案:告訴 cURL 不要檢查 SSL 證書

#Solution 1: Environment variable (temporary)
      $ env GIT_SSL_NO_VERIFY=true git pull

# Solution 2: git-config (permanent)
      # set local configuration
      $ git config --local http.sslVerify false

# Solution 2:  set global configuration
      $ git config --global http.sslVerify false

哪個 IDE 最適合 ROSE 開發人員?

[編輯 | 編輯原始碼]

https://mailman.nersc.gov/pipermail/rose-public/2010-April/000115.html

可能沒有一個廣為人知的最佳整合開發環境。但開發人員報告稱他們正在使用

  • vim
  • emacs
  • KDevelop
  • Source Navigator
  • Eclipse
  • Netbeans

問題是 ROSE 規模龐大,並且包含一些非常大的生成的原始碼檔案(例如,CxxGrammar.h 和 CxxGrammar.C 在構建樹中生成)。因此,許多程式碼瀏覽器可能難以處理 ROSE。

可移植性

[編輯 | 編輯原始碼]

Windows 支援的現狀如何?

[編輯 | 編輯原始碼]

我們確實維護了一些初步的 Windows 支援,透過利用 cmake 來構建 ROSE/src 以生成 librose.so。但是,這項工作尚未完成。

要在 Windows 下構建 librose,請在頂層原始碼樹中鍵入以下命令列

 mkdir ROSE-build-cmake
 cd ROSE-build-cmake
 cmake .. -DBOOST_ROOT=${ROSE_TEST_BOOST_PATH}  // Example: boost installation path /opt/boost_1_40_0-inst

https://mailman.nersc.gov/pipermail/rose-public/2011-December/001349.html

我們尚未完成 Windows 工作。它在我們待辦事項列表中。我們已經開始使用 MS Visual Studio(使用我們維護並在 ROSE 釋出過程中進行測試的 Cmake 構建生成的專案檔案)在內部編譯 ROSE,但它沒有透過我們的測試。因此它還沒有準備好。Windows 版 EDG 二進位制檔案的釋出是另一項工作,將在之後完成。目前我們不知道何時完成這項工作,它很重要,但對於我們的 DOE 特定工作來說並不優先,但對於其他工作來說很重要。所需的工作我們可以討論。如果您想打電話給我,那將是最好的解決方法。給我發一封郵件,不要發到主列表,我們可以安排一下。

https://mailman.nersc.gov/pipermail/rose-public/2011-March/000798.html

在 Windows 下,ROSE 使用 CMake。這是一個目前正在開發的專案。截至 2010 年 11 月,我們能夠編譯和連結 src 目錄。我們還能夠執行連結到 librose 並在前端和後端執行的示例程式。{\em 但是,這是一個內部功能,目前尚未公開提供,因為我們沒有分發所需的 Windows 生成的 EDG 二進位制檔案。此外,目前對 Windows 的支援仍不完整,ROSE 尚未透過其在 Windows 下的內部測試。}

華夏公益教科書